1 // Created on: 1999-06-10
2 // Created by: Vladislav ROMASHKO
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Standard_DomainError.hxx>
19 #include <Standard_GUID.hxx>
20 #include <Standard_Type.hxx>
21 #include <TDF_Attribute.hxx>
22 #include <TDF_DataSet.hxx>
23 #include <TDF_Label.hxx>
24 #include <TDF_RelocationTable.hxx>
25 #include <TFunction_Function.hxx>
26 #include <TFunction_GraphNode.hxx>
27 #include <TFunction_Scope.hxx>
29 IMPLEMENT_STANDARD_RTTIEXT(TFunction_Function,TDF_Attribute)
31 //=======================================================================
33 //purpose : Static method to get an ID
34 //=======================================================================
35 const Standard_GUID& TFunction_Function::GetID()
37 static Standard_GUID TFunction_FunctionID("5b35ca00-5b78-11d1-8940-080009dc3333");
38 return TFunction_FunctionID;
42 //=======================================================================
44 //purpose : Finds or creates a function attribute
45 //=======================================================================
47 Handle(TFunction_Function) TFunction_Function::Set(const TDF_Label& L)
49 Handle(TFunction_Function) F;
50 if (!L.FindAttribute(TFunction_Function::GetID(), F)) {
51 F = new TFunction_Function();
57 //=======================================================================
59 //purpose : Finds or creates a function attribute and initializes
61 //=======================================================================
63 Handle(TFunction_Function) TFunction_Function::Set(const TDF_Label& L,
64 const Standard_GUID& DriverID)
66 Handle(TFunction_Function) F;
67 if (!L.FindAttribute(TFunction_Function::GetID(), F)) {
68 F = new TFunction_Function();
71 F->SetDriverGUID(DriverID);
75 //=======================================================================
77 //purpose : Returns GUID of the function
78 //=======================================================================
80 const Standard_GUID& TFunction_Function::ID() const
84 //=======================================================================
86 //purpose : Finds a function if it is on the label
87 //=======================================================================
89 // Standard_Boolean TFunction_Function::Find(const TDF_Label& L,
90 // Handle(TFunction_Function)& F)
92 // if (!L.FindAttribute(TFunction_Function::GetID(), F))
93 // return Standard_False;
94 // return Standard_True;
97 //=======================================================================
98 //function : TFunction_Function
99 //purpose : Constructor
100 //=======================================================================
102 TFunction_Function::TFunction_Function () : myFailure(0)
105 //=======================================================================
106 //function : SetDriverGUID
108 //=======================================================================
110 void TFunction_Function::SetDriverGUID(const Standard_GUID& guid)
112 // OCC2932 correction
113 if(myDriverGUID == guid) return;
119 //=======================================================================
120 //function : SetFailure
121 //purpose : Sets the failed status of the function
122 //=======================================================================
124 void TFunction_Function::SetFailure (const Standard_Integer mode)
126 // OCC2932 correction
127 if(myFailure == mode) return;
134 //=======================================================================
137 //=======================================================================
139 void TFunction_Function::Restore(const Handle(TDF_Attribute)& other)
141 Handle(TFunction_Function) F = Handle(TFunction_Function)::DownCast(other);
142 myFailure = F->myFailure;
143 myDriverGUID = F->myDriverGUID;
146 //=======================================================================
148 //purpose : Method for Copy mechanism
149 //=======================================================================
151 void TFunction_Function::Paste(const Handle(TDF_Attribute)& into,
152 const Handle(TDF_RelocationTable)& /*RT*/) const
154 Handle(TFunction_Function) intof = Handle(TFunction_Function)::DownCast(into);
155 intof->SetFailure(myFailure);
156 intof->SetDriverGUID(myDriverGUID);
159 //=======================================================================
160 //function : NewEmpty
161 //purpose : Returns new empty function attribute
162 //=======================================================================
164 Handle(TDF_Attribute) TFunction_Function::NewEmpty() const
166 return new TFunction_Function();
169 //=======================================================================
170 //function : References
171 //purpose : Collects the references
172 //=======================================================================
174 void TFunction_Function::References(const Handle(TDF_DataSet)& /*aDataSet*/) const
178 //=======================================================================
180 //purpose : Dump of the function
181 //=======================================================================
183 Standard_OStream& TFunction_Function::Dump (Standard_OStream& anOS) const
185 TDF_Attribute::Dump(anOS);