1 #ifndef _GEOM_Object_HeaderFile
2 #define _GEOM_Object_HeaderFile
4 #ifndef _Standard_TypeMismatch_HeaderFile
5 #include <Standard_TypeMismatch.hxx>
7 #ifndef _Standard_HeaderFile
8 #include <Standard.hxx>
10 #ifndef _Standard_Macro_HeaderFile
11 #include <Standard_Macro.hxx>
13 #ifndef _Standard_HeaderFile
14 #include <Standard.hxx>
16 #ifndef _Handle_MMgt_TShared_HeaderFile
17 #include <Handle_MMgt_TShared.hxx>
19 #ifndef _MMgt_TShared_HeaderFile
20 #include <MMgt_TShared.hxx>
22 #ifndef _Standard_GUID_HeaderFile
23 #include <Standard_GUID.hxx>
25 #ifndef _TopoDS_Shape_HeaderFile
26 #include <TopoDS_Shape.hxx>
28 #ifndef _TDF_Label_HeaderFile
29 #include <TDF_Label.hxx>
31 #ifndef _TColStd_HSequenceOfTransient_HeaderFile
32 #include <TColStd_HSequenceOfTransient.hxx>
34 #ifndef _TCollection_AsciiString_HeaderFile
35 #include <TCollection_AsciiString.hxx>
38 class Handle_TColStd_HSequenceOfTransient;
39 class Standard_Transient;
40 class Handle_Standard_Type;
41 class Handle(MMgt_TShared);
45 Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Object);
47 class Handle(GEOM_Object) : public Handle(MMgt_TShared) {
49 inline void* operator new(size_t,void* anAddress)
53 inline void* operator new(size_t size)
55 return Standard::Allocate(size);
57 inline void operator delete(void *anAddress)
59 if (anAddress) Standard::Free((Standard_Address&)anAddress);
62 Handle(GEOM_Object)():Handle(MMgt_TShared)() {}
63 Handle(GEOM_Object)(const Handle(GEOM_Object)& aHandle) : Handle(MMgt_TShared)(aHandle)
67 Handle(GEOM_Object)(const GEOM_Object* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
71 Handle(GEOM_Object)& operator=(const Handle(GEOM_Object)& aHandle)
73 Assign(aHandle.Access());
77 Handle(GEOM_Object)& operator=(const GEOM_Object* anItem)
79 Assign((Standard_Transient *)anItem);
83 GEOM_Object* operator->()
85 return (GEOM_Object *)ControlAccess();
88 GEOM_Object* operator->() const
90 return (GEOM_Object *)ControlAccess();
93 Standard_EXPORT ~Handle(GEOM_Object)() {};
95 Standard_EXPORT static const Handle(GEOM_Object) DownCast(const Handle(Standard_Transient)& AnObject);
100 #include <Standard_GUID.hxx>
101 #include <TDataStd_TreeNode.hxx>
102 #include "GEOM_Function.hxx"
103 #include "GEOM_Engine.hxx"
106 class GEOM_Object : public MMgt_TShared
108 friend class GEOM_Engine;
111 inline void* operator new(size_t,void* anAddress)
115 inline void* operator new(size_t size)
117 return Standard::Allocate(size);
119 inline void operator delete(void *anAddress)
121 if (anAddress) Standard::Free((Standard_Address&)anAddress);
126 Standard_EXPORT friend Handle_Standard_Type& GEOM_Object_Type_();
127 Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Object) ; }
128 Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Object) == AType || MMgt_TShared::IsKind(AType)); }
131 GEOM_Object(TDF_Label& theLabel);
134 Standard_EXPORT GEOM_Object(TDF_Label& theEntry, int theType);
135 Standard_EXPORT ~GEOM_Object() {;}
137 //Finds a GEOM_Object on the label theLabel
138 Standard_EXPORT static Handle(GEOM_Object) GetObject(TDF_Label& theLabel);
140 //Finds a GEOM_Object by a reference, stored on the label theLabel
141 Standard_EXPORT static Handle(GEOM_Object) GetReferencedObject(TDF_Label& theLabel);
143 //Returns a GEOM_Object common GUID
144 Standard_EXPORT static const Standard_GUID& GetObjectID();
146 //Returns a GUID associated with a sub shape object
147 Standard_EXPORT static const Standard_GUID& GetSubShapeID();
149 //###########################################################
150 //Access to properties
151 //###########################################################
153 //Returns a TreeNode that presents a root of a function tree for this GEOM_Object
154 Standard_EXPORT Handle(TDataStd_TreeNode) GetRootNode() { return _root; }
156 //Returns a label of this GEOM_Object
157 Standard_EXPORT TDF_Label GetEntry() { return _label; }
159 //Returns a type of this GEOM_Object (GEOM_POINT, GEOM_VECTOR...)
160 Standard_EXPORT int GetType();
162 //Sets the type of this GEOM_Object
163 Standard_EXPORT void SetType(int theType);
165 //Returns an ID of the OCAF document where this GEOM_Object is stored
166 Standard_EXPORT int GetDocID();
168 //Returns a value (as TopoDS_Shape) of this GEOM_Object
169 Standard_EXPORT TopoDS_Shape GetValue();
171 //Sets a name of this GEOM_Object
172 Standard_EXPORT void SetName(const char* theName);
174 //Returns a name of this GEOM_Object
175 Standard_EXPORT char* GetName();
177 //Sets an auxiliary data
178 Standard_EXPORT void SetAuxData(const char* theData);
180 //Returns an auxiliary data
181 Standard_EXPORT TCollection_AsciiString GetAuxData();
183 //###########################################################
185 //###########################################################
187 //Returns false if the object is a sub shape of another object
188 Standard_EXPORT bool IsMainShape();
190 //###########################################################
191 // CORBA related methods
192 //###########################################################
194 //Sets an IOR of CORBA GEOM_Object_i which refers to this object
195 Standard_EXPORT void SetIOR(TCollection_AsciiString& theIOR) { _ior = theIOR; }
197 //Returns an IOR of CORBA GEOM_Object_i which refers to this object
198 Standard_EXPORT TCollection_AsciiString GetIOR() { return _ior; }
200 //###########################################################
202 //###########################################################
204 //Adds a function with a driver GUID = theGUID and a type theFunctionType to the function tree of this GEOM_Object
205 Standard_EXPORT Handle(GEOM_Function) AddFunction(const Standard_GUID& theGUID, int theFunctionType);
207 //Returns a number of functions of this GEOM_Object
208 Standard_EXPORT int GetNbFunctions();
210 //Returns a function with given number theFunctionNumber
211 Standard_EXPORT Handle(GEOM_Function) GetFunction(int theFunctionNumber);
213 //Return the last function of this GEOM_Object
214 Standard_EXPORT Handle(GEOM_Function) GetLastFunction();
216 //Returns all dependencies of the object
217 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetAllDependency();
219 //Returns the dependencies of the last function
220 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetLastDependency();
222 //###########################################################
224 //###########################################################
226 //Returns a label which could be used to store some additional data
227 Standard_EXPORT TDF_Label GetFreeLabel();
232 Handle(TDataStd_TreeNode) _root;
234 TCollection_AsciiString _ior;