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