blob: 236df5145c0d83f7531b6b0222a7c019a8e4f995 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
//static const char* sccsid = "@(#)ExprIntrp_Analysis.cxx 3.2 95/01/10"; // Do not delete this line. Used by sccs.
// Copyright: Matra-Datavision 1992
// File: ExprIntrp_Analysis.cxx
// Created: Tue Feb 25 17:47:25 1992
// Author: Arnaud BOUZY
// <adn>
#define _ExprIntrp_Analysis_SourceFile
#include <ExprIntrp_Analysis.ixx>
#include <Expr_NamedUnknown.hxx>
ExprIntrp_Analysis::ExprIntrp_Analysis() {}
void ExprIntrp_Analysis::Push(const Handle(Expr_GeneralExpression)& exp)
{
myGEStack.Push(exp);
}
void ExprIntrp_Analysis::PushRelation(const Handle(Expr_GeneralRelation)& rel)
{
myGRStack.Push(rel);
}
void ExprIntrp_Analysis::PushFunction(const Handle(Expr_GeneralFunction)& func)
{
myGFStack.Push(func);
}
void ExprIntrp_Analysis::PushName(const TCollection_AsciiString& name)
{
myNameStack.Push(name);
}
void ExprIntrp_Analysis::PushValue(const Standard_Integer val)
{
myValueStack.Push(val);
}
Handle(Expr_GeneralExpression) ExprIntrp_Analysis::Pop()
{
Handle(Expr_GeneralExpression) res;
if (!myGEStack.IsEmpty()) {
res = myGEStack.Top();
myGEStack.Pop();
}
return res;
}
Handle(Expr_GeneralRelation) ExprIntrp_Analysis::PopRelation()
{
Handle(Expr_GeneralRelation) res;
if (!myGRStack.IsEmpty()) {
res = myGRStack.Top();
myGRStack.Pop();
}
return res;
}
Handle(Expr_GeneralFunction) ExprIntrp_Analysis::PopFunction()
{
Handle(Expr_GeneralFunction) res;
if (!myGFStack.IsEmpty()) {
res = myGFStack.Top();
myGFStack.Pop();
}
return res;
}
TCollection_AsciiString ExprIntrp_Analysis::PopName()
{
TCollection_AsciiString res;
if (!myNameStack.IsEmpty()) {
res = myNameStack.Top();
myNameStack.Pop();
}
return res;
}
Standard_Integer ExprIntrp_Analysis::PopValue()
{
Standard_Integer res =0;
if (!myValueStack.IsEmpty()) {
res = myValueStack.Top();
myValueStack.Pop();
}
return res;
}
Standard_Boolean ExprIntrp_Analysis::IsExpStackEmpty() const
{
return myGEStack.IsEmpty();
}
Standard_Boolean ExprIntrp_Analysis::IsRelStackEmpty() const
{
return myGRStack.IsEmpty();
}
void ExprIntrp_Analysis::ResetAll()
{
myGEStack.Clear();
myGRStack.Clear();
myGFStack.Clear();
myNameStack.Clear();
myValueStack.Clear();
myFunctions.Clear();
myNamed.Clear();
}
void ExprIntrp_Analysis::SetMaster(const Handle(ExprIntrp_Generator)& agen)
{
ResetAll();
myMaster = agen;
myFunctions = myMaster->GetFunctions();
myNamed = myMaster->GetNamed();
}
void ExprIntrp_Analysis::Use(const Handle(Expr_NamedFunction)& func)
{
myFunctions.Append(func);
myMaster->Use(func);
}
void ExprIntrp_Analysis::Use(const Handle(Expr_NamedExpression)& named)
{
myNamed.Append(named);
myMaster->Use(named);
}
Handle(Expr_NamedExpression) ExprIntrp_Analysis::GetNamed(const TCollection_AsciiString& name)
{
for (Standard_Integer i=1; i<= myNamed.Length();i++) {
if (name == myNamed(i)->GetName()) {
return myNamed(i);
}
}
Handle(Expr_NamedExpression) curnamed;
return curnamed;
}
Handle(Expr_NamedFunction) ExprIntrp_Analysis::GetFunction(const TCollection_AsciiString& name)
{
for (Standard_Integer i=1; i<= myFunctions.Length();i++) {
if (name == myFunctions(i)->GetName()) {
return myFunctions(i);
}
}
Handle(Expr_NamedFunction) curfunc;
return curfunc;
}
|