1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef _GEOM_Function_HeaderFile
24 #define _GEOM_Function_HeaderFile
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>
35 class Handle_TColStd_HArray1OfReal;
36 class Handle_TColStd_HArray1OfInteger;
37 class Handle_TColStd_HSequenceOfTransient;
39 DEFINE_STANDARD_HANDLE (GEOM_Function, Standard_Transient);
41 class GEOM_Function : public Standard_Transient
43 GEOM_Function(const TDF_Label& theEntry) { _label = theEntry; }
47 //Returns a GUID for a function tree
48 Standard_EXPORT static const Standard_GUID& GetFunctionTreeID();
50 //Returns the ID which is associated with a reference to another function
51 Standard_EXPORT static const Standard_GUID& GetDependencyID();
53 //Finds and returns a function located on a label theEntry
54 Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry);
57 Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
58 Standard_EXPORT ~GEOM_Function() {}
60 Standard_EXPORT TDF_Label GetOwnerEntry();
62 //Access to properties
64 //Returns a result of the function built by the function Driver
65 Standard_EXPORT TopoDS_Shape GetValue();
67 //Sets the function result
68 Standard_EXPORT void SetValue(TopoDS_Shape& theShape);
70 //Returns a function entry in the OCAF document
71 Standard_EXPORT TDF_Label& GetEntry() { return _label; }
73 //Returns the type of the function
74 Standard_EXPORT int GetType();
76 //Returns a function Driver GUID
77 Standard_EXPORT Standard_GUID GetDriverGUID();
79 //Returns aPython description of the function
80 Standard_EXPORT TCollection_AsciiString GetDescription();
82 //Sets aPython description of the function
83 Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription);
87 //Sets a real argument at position thePosition
88 Standard_EXPORT void SetReal(int thePosition, double theValue);
90 //Returns a real argument at position thePosition
91 Standard_EXPORT double GetReal(int thePosition);
93 //Sets a real array argument at position thePosition
94 Standard_EXPORT void SetRealArray(int thePosition, const Handle(TColStd_HArray1OfReal)& theArray);
96 //Returns a real array argument at position thePosition
97 Standard_EXPORT Handle(TColStd_HArray1OfReal) GetRealArray(int thePosition);
99 //Sets an integer argument at position thePosition
100 Standard_EXPORT void SetInteger(int thePosition, int theValue);
102 //Returns an integer argument at position thePosition
103 Standard_EXPORT int GetInteger(int thePosition);
105 //Sets an integer array argument at position thePosition
106 Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray);
108 //Returns an integer array argument at position thePosition
109 Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntegerArray(int thePosition);
111 //Sets a reference to other function argument at position thePosition
112 Standard_EXPORT void SetReference(int thePosition, Handle(GEOM_Function) theReference);
114 //Sets a string argument at position thePosition
115 Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue);
117 //Returns a string argument at position thePosition
118 Standard_EXPORT TCollection_AsciiString GetString(int thePosition);
120 //Returns a reference to other function argument at position thePosition
121 Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition);
123 //Set an array of ExtendedString
124 Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray);
126 //Returns the array of ExtendedString
127 Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition);
129 //Returns true if data of given type already exists
130 Standard_EXPORT bool HasData(int thePosition, const Standard_GUID& dataID);
132 //Returns a GUID for a references tree
133 Standard_EXPORT static const Standard_GUID& GetReferencesTreeID();
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);
139 //Returns a list of references to other function arguments at position thePosition
140 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
142 //Sets a TopoDS_Shape argument at position thePosition
143 //void SetShape(int thePosition, const TopoDS_Shape& theShape);
145 //Returns a TopoDS_Shape argument at position thePosition
146 //TopoDS_Shape GetShape(int thePosition);
148 //Returns true if the last method succided
149 Standard_EXPORT bool IsDone() { return _isDone; }
151 //Retuns true if this function is the last one in the study
152 Standard_EXPORT bool IsLastFuntion();
154 //Returns a sequence of the external dependencies of this function
155 Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq);
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();
163 //Returns top label of this function's history tree
164 Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
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);
171 //Returns top label of this function's naming tree
172 Standard_EXPORT TDF_Label GetNamingEntry (const Standard_Boolean create = Standard_True);
174 DEFINE_STANDARD_RTTI (GEOM_Function);