2 #ifndef _GEOM_Function_HeaderFile
3 #define _GEOM_Function_HeaderFile
5 #ifndef _Standard_TypeMismatch_HeaderFile
6 #include <Standard_TypeMismatch.hxx>
8 #ifndef _Standard_HeaderFile
9 #include <Standard.hxx>
11 #ifndef _Standard_Macro_HeaderFile
12 #include <Standard_Macro.hxx>
14 #ifndef _Handle_MMgt_TShared_HeaderFile
15 #include <Handle_MMgt_TShared.hxx>
17 #ifndef _MMgt_TShared_HeaderFile
18 #include <MMgt_TShared.hxx>
20 #ifndef _Standard_GUID_HeaderFile
21 #include <Standard_GUID.hxx>
23 #ifndef _TopoDS_Shape_HeaderFile
24 #include <TopoDS_Shape.hxx>
26 #ifndef _TDF_Label_HeaderFile
27 #include <TDF_Label.hxx>
29 #ifndef _TDF_LabelSequence_HeaderFile
30 #include <TDF_LabelSequence.hxx>
32 #ifndef _TColStd_HArray1OfExtendedString_HeaderFile
33 #include <TColStd_HArray1OfExtendedString.hxx>
36 class Handle_TColStd_HArray1OfReal;
37 class Handle_TColStd_HArray1OfInteger;
38 class Handle_TColStd_HSequenceOfTransient;
39 class Handle_TColStd_HArray1OfExtendedString;
41 class Standard_Transient;
42 class Handle_Standard_Type;
43 class Handle(MMgt_TShared);
46 #include <TCollection_AsciiString.hxx>
49 Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function);
51 class Handle(GEOM_Function) : public Handle(MMgt_TShared) {
53 inline void* operator new(size_t,void* anAddress)
57 inline void* operator new(size_t size)
59 return Standard::Allocate(size);
61 inline void operator delete(void *anAddress)
63 if (anAddress) Standard::Free((Standard_Address&)anAddress);
66 Handle(GEOM_Function)():Handle(MMgt_TShared)() {}
67 Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle)
71 Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
75 Handle(GEOM_Function)& operator=(const Handle(GEOM_Function)& aHandle)
77 Assign(aHandle.Access());
81 Handle(GEOM_Function)& operator=(const GEOM_Function* anItem)
83 Assign((Standard_Transient *)anItem);
87 GEOM_Function* operator->()
89 return (GEOM_Function *)ControlAccess();
92 GEOM_Function* operator->() const
94 return (GEOM_Function *)ControlAccess();
97 Standard_EXPORT ~Handle(GEOM_Function)() {};
99 Standard_EXPORT static const Handle(GEOM_Function) DownCast(const Handle(Standard_Transient)& AnObject);
102 class GEOM_Function : public MMgt_TShared
107 inline void* operator new(size_t,void* anAddress)
111 inline void* operator new(size_t size)
113 return Standard::Allocate(size);
115 inline void operator delete(void *anAddress)
117 if (anAddress) Standard::Free((Standard_Address&)anAddress);
122 Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_();
123 Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Function) ; }
124 Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); }
128 GEOM_Function(const TDF_Label& theEntry) { _label = theEntry; }
132 //Returns a GUID for a function tree
133 static const Standard_GUID& GetFunctionTreeID();
135 //Returns the ID which is associated with a reference to another function
136 static const Standard_GUID& GetDependencyID();
138 //Finds and returns a function located on a label theEntry
139 static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry);
142 GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
145 TDF_Label GetOwnerEntry();
147 //Access to properties
149 //Returns a result of the function built by the function Driver
150 TopoDS_Shape GetValue();
152 //Sets the function result
153 void SetValue(TopoDS_Shape& theShape);
155 //Returns a function entry in the OCAF document
156 TDF_Label& GetEntry() { return _label; }
158 //Returns the type of the function
161 //Returns a function Driver GUID
162 Standard_GUID GetDriverGUID();
164 //Returns aPython description of the function
165 TCollection_AsciiString GetDescription();
167 //Sets aPython description of the function
168 void SetDescription(TCollection_AsciiString& theDescription);
170 //Access to arguments
172 //Sets a real argument at position thePosition
173 void SetReal(int thePosition, double theValue);
175 //Returns a real argument at position thePosition
176 double GetReal(int thePosition);
178 //Sets a real array argument at position thePosition
179 void SetRealArray(int thePosition, const Handle(TColStd_HArray1OfReal)& theArray);
181 //Returns a real array argument at position thePosition
182 Handle(TColStd_HArray1OfReal) GetRealArray(int thePosition);
184 //Sets an integer argument at position thePosition
185 void SetInteger(int thePosition, int theValue);
187 //Returns an integer argument at position thePosition
188 int GetInteger(int thePosition);
190 //Sets an integer array argument at position thePosition
191 void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray);
193 //Returns an integer array argument at position thePosition
194 Handle(TColStd_HArray1OfInteger) GetIntegerArray(int thePosition);
196 //Sets a reference to other function argument at position thePosition
197 void SetReference(int thePosition, Handle(GEOM_Function) theReference);
199 //Sets a string argument at position thePosition
200 void SetString(int thePosition, const TCollection_AsciiString& theValue);
202 //Returns a string argument at position thePosition
203 TCollection_AsciiString GetString(int thePosition);
205 //Returns a reference to other function argument at position thePosition
206 Handle(GEOM_Function) GetReference(int thePosition);
208 //Set an array of ExtendedString
209 void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray);
211 //Returns the array of ExtendedString
212 Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition);
214 //Returns a GUID for a references tree
215 static const Standard_GUID& GetReferencesTreeID();
217 //Sets a list of references to other function arguments at position thePosition
218 void SetReferenceList (int thePosition,
219 const Handle(TColStd_HSequenceOfTransient)& theRefList);
221 //Returns a list of references to other function arguments at position thePosition
222 Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
224 //Sets a TopoDS_Shape argument at position thePosition
225 //void SetShape(int thePosition, const TopoDS_Shape& theShape);
227 //Returns a TopoDS_Shape argument at position thePosition
228 //TopoDS_Shape GetShape(int thePosition);
230 //Returns true if the last method succided
231 bool IsDone() { return _isDone; }
233 //Returns a sequence of the external dependencies of this function
234 void GetDependency(TDF_LabelSequence& theSeq);
236 //Returns top label of this function's history tree
237 TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
239 //Returns history label, corresponding to the label,
240 //on which a reference on argument is stored
241 TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
242 const Standard_Boolean create = Standard_True);