Salome HOME
ILMAB project. DS for the Field on Geometry implemented
[modules/geom.git] / src / GEOM / GEOM_Function.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef _GEOM_Function_HeaderFile
24 #define _GEOM_Function_HeaderFile
25
26 #include <Standard_Transient.hxx>
27 #include <Standard_GUID.hxx>
28 #include <TColStd_HArray1OfExtendedString.hxx>
29 #include <TCollection_AsciiString.hxx>
30 #include <TDF_Label.hxx>
31 #include <TDF_LabelSequence.hxx>
32 #include <TDataStd_ListOfExtendedString.hxx>
33 #include <TopoDS_Shape.hxx>
34
35 class Handle_TColStd_HArray1OfReal;
36 class Handle_TColStd_HArray1OfInteger;
37 class Handle_TColStd_HSequenceOfTransient;
38 class GEOM_Function;
39 DEFINE_STANDARD_HANDLE (GEOM_Function, Standard_Transient);
40
41 class GEOM_Function : public Standard_Transient
42 {
43   GEOM_Function(const TDF_Label& theEntry) { _label = theEntry; }
44
45 public:
46
47   //Returns a GUID for a function tree
48   Standard_EXPORT static const Standard_GUID& GetFunctionTreeID();
49
50   //Returns the ID which is associated with a reference to another function
51   Standard_EXPORT static const Standard_GUID& GetDependencyID();
52
53   //Finds and returns a function located on a label theEntry
54   Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry);
55
56
57   Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
58   Standard_EXPORT ~GEOM_Function() {}
59
60   Standard_EXPORT TDF_Label GetOwnerEntry();
61
62   //Access to properties
63
64   //Returns a result of the function built by the function Driver
65   Standard_EXPORT TopoDS_Shape GetValue();
66
67   //Sets the function result
68   Standard_EXPORT void SetValue(TopoDS_Shape& theShape);
69
70   //Returns a function entry in the OCAF document
71   Standard_EXPORT TDF_Label& GetEntry() { return _label; }
72
73   //Returns the type of the function
74   Standard_EXPORT int GetType();
75
76   //Returns a function Driver GUID
77   Standard_EXPORT Standard_GUID GetDriverGUID();
78
79   //Returns aPython description of the function
80   Standard_EXPORT TCollection_AsciiString GetDescription();
81
82   //Sets aPython description of the function
83   Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription);
84
85   //Access to arguments
86
87   //Sets a real argument at position thePosition
88   Standard_EXPORT void SetReal(int thePosition, double theValue);
89
90   //Returns a real argument at position thePosition
91   Standard_EXPORT double GetReal(int thePosition);
92
93   //Sets a real array argument at position thePosition
94   Standard_EXPORT void SetRealArray(int thePosition, const Handle(TColStd_HArray1OfReal)& theArray);
95
96   //Returns a real array argument at position thePosition
97   Standard_EXPORT Handle(TColStd_HArray1OfReal) GetRealArray(int thePosition);
98
99   //Sets an integer argument at position thePosition
100   Standard_EXPORT void SetInteger(int thePosition, int theValue);
101
102   //Returns an integer argument at position thePosition
103   Standard_EXPORT int GetInteger(int thePosition);
104
105   //Sets an integer array argument at position thePosition
106   Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray);
107
108   //Returns an integer array argument at position thePosition
109   Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntegerArray(int thePosition);
110
111   //Sets a reference to other function argument at position thePosition
112   Standard_EXPORT void SetReference(int thePosition, Handle(GEOM_Function) theReference);
113
114   //Sets a string argument at position thePosition
115   Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue);
116
117   //Returns a string argument at position thePosition
118   Standard_EXPORT TCollection_AsciiString GetString(int thePosition);
119
120   //Returns a reference to other function argument at position thePosition
121   Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition);
122
123   //Set an array of ExtendedString
124   Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray);
125
126   //Returns the array of ExtendedString
127   Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition);
128
129   //Returns true if data of given type already exists
130   Standard_EXPORT bool HasData(int thePosition, const Standard_GUID& dataID);
131
132   //Returns a GUID for a references tree
133   Standard_EXPORT static const Standard_GUID& GetReferencesTreeID();
134
135   //Sets a list of references to other function arguments at position thePosition
136   Standard_EXPORT void SetReferenceList (int thePosition,
137                          const Handle(TColStd_HSequenceOfTransient)& theRefList);
138
139   //Returns a list of references to other function arguments at position thePosition
140   Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
141
142   //Sets a TopoDS_Shape argument at position thePosition
143   //void SetShape(int thePosition, const TopoDS_Shape& theShape);
144
145   //Returns a TopoDS_Shape argument at position thePosition
146   //TopoDS_Shape GetShape(int thePosition);
147
148   //Returns true if the last method succided
149   Standard_EXPORT bool IsDone() { return _isDone; }
150
151   //Retuns true if this function is the last one in the study
152   Standard_EXPORT bool IsLastFuntion();
153
154   //Returns a sequence of the external dependencies of this function
155   Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq);
156
157   // Add/Remove/Check/Get subshape references
158   Standard_EXPORT void AddSubShapeReference   (Handle(GEOM_Function) theSubShape);
159   Standard_EXPORT void RemoveSubShapeReference(Handle(GEOM_Function) theSubShape);
160   Standard_EXPORT bool HasSubShapeReferences();
161   Standard_EXPORT const TDataStd_ListOfExtendedString& GetSubShapeReferences();
162
163   //Returns top label of this function's history tree
164   Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
165
166   //Returns history label, corresponding to the label,
167   //on which a reference on argument is stored
168   Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label&       theArgumentRefEntry,
169                                                      const Standard_Boolean create = Standard_True);
170
171   //Returns top label of this function's naming tree
172   Standard_EXPORT TDF_Label GetNamingEntry (const Standard_Boolean create = Standard_True);
173
174   DEFINE_STANDARD_RTTI (GEOM_Function);
175
176   private:
177
178   TDF_Label _label;
179   bool      _isDone;
180 };
181
182 #endif