0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / TFunction / TFunction_Function.hxx
1 // Created on: 1999-06-10
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _TFunction_Function_HeaderFile
18 #define _TFunction_Function_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_GUID.hxx>
24 #include <Standard_Integer.hxx>
25 #include <TDF_Attribute.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_OStream.hxx>
28 class TDF_Label;
29 class Standard_GUID;
30 class TDF_Attribute;
31 class TDF_RelocationTable;
32 class TDF_DataSet;
33
34
35 class TFunction_Function;
36 DEFINE_STANDARD_HANDLE(TFunction_Function, TDF_Attribute)
37
38 //! Provides the following two services
39 //! -   a link to an evaluation driver
40 //! -   the means of providing a link between a
41 //! function and an evaluation driver.
42 class TFunction_Function : public TDF_Attribute
43 {
44
45 public:
46
47   
48   //! Static methods:
49   //! ==============
50   //! Finds or Creates a function attribute on the label <L>.
51   //! Returns the function attribute.
52   Standard_EXPORT static Handle(TFunction_Function) Set (const TDF_Label& L);
53   
54   //! Finds or Creates a function attribute on the label <L>.
55   //! Sets a driver ID to the function.
56   //! Returns the function attribute.
57   Standard_EXPORT static Handle(TFunction_Function) Set (const TDF_Label& L, const Standard_GUID& DriverID);
58   
59   //! Returns the GUID for functions.
60   //! Returns a function found on the label.
61   //! Instance methods:
62   //! ================
63   Standard_EXPORT static const Standard_GUID& GetID();
64   
65   Standard_EXPORT TFunction_Function();
66
67   //! Returns the GUID for this function's driver.
68   const Standard_GUID& GetDriverGUID() const { return myDriverGUID; }
69
70   //! Sets the driver for this function as that
71   //! indentified by the GUID guid.
72   Standard_EXPORT void SetDriverGUID (const Standard_GUID& guid);
73
74   //! Returns true if the execution failed
75   Standard_Boolean Failed() const { return myFailure != 0; }
76
77   //! Sets the failed index.
78   Standard_EXPORT void SetFailure (const Standard_Integer mode = 0);
79
80   //! Returns an index of failure if the execution of this function failed.
81   //! If this integer value is 0, no failure has occurred.
82   //! Implementation of Attribute methods:
83   //! ===================================
84   Standard_Integer GetFailure() const { return myFailure; }
85
86   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
87   
88   Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
89   
90   Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
91   
92   Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
93   
94   Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& aDataSet) const Standard_OVERRIDE;
95   
96   Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
97
98   DEFINE_STANDARD_RTTIEXT(TFunction_Function,TDF_Attribute)
99
100 private:
101
102   Standard_GUID myDriverGUID;
103   Standard_Integer myFailure;
104
105 };
106
107 #endif // _TFunction_Function_HeaderFile