1 // Created on: 1993-01-22
2 // Created by: Gilles DEBARBOUILLE
3 // Copyright (c) 1993-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.
17 #include <Dynamic_Method.ixx>
18 #include <Dynamic_Variable.hxx>
19 #include <Dynamic_Parameter.hxx>
22 //=======================================================================
23 //function : Dynamic_Method
25 //=======================================================================
27 Dynamic_Method::Dynamic_Method()
31 //=======================================================================
32 //function : FirstVariableNode
34 //=======================================================================
36 Handle(Dynamic_VariableNode) Dynamic_Method::FirstVariableNode() const
38 return thefirstvariablenode;
41 //=======================================================================
44 //=======================================================================
46 Standard_Boolean Dynamic_Method::Variable(const Standard_CString avariable) const
48 Handle(Dynamic_Variable) variable;
49 Handle(Dynamic_VariableNode) definition = thefirstvariablenode;
51 while(!definition.IsNull())
53 variable = definition->Object();
54 if(variable->Parameter()->Name() == avariable) return Standard_True;
55 definition = definition->Next();
57 return Standard_False;
60 //=======================================================================
63 //=======================================================================
65 void Dynamic_Method::Variable(const Handle(Dynamic_Variable)& avariable)
67 Handle(Dynamic_VariableNode) variablenode = new Dynamic_VariableNode(avariable);
68 if(!thefirstvariablenode.IsNull()) variablenode->Next(thefirstvariablenode);
69 thefirstvariablenode = variablenode;
72 //=======================================================================
75 //=======================================================================
77 Standard_Boolean Dynamic_Method::Value(const Standard_CString aname,
78 Handle(Dynamic_Parameter)& aparameter,
79 Dynamic_ModeEnum& amode) const
81 Handle(Dynamic_Variable) variable;
83 if(Value(aname,variable))
85 amode = variable->Mode();
86 aparameter = variable->Parameter();
91 return Standard_False;
95 //=======================================================================
98 //=======================================================================
100 Standard_Boolean Dynamic_Method::Value(const Standard_CString aname,
101 Handle(Dynamic_Variable)& avariable) const
103 Handle(Dynamic_VariableNode) variablenode;
104 Handle(Dynamic_Variable) variable;
106 variablenode = thefirstvariablenode;
108 while(!variablenode.IsNull())
110 variable = variablenode->Object();
111 if(variable->Parameter()->Name() == aname)
113 avariable = variable;
114 return Standard_True;
116 variablenode = variablenode->Next();
119 return Standard_False;
122 //=======================================================================
125 //=======================================================================
127 void Dynamic_Method::Dump(Standard_OStream& astream) const
129 Handle(Dynamic_Variable) variable;
130 Handle(Dynamic_VariableNode) definition = thefirstvariablenode;
132 while(!definition.IsNull())
134 variable = definition->Object();
135 variable->Dump(astream);
136 astream<<" ; "<<endl;
137 definition = definition->Next();