0024509: Suspect unused variable in TPrsStd_ConstraintTools.cxx
[occt.git] / src / Dynamic / Dynamic_Method.cxx
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
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 #include <Dynamic_Method.ixx>
18 #include <Dynamic_Variable.hxx>
19 #include <Dynamic_Parameter.hxx>
20
21
22 //=======================================================================
23 //function : Dynamic_Method
24 //purpose  : 
25 //=======================================================================
26
27 Dynamic_Method::Dynamic_Method()
28 {}
29
30
31 //=======================================================================
32 //function : FirstVariableNode
33 //purpose  : 
34 //=======================================================================
35
36 Handle(Dynamic_VariableNode) Dynamic_Method::FirstVariableNode() const
37 {
38   return thefirstvariablenode;
39 }
40
41 //=======================================================================
42 //function : Variable
43 //purpose  : 
44 //=======================================================================
45
46 Standard_Boolean Dynamic_Method::Variable(const Standard_CString avariable) const
47 {
48   Handle(Dynamic_Variable) variable;
49   Handle(Dynamic_VariableNode) definition = thefirstvariablenode;
50
51   while(!definition.IsNull())
52     {
53       variable = definition->Object();
54       if(variable->Parameter()->Name() == avariable) return Standard_True;
55       definition = definition->Next();
56     }
57   return Standard_False;
58 }
59
60 //=======================================================================
61 //function : Variable
62 //purpose  : 
63 //=======================================================================
64
65 void Dynamic_Method::Variable(const Handle(Dynamic_Variable)& avariable)
66 {
67   Handle(Dynamic_VariableNode) variablenode = new Dynamic_VariableNode(avariable);
68   if(!thefirstvariablenode.IsNull()) variablenode->Next(thefirstvariablenode);
69   thefirstvariablenode = variablenode;
70 }
71
72 //=======================================================================
73 //function : Value
74 //purpose  : 
75 //=======================================================================
76
77 Standard_Boolean Dynamic_Method::Value(const Standard_CString aname,
78                                        Handle(Dynamic_Parameter)& aparameter,
79                                        Dynamic_ModeEnum& amode) const
80 {
81   Handle(Dynamic_Variable) variable;
82
83   if(Value(aname,variable))
84     {
85       amode = variable->Mode();
86       aparameter = variable->Parameter();
87       return Standard_True;
88     }
89   else
90     {
91       return Standard_False;
92     }
93 }
94
95 //=======================================================================
96 //function : Value
97 //purpose  : 
98 //=======================================================================
99
100 Standard_Boolean Dynamic_Method::Value(const Standard_CString aname,
101                                        Handle(Dynamic_Variable)& avariable) const
102 {
103   Handle(Dynamic_VariableNode) variablenode;
104   Handle(Dynamic_Variable) variable;
105
106   variablenode = thefirstvariablenode;
107
108   while(!variablenode.IsNull())
109     {
110       variable = variablenode->Object();
111       if(variable->Parameter()->Name() == aname)
112         {
113           avariable = variable;
114           return Standard_True;
115         }
116       variablenode = variablenode->Next();
117     }
118   
119   return Standard_False;
120 }
121
122 //=======================================================================
123 //function : Dump
124 //purpose  : 
125 //=======================================================================
126
127 void Dynamic_Method::Dump(Standard_OStream& astream) const
128 {
129   Handle(Dynamic_Variable) variable;
130   Handle(Dynamic_VariableNode) definition = thefirstvariablenode;
131
132   while(!definition.IsNull())
133     {
134       variable = definition->Object();
135       variable->Dump(astream);
136       astream<<" ; "<<endl;
137       definition = definition->Next();
138     }
139   astream<<endl;
140 }