1 // Created on: 1997-07-29
2 // Created by: Denis PASCAL
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <TDataStd_NoteBook.ixx>
24 #include <TDF_TagSource.hxx>
25 #include <TDataStd_Real.hxx>
26 #include <TDataStd_Integer.hxx>
27 #include <TDF_Label.hxx>
28 #include <Standard_DomainError.hxx>
30 //=======================================================================
33 //=======================================================================
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 Standard_DomainError::Raise("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