1 // Created on: 1997-07-29
2 // Created by: Denis PASCAL
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Standard_DomainError.hxx>
19 #include <Standard_GUID.hxx>
20 #include <Standard_Type.hxx>
21 #include <TDataStd_Integer.hxx>
22 #include <TDataStd_NoteBook.hxx>
23 #include <TDataStd_Real.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <TDF_Label.hxx>
26 #include <TDF_RelocationTable.hxx>
27 #include <TDF_TagSource.hxx>
29 IMPLEMENT_STANDARD_RTTIEXT(TDataStd_NoteBook,TDF_Attribute)
31 //=======================================================================
34 //=======================================================================
35 Standard_Boolean TDataStd_NoteBook::Find (const TDF_Label& current,
36 Handle(TDataStd_NoteBook)& N)
38 TDF_Label L = current;
39 Handle(TDataStd_NoteBook) NB;
40 if (L.IsNull()) return Standard_False;
43 if(L.FindAttribute(TDataStd_NoteBook::GetID(), NB)) break;
45 if (L.IsNull()) break;
52 return Standard_False;
56 //=======================================================================
59 //=======================================================================
61 Handle(TDataStd_NoteBook) TDataStd_NoteBook::New (const TDF_Label& label)
63 if (label.HasAttribute()) {
64 throw Standard_DomainError("TDataStd_NoteBook::New : not an empty label");
66 Handle(TDataStd_NoteBook) NB = new TDataStd_NoteBook ();
67 label.AddAttribute(NB);
68 TDF_TagSource::Set(label); // distributeur de sous label
72 //=======================================================================
75 //=======================================================================
77 const Standard_GUID& TDataStd_NoteBook::GetID()
79 static Standard_GUID TDataStd_NoteBookID("2a96b609-ec8b-11d0-bee7-080009dc3333");
80 return TDataStd_NoteBookID;
84 //=======================================================================
85 //function : TDataStd_NoteBook
87 //=======================================================================
89 TDataStd_NoteBook::TDataStd_NoteBook()
94 //=======================================================================
95 //function : Append Real Variable
97 //=======================================================================
99 Handle(TDataStd_Real) TDataStd_NoteBook::Append(const Standard_Real value,
100 const Standard_Boolean )
102 TDF_Label newlabel = TDF_TagSource::NewChild (Label());
103 Handle(TDataStd_Real) variable = TDataStd_Real::Set ( newlabel, value);
107 //=======================================================================
108 //function : Append Integer Variable
110 //=======================================================================
112 Handle(TDataStd_Integer) TDataStd_NoteBook::Append(const Standard_Integer value,
113 const Standard_Boolean )
115 TDF_Label newlabel = TDF_TagSource::NewChild (Label());
116 Handle(TDataStd_Integer) variable = TDataStd_Integer::Set ( newlabel, value);
120 //=======================================================================
123 //=======================================================================
125 const Standard_GUID& TDataStd_NoteBook::ID() const
129 //=======================================================================
130 //function : NewEmpty
132 //=======================================================================
134 Handle(TDF_Attribute) TDataStd_NoteBook::NewEmpty () const
136 return new TDataStd_NoteBook();
139 //=======================================================================
142 //=======================================================================
144 void TDataStd_NoteBook::Restore(const Handle(TDF_Attribute)& )
148 //=======================================================================
151 //=======================================================================
153 void TDataStd_NoteBook::Paste (const Handle(TDF_Attribute)& ,
154 const Handle(TDF_RelocationTable)& ) const
158 //=======================================================================
161 //=======================================================================
163 Standard_OStream& TDataStd_NoteBook::Dump (Standard_OStream& anOS) const