Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GEOM_Function.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 <TColStd_HArray1OfByte.hxx>
30 #include <TColStd_HArray1OfReal.hxx>
31 #include <TColStd_HArray1OfInteger.hxx>
32 #include <TColStd_HSequenceOfTransient.hxx>
33 #include <TCollection_AsciiString.hxx>
34 #include <TDF_Label.hxx>
35 #include <TDF_LabelSequence.hxx>
36 #include <TDataStd_ListOfExtendedString.hxx>
37 #include <TopoDS_Shape.hxx>
38 
39 #include <Basics_OCCTVersion.hxx>
40 
41 class GEOM_Function;
43 
45 {
46  GEOM_Function(const TDF_Label& theEntry) { _label = theEntry; }
47 
48 public:
49 
50  //Returns a GUID for a function tree
51  Standard_EXPORT static const Standard_GUID& GetFunctionTreeID();
52 
53  //Returns the ID which is associated with a reference to another function
54  Standard_EXPORT static const Standard_GUID& GetDependencyID();
55 
56  //Finds and returns a function located on a label theEntry
57  Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry);
58 
59 
60  Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
61  Standard_EXPORT ~GEOM_Function();
62 
63  Standard_EXPORT TDF_Label GetOwnerEntry();
64 
65  //Access to properties
66 
67  //Returns a result of the function built by the function Driver
68  Standard_EXPORT TopoDS_Shape GetValue();
69 
70  //Sets the function result
71  Standard_EXPORT void SetValue(TopoDS_Shape& theShape);
72 
73  //Returns a function entry in the OCAF document
74  Standard_EXPORT TDF_Label& GetEntry() { return _label; }
75 
76  //Returns the type of the function
77  Standard_EXPORT int GetType();
78 
79  //Returns a function Driver GUID
80  Standard_EXPORT Standard_GUID GetDriverGUID();
81 
82  //Returns aPython description of the function
83  Standard_EXPORT TCollection_AsciiString GetDescription();
84 
85  //Sets aPython description of the function
86  Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription);
87 
88  //Access to arguments
89 
90  //Sets a real argument at position thePosition
91  Standard_EXPORT void SetReal(int thePosition, double theValue);
92 
93  //Returns a real argument at position thePosition
94  Standard_EXPORT double GetReal(int thePosition);
95 
96  //Sets a real array argument at position thePosition
97  Standard_EXPORT void SetRealArray(int thePosition, const Handle(TColStd_HArray1OfReal)& theArray);
98 
99  //Returns a real array argument at position thePosition
100  Standard_EXPORT Handle(TColStd_HArray1OfReal) GetRealArray(int thePosition);
101 
102  //Sets an integer argument at position thePosition
103  Standard_EXPORT void SetInteger(int thePosition, int theValue);
104 
105  //Returns an integer argument at position thePosition
106  Standard_EXPORT int GetInteger(int thePosition);
107 
108  //Sets an integer array argument at position thePosition
109  Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray);
110 
111  //Returns an integer array argument at position thePosition
112  Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntegerArray(int thePosition);
113 
114  //Sets a byte array argument at position thePosition
115  Standard_EXPORT void SetByteArray(int thePosition, const Handle(TColStd_HArray1OfByte)& theArray);
116 
117  //Returns a byte array argument at position thePosition
118  Standard_EXPORT Handle(TColStd_HArray1OfByte) GetByteArray(int thePosition);
119 
120  //Sets a boolean array argument at position thePosition
121  Standard_EXPORT void SetBooleanArray(int thePosition, const Handle(TColStd_HArray1OfByte)& theArray);
122 
123  //Returns a boolean array argument at position thePosition
124  Standard_EXPORT Handle(TColStd_HArray1OfByte) GetBooleanArray(int thePosition);
125 
126  //Sets a reference to other function argument at position thePosition
127  Standard_EXPORT void SetReference(int thePosition, Handle(GEOM_Function) theReference);
128 
129  //Sets a string argument at position thePosition
130  Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue);
131 
132  //Returns a string argument at position thePosition
133  Standard_EXPORT TCollection_AsciiString GetString(int thePosition);
134 
135  //Returns a reference to other function argument at position thePosition
136  Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition);
137 
138  //Set an array of ExtendedString
139  Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray);
140 
141  //Returns the array of ExtendedString
142  Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition);
143 
144  //Returns true if data of given type already exists
145  Standard_EXPORT bool HasData(int thePosition, const Standard_GUID& dataID);
146 
147  //Returns a GUID for a references tree
148  Standard_EXPORT static const Standard_GUID& GetReferencesTreeID();
149 
150  //Sets a list of references to other function arguments at position thePosition
151  Standard_EXPORT void SetReferenceList (int thePosition,
152  const Handle(TColStd_HSequenceOfTransient)& theRefList);
153 
154  //Returns a list of references to other function arguments at position thePosition
155  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
156 
157  // Save a pointer to a data holder intended to pass data Driver -> Operation.
158  // This method should be called by Operation to set the data holder.
159  // An instance of GEOM_Function that sets the data holder will remove the
160  // corresponding OCAF attribute at it's destruction
161  Standard_EXPORT void SetCallBackData( void* data );
162 
163  // Returns a pointer to a data holder intended to pass data Driver -> Operation.
164  // This method should be called by Driver to get the data holder to fill it in.
165  // Returns NULL if the Operation have not set the data holder.
166  Standard_EXPORT void* GetCallBackData();
167 
168  //Sets a TopoDS_Shape argument at position thePosition
169  //void SetShape(int thePosition, const TopoDS_Shape& theShape);
170 
171  //Returns a TopoDS_Shape argument at position thePosition
172  //TopoDS_Shape GetShape(int thePosition);
173 
174  //Returns true if the last method succided
175  Standard_EXPORT bool IsDone() { return _isDone; }
176 
177  //Retuns true if this function is the last one in the study
178  Standard_EXPORT bool IsLastFuntion();
179 
180  //Returns a sequence of the external dependencies of this function
181  Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq);
182 
183  // Add/Remove/Check/Get subshape references
184  Standard_EXPORT void AddSubShapeReference (Handle(GEOM_Function) theSubShape);
185  Standard_EXPORT void RemoveSubShapeReference(Handle(GEOM_Function) theSubShape);
186  Standard_EXPORT bool HasSubShapeReferences();
187  Standard_EXPORT const TDataStd_ListOfExtendedString& GetSubShapeReferences();
188 
189  //Returns top label of this function's history tree
190  Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
191 
192  //Returns history label, corresponding to the label,
193  //on which a reference on argument is stored
194  Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
195  const Standard_Boolean create = Standard_True);
196 
197  //Returns top label of this function's naming tree
198  Standard_EXPORT TDF_Label GetNamingEntry (const Standard_Boolean create = Standard_True);
199 
201 
202  private:
203 
204  TDF_Label _label;
205  bool _isDone;
207 };
208 
209 #endif