-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathmgrnode.cc
More file actions
203 lines (177 loc) · 5.58 KB
/
mgrnode.cc
File metadata and controls
203 lines (177 loc) · 5.58 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
* NIST STEP Editor Class Library
* cleditor/mgrnode.cc
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: mgrnode.cc,v 3.0.1.3 1997/11/05 22:11:37 sauderd DP3.1 $ */
#include "clstepcore/mgrnode.h"
#include "clstepcore/mgrnodelist.h"
#include "clstepcore/dispnode.h"
#include "clstepcore/dispnodelist.h"
#include "clstepcore/instmgr.h"
//#include <STEPentity.h>
#include "clstepcore/sdai.h"
#include <iostream>
void * MgrNode::SEE() {
return ( di ? di->SEE() : 0 );
}
int MgrNode::GetFileId() {
return ( se ? se->GetFileId() : -1 );
}
void MgrNode::Remove() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::Remove()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
GenericNode::Remove();
// DON'T DO THIS!! currState = noStateSE;
}
// searches current list for fileId
MgrNode * MgrNode::StateFindFileId( int fileId ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::StateFindFileId()\n";
MgrNode * startNode = this;
if( startNode->GetFileId() == fileId ) {
return this;
} else {
// mn is really a MgrNode
MgrNode * mn = ( MgrNode * )( startNode->Next() );
while( mn != startNode ) {
if( mn->GetFileId() == fileId ) {
return ( MgrNode * )mn;
}
mn = ( ( MgrNode * )mn->Next() );
}
return ( MgrNode * )0;
}
}
MgrNode::~MgrNode() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::~MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
if( se ) {
delete se;
}
if( di ) {
delete di;
}
// GenericNode::Remove(); // this is called by default.
}
///////////////////// class MgrNode Display Functions /////////////////////////
displayStateEnum MgrNode::DisplayState() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::DisplayState()\n";
return ( di ? di->DisplayState() : noMapState );
}
int MgrNode::IsDisplayState( displayStateEnum ds ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::IsDisplayState()\n";
return ( di ? di->DisplayListMember( ds ) : 0 );
}
GenericNode * MgrNode::NextDisplay() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::NextDisplay()\n";
// return (di ? ((DisplayNode *)di->Next()) : (DisplayNode *)0);
if( di ) {
// GenericNode *dn = di->Next();
// return (DisplayNode *)dn;
// return (DisplayNode *)(di->Next());
return di->Next();
} else {
return 0;
}
}
GenericNode * MgrNode::PrevDisplay() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::PrevDisplay()\n";
// return (di ? ((DisplayNode *)di->Prev()) : 0);
if( di ) {
return di->Prev();
} else {
return 0;
}
}
// STATE LIST OPERATIONS
// deletes from previous cmd list & puts on cmd list cmdList
int MgrNode::ChangeList( DisplayNodeList * cmdList ) {
if( !di ) {
di = new class DisplayNode( this );
}
return di->ChangeList( cmdList );
}
// deletes from previous cmd list & puts on cmd list cmdList
int MgrNode::ChangeList( MgrNodeList * cmdList ) {
Remove();
cmdList->Append( this );
return 1;
}
int MgrNode::ChangeState( displayStateEnum s ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::ChangeState()\n";
if( di ) {
return di->ChangeState( s );
}
return 0;
}
int MgrNode::ChangeState( stateEnum s ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::ChangeState()\n";
currState = s;
// for now, later need to type check somehow and return success or failure
return 1;
}
void MgrNode::Init( SDAI_Application_instance * s,
stateEnum listState,
MgrNodeList * list ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::Init()\n";
se = s;
arrayIndex = -1;
di = 0;
currState = listState;
if( list ) {
list->Append( this );
}
}
// used for sentinel node on lists of MgrNodes
MgrNode::MgrNode() {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( 0, noStateSE, 0 );
}
MgrNode::MgrNode( SDAI_Application_instance * StepEntPtr ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( StepEntPtr, noStateSE, 0 );
}
// 'listState' ==
// completeSE - if reading valid exchange file
// incompleteSE or completeSE - if reading working session file
// newSE - if instance is created by user using editor (probe)
MgrNode::MgrNode( SDAI_Application_instance * StepEntPtr, stateEnum listState ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( StepEntPtr, listState, 0 );
}
// 'listState' ==
// completeSE - if reading valid exchange file
// incompleteSE or completeSE - if reading working session file
// newSE - if instance is created by user using editor (probe)
MgrNode::MgrNode( SDAI_Application_instance * StepEntPtr, stateEnum listState, MgrNodeList * list ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNode::MgrNode()\n";
// if(debug_level >= PrintValues)
// cout << "MgrNode::this : '" << this << "'\n";
Init( StepEntPtr, listState, list );
}