X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM%2FGEOM_Function.hxx;h=2bf2f6d656529619fa4d266846d4515c8859a0c4;hb=14e1a694c4cf249fe205a39c099482bc5b28a6e5;hp=4eb5b760eb6db231ee7732a6d1ade2b28c743576;hpb=a62a321c849518376e3aa4d24a0b902a24167c64;p=modules%2Fgeom.git diff --git a/src/GEOM/GEOM_Function.hxx b/src/GEOM/GEOM_Function.hxx index 4eb5b760e..2bf2f6d65 100644 --- a/src/GEOM/GEOM_Function.hxx +++ b/src/GEOM/GEOM_Function.hxx @@ -1,169 +1,66 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef _GEOM_Function_HeaderFile #define _GEOM_Function_HeaderFile -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Handle_MMgt_TShared_HeaderFile -#include -#endif -#ifndef _MMgt_TShared_HeaderFile -#include -#endif -#ifndef _Standard_GUID_HeaderFile +#include #include -#endif -#ifndef _TopoDS_Shape_HeaderFile -#include -#endif -#ifndef _TDF_Label_HeaderFile +#include +#include +#include +#include +#include +#include #include -#endif -#ifndef _TDF_LabelSequence_HeaderFile #include -#endif -#ifndef _TColStd_HArray1OfExtendedString_HeaderFile -#include -#endif - -class Handle_TColStd_HArray1OfReal; -class Handle_TColStd_HArray1OfInteger; -class Handle_TColStd_HSequenceOfTransient; -class Handle_TColStd_HArray1OfExtendedString; +#include +#include -class Standard_Transient; -class Handle_Standard_Type; -class Handle(MMgt_TShared); class GEOM_Function; +DEFINE_STANDARD_HANDLE (GEOM_Function, Standard_Transient) -#include - - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function); - -class Handle(GEOM_Function) : public Handle(MMgt_TShared) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOM_Function)():Handle(MMgt_TShared)() {} - Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle) - { - } - - Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem) - { - } - - Handle(GEOM_Function)& operator=(const Handle(GEOM_Function)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOM_Function)& operator=(const GEOM_Function* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOM_Function* operator->() - { - return (GEOM_Function *)ControlAccess(); - } - - GEOM_Function* operator->() const - { - return (GEOM_Function *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOM_Function)() {}; - - Standard_EXPORT static const Handle(GEOM_Function) DownCast(const Handle(Standard_Transient)& AnObject); -}; - -class GEOM_Function : public MMgt_TShared +class GEOM_Function : public Standard_Transient { - -public: - - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Function) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); } - - -private: GEOM_Function(const TDF_Label& theEntry) { _label = theEntry; } public: - //Returns a GUID for a function tree + //Returns a GUID for a function tree Standard_EXPORT static const Standard_GUID& GetFunctionTreeID(); - //Returns the ID which is associated with a reference to another function + //Returns the ID which is associated with a reference to another function Standard_EXPORT static const Standard_GUID& GetDependencyID(); //Finds and returns a function located on a label theEntry Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry); - Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType); - Standard_EXPORT ~GEOM_Function() {;} + Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType); + Standard_EXPORT ~GEOM_Function(); Standard_EXPORT TDF_Label GetOwnerEntry(); - //Access to properties + //Access to properties //Returns a result of the function built by the function Driver Standard_EXPORT TopoDS_Shape GetValue(); @@ -175,7 +72,7 @@ public: Standard_EXPORT TDF_Label& GetEntry() { return _label; } //Returns the type of the function - Standard_EXPORT int GetType(); + Standard_EXPORT int GetType(); //Returns a function Driver GUID Standard_EXPORT Standard_GUID GetDriverGUID(); @@ -183,8 +80,8 @@ public: //Returns aPython description of the function Standard_EXPORT TCollection_AsciiString GetDescription(); - //Sets aPython description of the function - Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription); + //Sets aPython description of the function + Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription); //Access to arguments @@ -204,14 +101,26 @@ public: Standard_EXPORT void SetInteger(int thePosition, int theValue); //Returns an integer argument at position thePosition - Standard_EXPORT int GetInteger(int thePosition); - + Standard_EXPORT int GetInteger(int thePosition); + //Sets an integer array argument at position thePosition Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray); //Returns an integer array argument at position thePosition Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetIntegerArray(int thePosition); + //Sets a byte array argument at position thePosition + Standard_EXPORT void SetByteArray(int thePosition, const Handle(TColStd_HArray1OfByte)& theArray); + + //Returns a byte array argument at position thePosition + Standard_EXPORT Handle(TColStd_HArray1OfByte) GetByteArray(int thePosition); + + //Sets a boolean array argument at position thePosition + Standard_EXPORT void SetBooleanArray(int thePosition, const Handle(TColStd_HArray1OfByte)& theArray); + + //Returns a boolean array argument at position thePosition + Standard_EXPORT Handle(TColStd_HArray1OfByte) GetBooleanArray(int thePosition); + //Sets a reference to other function argument at position thePosition Standard_EXPORT void SetReference(int thePosition, Handle(GEOM_Function) theReference); @@ -219,18 +128,21 @@ public: Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue); //Returns a string argument at position thePosition - Standard_EXPORT TCollection_AsciiString GetString(int thePosition); - + Standard_EXPORT TCollection_AsciiString GetString(int thePosition); + //Returns a reference to other function argument at position thePosition - Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition); + Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition); //Set an array of ExtendedString Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray); - + //Returns the array of ExtendedString Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition); - //Returns a GUID for a references tree + //Returns true if data of given type already exists + Standard_EXPORT bool HasData(int thePosition, const Standard_GUID& dataID); + + //Returns a GUID for a references tree Standard_EXPORT static const Standard_GUID& GetReferencesTreeID(); //Sets a list of references to other function arguments at position thePosition @@ -238,33 +150,58 @@ public: const Handle(TColStd_HSequenceOfTransient)& theRefList); //Returns a list of references to other function arguments at position thePosition - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition); + + // Save a pointer to a data holder intended to pass data Driver -> Operation. + // This method should be called by Operation to set the data holder. + // An instance of GEOM_Function that sets the data holder will remove the + // corresponding OCAF attribute at it's destruction + Standard_EXPORT void SetCallBackData( void* data ); + + // Returns a pointer to a data holder intended to pass data Driver -> Operation. + // This method should be called by Driver to get the data holder to fill it in. + // Returns NULL if the Operation have not set the data holder. + Standard_EXPORT void* GetCallBackData(); //Sets a TopoDS_Shape argument at position thePosition //void SetShape(int thePosition, const TopoDS_Shape& theShape); - + //Returns a TopoDS_Shape argument at position thePosition - //TopoDS_Shape GetShape(int thePosition); - - //Returns true if the last method succided + //TopoDS_Shape GetShape(int thePosition); + + //Returns true if the last method succided Standard_EXPORT bool IsDone() { return _isDone; } + //Returns true if this function is the last one in the study + Standard_EXPORT bool IsLastFuntion(); + //Returns a sequence of the external dependencies of this function Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq); + // Add/Remove/Check/Get subshape references + Standard_EXPORT void AddSubShapeReference (Handle(GEOM_Function) theSubShape); + Standard_EXPORT void RemoveSubShapeReference(Handle(GEOM_Function) theSubShape); + Standard_EXPORT bool HasSubShapeReferences(); + Standard_EXPORT const TDataStd_ListOfExtendedString& GetSubShapeReferences(); + //Returns top label of this function's history tree Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True); //Returns history label, corresponding to the label, //on which a reference on argument is stored Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry, - const Standard_Boolean create = Standard_True); + const Standard_Boolean create = Standard_True); + + //Returns top label of this function's naming tree + Standard_EXPORT TDF_Label GetNamingEntry (const Standard_Boolean create = Standard_True); + + DEFINE_STANDARD_RTTIEXT(GEOM_Function,Standard_Transient) -private: + private: - - TDF_Label _label; - bool _isDone; + TDF_Label _label; + bool _isDone; + bool _isCallBackData; }; #endif