PageRenderTime 39ms CodeModel.GetById 27ms app.highlight 10ms RepoModel.GetById 0ms app.codeStats 0ms

/opencascade-6.5.1/ros/inc/TDF_Label.hxx

https://github.com/jehc/MondocosmOS
C++ Header | 294 lines | 116 code | 33 blank | 145 comment | 1 complexity | 2338397c25b60d1f860991d90d6b42da MD5 | raw file
  1// This file is generated by WOK (CPPExt).
  2// Please do not edit this file; modify original file instead.
  3// The copyright and license terms as defined for the original file apply to 
  4// this header file considered to be the "object code" form of the original source.
  5
  6#ifndef _TDF_Label_HeaderFile
  7#define _TDF_Label_HeaderFile
  8
  9#ifndef _Standard_HeaderFile
 10#include <Standard.hxx>
 11#endif
 12#ifndef _Standard_Macro_HeaderFile
 13#include <Standard_Macro.hxx>
 14#endif
 15
 16#ifndef _TDF_LabelNodePtr_HeaderFile
 17#include <TDF_LabelNodePtr.hxx>
 18#endif
 19#ifndef _Handle_TDF_Data_HeaderFile
 20#include <Handle_TDF_Data.hxx>
 21#endif
 22#ifndef _Standard_Integer_HeaderFile
 23#include <Standard_Integer.hxx>
 24#endif
 25#ifndef _Standard_Boolean_HeaderFile
 26#include <Standard_Boolean.hxx>
 27#endif
 28#ifndef _Handle_TDF_Attribute_HeaderFile
 29#include <Handle_TDF_Attribute.hxx>
 30#endif
 31#ifndef _Standard_OStream_HeaderFile
 32#include <Standard_OStream.hxx>
 33#endif
 34class Standard_DomainError;
 35class Standard_OutOfRange;
 36class Standard_NullObject;
 37class TDF_ChildIterator;
 38class TDF_Attribute;
 39class TDF_AttributeIterator;
 40class TDF_Data;
 41class TDF_LabelMapHasher;
 42class Standard_GUID;
 43class TDF_IDFilter;
 44class TDF_AttributeIndexedMap;
 45
 46
 47//! This class provides basic operations  to define <br>
 48//! a label in a data structure. <br>
 49//! A label is a feature in the feature hierarchy. A <br>
 50//!          label is always connected to a Data from TDF. <br>
 51//! To a label is attached attributes containing the <br>
 52//!          software components information. <br>
 53//! <br>
 54//!          Label information: <br>
 55//! <br>
 56//!          It is possible to know the tag, the father, the <br>
 57//!          depth in the tree of the label, if the label is <br>
 58//!          root, null or equal to another label. <br>
 59//! <br>
 60//!          Comfort methods: <br>
 61//!          Some methods useful on a label. <br>
 62//! <br>
 63//!          Attributes: <br>
 64//! <br>
 65//!          It is possible to get an attribute in accordance <br>
 66//!          to an ID, or the yougest previous version of a <br>
 67//!          current attribute. <br>
 68class TDF_Label  {
 69public:
 70
 71  void* operator new(size_t,void* anAddress) 
 72  {
 73    return anAddress;
 74  }
 75  void* operator new(size_t size) 
 76  {
 77    return Standard::Allocate(size); 
 78  }
 79  void  operator delete(void *anAddress) 
 80  {
 81    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
 82  }
 83
 84  //! Constructs an empty label object. <br>
 85  Standard_EXPORT   TDF_Label();
 86  //! Nullifies the label. <br>
 87//! <br>
 88        void Nullify() ;
 89  //! Returns the Data owning <me>. <br>
 90//! <br>
 91        Handle_TDF_Data Data() const;
 92  //! Returns the tag of the label. <br>
 93//! This is the integer assigned randomly to a label <br>
 94//!  in a data framework. This integer is used to <br>
 95//! identify this label in an entry. <br>
 96//! <br>
 97        Standard_Integer Tag() const;
 98  //! Returns the label father. This label may be null <br>
 99//!          if the label is root. <br>
100//! <br>
101       const TDF_Label Father() const;
102  //! Returns True if the <aLabel> is null, i.e. it has <br>
103//!          not been included in the data framework. <br>
104//! <br>
105        Standard_Boolean IsNull() const;
106  //! Sets or unsets <me> and all its descendants as <br>
107//!          imported label, according to <aStatus>. <br>
108  Standard_EXPORT     void Imported(const Standard_Boolean aStatus) const;
109  //! Returns True if the <aLabel> is imported. <br>
110//! <br>
111        Standard_Boolean IsImported() const;
112  //! Returns True if the <aLabel> is equal to me (same <br>
113//!           LabelNode*). <br>
114        Standard_Boolean IsEqual(const TDF_Label& aLabel) const;
115      Standard_Boolean operator ==(const TDF_Label& aLabel) const
116{
117  return IsEqual(aLabel);
118}
119  
120        Standard_Boolean IsDifferent(const TDF_Label& aLabel) const;
121      Standard_Boolean operator !=(const TDF_Label& aLabel) const
122{
123  return IsDifferent(aLabel);
124}
125  
126        Standard_Boolean IsRoot() const;
127  //! Returns true if <me> owns an attribute with <anID> as ID. <br>
128  Standard_EXPORT     Standard_Boolean IsAttribute(const Standard_GUID& anID) const;
129  //! Adds an Attribute  to the current label. Raises if <br>
130//!          there is already one. <br>
131  Standard_EXPORT     void AddAttribute(const Handle(TDF_Attribute)& anAttribute) const;
132  //!  Forgets an  Attribute   from the  current  label, <br>
133//!          setting its   forgotten status true and  its valid <br>
134//!           status false. Raises if   the attribute is not in <br>
135//!          the structure. <br>
136  Standard_EXPORT     void ForgetAttribute(const Handle(TDF_Attribute)& anAttribute) const;
137  //! Forgets the  Attribute of  GUID <aguid> from   the <br>
138//!          current label   . If the   attribute doesn't exist <br>
139//!          returns False. Otherwise returns True. <br>
140  Standard_EXPORT     Standard_Boolean ForgetAttribute(const Standard_GUID& aguid) const;
141  //! Forgets all the attributes. Does it on also on the <br>
142//!          sub-labels if <clearChildren> is set to true. Of <br>
143//!          course, this method is compatible with Transaction <br>
144//!          & Delta mecanisms. <br>
145  Standard_EXPORT     void ForgetAllAttributes(const Standard_Boolean clearChildren = Standard_True) const;
146  //! Undo Forget action, setting its forgotten status <br>
147//!          false and its valid status true. Raises if the <br>
148//!          attribute is not in the structure. <br>
149  Standard_EXPORT     void ResumeAttribute(const Handle(TDF_Attribute)& anAttribute) const;
150  //! Finds an attribute of the current label, according <br>
151//!          to <anID>. <br>
152//! If anAttribute is not a valid one, false is returned. <br>
153//! <br>
154//!        The method returns True if found, False otherwise. <br>
155//! <br>
156//!          A removed attribute cannot be found. <br>
157  Standard_EXPORT     Standard_Boolean FindAttribute(const Standard_GUID& anID,Handle(TDF_Attribute)& anAttribute) const;
158  //! Finds an attribute of the current label, according <br>
159//!          to <anID> and <aTransaction>. This attribute <br>
160//!          has/had to be a valid one for the given <br>
161//!          transaction index . So, this attribute is not <br>
162//!          necessary a valid one. <br>
163//! <br>
164//!          The method returns True if found, False otherwise. <br>
165//! <br>
166//!          A removed attribute cannot be found nor a backuped <br>
167//!          attribute of a removed one. <br>
168  Standard_EXPORT     Standard_Boolean FindAttribute(const Standard_GUID& anID,const Standard_Integer aTransaction,Handle(TDF_Attribute)& anAttribute) const;
169  //! Returns true if <me> or a DESCENDANT of <me> owns <br>
170//!          attributes not yet available in transaction 0. It <br>
171//!          means at least one of their attributes is new, <br>
172//!          modified or deleted. <br>
173//! <br>
174        Standard_Boolean MayBeModified() const;
175  //! Returns true if <me> owns attributes not yet <br>
176//!          available in transaction 0. It means at least one <br>
177//!          attribute is new, modified or deleted. <br>
178//! <br>
179        Standard_Boolean AttributesModified() const;
180  //! Returns true if this label has at least one attribute. <br>
181  Standard_EXPORT     Standard_Boolean HasAttribute() const;
182  //! Returns the number of attributes. <br>
183  Standard_EXPORT     Standard_Integer NbAttributes() const;
184  //! Returns the depth of the label in the data framework. <br>
185//! This corresponds to the number of fathers which <br>
186//! this label has, and is used in determining <br>
187//! whether a label is root, null or equivalent to another label. <br>
188//! Exceptions: <br>
189//! Standard_NullObject if this label is null. This is <br>
190//! because a null object can have no depth. <br>
191  Standard_EXPORT     Standard_Integer Depth() const;
192  //! Returns True if <me> is a descendant of <br>
193//!          <aLabel>. Attention: every label is its own <br>
194//!          descendant. <br>
195  Standard_EXPORT     Standard_Boolean IsDescendant(const TDF_Label& aLabel) const;
196  //! Returns the root label Root of the data structure. <br>
197//! This has a depth of 0. <br>
198//! Exceptions: <br>
199//! Standard_NullObject if this label is null. This is <br>
200//! because a null object can have no depth. <br>
201  Standard_EXPORT    const TDF_Label Root() const;
202  //! Returns true if this label has at least one child. <br>
203        Standard_Boolean HasChild() const;
204  //! Returns the number of children. <br>
205  Standard_EXPORT     Standard_Integer NbChildren() const;
206  //! Finds a child label having <aTag> as tag. Creates <br>
207//! The tag aTag identifies the label which will be the parent. <br>
208//! If create is true and no child label is found, a new one is created. <br>
209//! Example: <br>
210//! //creating a label with tag 10 at Root <br>
211//! TDF_Label lab1 = aDF->Root().FindChild(10); <br>
212//! //creating labels 7 and 2 on label 10 <br>
213//! TDF_Label lab2 = lab1.FindChild(7); <br>
214//! TDF_Label lab3 = lab1.FindChild(2); <br>
215  Standard_EXPORT     TDF_Label FindChild(const Standard_Integer aTag,const Standard_Boolean create = Standard_True) const;
216  //! Create  a new child   label of me  using autoamtic <br>
217//!          delivery tags provided by TagSource. <br>
218        TDF_Label NewChild() const;
219  //! Returns the current transaction index. <br>
220  Standard_EXPORT     Standard_Integer Transaction() const;
221  //! Returns true if node address of <me> is lower than <br>
222//!          <otherLabel> one. Used to quickly sort labels (not <br>
223//!          on entry criterion). <br>
224//! <br>
225//! -C++: inline <br>
226  Standard_EXPORT     Standard_Boolean HasLowerNode(const TDF_Label& otherLabel) const;
227  //! Returns true if node address of <me> is greater <br>
228//!          than <otherLabel> one. Used to quickly sort labels <br>
229//!          (not on entry criterion). <br>
230//! <br>
231//! -C++: inline <br>
232  Standard_EXPORT     Standard_Boolean HasGreaterNode(const TDF_Label& otherLabel) const;
233  //! Dumps the minimum information about <me> on <br>
234//!          <aStream>. <br>
235//! <br>
236  Standard_EXPORT     Standard_OStream& Dump(Standard_OStream& anOS) const;
237    Standard_OStream& operator<<(Standard_OStream& anOS) const
238{
239  return Dump(anOS);
240}
241  //! Dumps the label on <aStream> and its attributes <br>
242//!          rank in <aMap> if their IDs are kept by <IDFilter>. <br>
243  Standard_EXPORT     void ExtendedDump(Standard_OStream& anOS,const TDF_IDFilter& aFilter,TDF_AttributeIndexedMap& aMap) const;
244  //! Dumps the label entry. <br>
245  Standard_EXPORT     void EntryDump(Standard_OStream& anOS) const;
246
247
248friend class TDF_ChildIterator;
249friend class TDF_Attribute;
250friend class TDF_AttributeIterator;
251friend class TDF_Data;
252friend class TDF_LabelMapHasher;
253
254
255
256protected:
257
258
259
260
261
262private:
263
264  //! Reserved to the friends. <br>
265  Standard_EXPORT   TDF_Label(const TDF_LabelNodePtr& aNode);
266  //! Adds an Attribute to <toNode>. Raises if there is <br>
267//!          already one. <br>
268  Standard_EXPORT     void AddToNode(const TDF_LabelNodePtr& toNode,const Handle(TDF_Attribute)& anAttribute) const;
269  //! Forgets an Attribute from <fromNode>.  Raises if <br>
270//!          the attribute is not in the structure. <br>
271  Standard_EXPORT     void ForgetFromNode(const TDF_LabelNodePtr& fromNode,const Handle(TDF_Attribute)& anAttribute) const;
272  //! Resumes a forgotten Attribute to <toNode>.  Raises <br>
273//!          if the attribute is not in the structure. <br>
274  Standard_EXPORT     void ResumeToNode(const TDF_LabelNodePtr& fromNode,const Handle(TDF_Attribute)& anAttribute) const;
275  
276  Standard_EXPORT     TDF_LabelNodePtr FindOrAddChild(const Standard_Integer aTag,const Standard_Boolean create) const;
277  
278  Standard_EXPORT     void InternalDump(Standard_OStream& anOS,const TDF_IDFilter& aFilter,TDF_AttributeIndexedMap& aMap,const Standard_Boolean extended) const;
279
280
281TDF_LabelNodePtr myLabelNode;
282
283
284};
285
286
287#include <TDF_Label.lxx>
288
289
290
291// other Inline functions and methods (like "C++: function call" methods)
292
293
294#endif