1 // Created on: 2008-01-21
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 2008-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _TFunction_IFunction_HeaderFile
17 #define _TFunction_IFunction_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <TDF_Label.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <TDF_LabelList.hxx>
26 #include <TFunction_ExecutionStatus.hxx>
27 #include <TFunction_DoubleMapOfIntegerLabel.hxx>
28 #include <Standard_Integer.hxx>
31 class TFunction_Logbook;
32 class TFunction_Driver;
33 class TFunction_GraphNode;
36 //! Interface class for usage of Function Mechanism
37 class TFunction_IFunction
44 //! Sets a new function attached to a label <L> with <ID>.
45 //! It creates a new TFunction_Function attribute initialized by the <ID>,
46 //! a new TFunction_GraphNode with an empty list of dependencies and
47 //! the status equal to TFunction_ES_WrongDefinition.
48 //! It registers the function in the scope of functions for this document.
49 Standard_EXPORT static Standard_Boolean NewFunction (const TDF_Label& L, const Standard_GUID& ID);
51 //! Deletes a function attached to a label <L>.
52 //! It deletes a TFunction_Function attribute and a TFunction_GraphNode.
53 //! It deletes the functions from the scope of function of this document.
54 Standard_EXPORT static Standard_Boolean DeleteFunction (const TDF_Label& L);
56 //! Updates dependencies for all functions of the scope.
57 //! It returns false in case of an error.
58 //! An empty constructor.
59 Standard_EXPORT static Standard_Boolean UpdateDependencies (const TDF_Label& Access);
61 Standard_EXPORT TFunction_IFunction();
64 //! Initializes the interface by the label of function.
65 Standard_EXPORT TFunction_IFunction(const TDF_Label& L);
67 //! Initializes the interface by the label of function.
68 Standard_EXPORT void Init (const TDF_Label& L);
70 //! Returns a label of the function.
71 Standard_EXPORT const TDF_Label& Label() const;
73 //! Updates the dependencies of this function only.
74 Standard_EXPORT Standard_Boolean UpdateDependencies() const;
76 //! The method fills-in the list by labels,
77 //! where the arguments of the function are located.
78 Standard_EXPORT void Arguments (TDF_LabelList& args) const;
80 //! The method fills-in the list by labels,
81 //! where the results of the function are located.
82 Standard_EXPORT void Results (TDF_LabelList& res) const;
84 //! Returns a list of previous functions.
85 Standard_EXPORT void GetPrevious (TDF_LabelList& prev) const;
87 //! Returns a list of next functions.
88 Standard_EXPORT void GetNext (TDF_LabelList& prev) const;
90 //! Returns the execution status of the function.
91 Standard_EXPORT TFunction_ExecutionStatus GetStatus() const;
93 //! Defines an execution status for a function.
94 Standard_EXPORT void SetStatus (const TFunction_ExecutionStatus status) const;
96 //! Returns the scope of all functions.
97 Standard_EXPORT const TFunction_DoubleMapOfIntegerLabel& GetAllFunctions() const;
99 //! Returns the Logbook - keeper of modifications.
100 Standard_EXPORT TFunction_Logbook& GetLogbook() const;
102 //! Returns a driver of the function.
103 Standard_EXPORT Handle(TFunction_Driver) GetDriver (const Standard_Integer thread = 0) const;
105 //! Returns a graph node of the function.
106 Standard_EXPORT Handle(TFunction_GraphNode) GetGraphNode() const;
132 #endif // _TFunction_IFunction_HeaderFile