-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathmgrnodelist.cc
More file actions
72 lines (61 loc) · 2.13 KB
/
mgrnodelist.cc
File metadata and controls
72 lines (61 loc) · 2.13 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
/*
* NIST STEP Editor Class Library
* cleditor/mgrnodelist.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: mgrnodelist.cc,v 3.0.1.2 1997/11/05 22:11:39 sauderd DP3.1 $ */
#include "clstepcore/mgrnode.h"
#include "clstepcore/mgrnodelist.h"
#include "clstepcore/dispnode.h"
#include "clstepcore/dispnodelist.h"
MgrNodeList::MgrNodeList( stateEnum type ) : GenNodeList( new MgrNode() ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNodeList::MgrNodeList()\n";
listType = type;
( ( MgrNode * )head )->currState = type;
}
void MgrNodeList::Remove( GenericNode * node ) {
// if(debug_level >= PrintFunctionTrace)
// cout << "MgrNodeList::Remove()\n";
GenNodeList::Remove( node );
// DON'T DO THIS ((MgrNode *)node)->currState = noStateSE;
}
// deletes node from its previous list & appends...
// actually it puts it at the front of the list.
void MgrNodeList::Append( GenericNode * node ) {
InsertBefore( node, head );
}
// deletes newNode from its previous list & inserts after
// existNode
void MgrNodeList::InsertAfter( GenericNode * newNode,
GenericNode * existNode ) {
if( newNode->next != 0 ) { // remove the node from its previous list
newNode->Remove();
}
GenNodeList::InsertAfter( newNode, existNode );
// DON'T DO THIS ((MgrNode *)newNode)->currState = listType;
}
// deletes newNode from its previous list & inserts before
// existNode
void MgrNodeList::InsertBefore( GenericNode * newNode,
GenericNode * existNode ) {
if( newNode->next != 0 ) { // remove the node from its previous
newNode->Remove(); // state list
}
GenNodeList::InsertBefore( newNode, existNode );
// DON'T DO THIS!! ((MgrNode *)newNode)->currState = listType;
}
MgrNode * MgrNodeList::FindFileId( int fileId ) {
MgrNode * mn = ( MgrNode * )head->next;
while( mn != head ) {
if( mn->GetFileId() == fileId ) {
return mn;
}
mn = ( MgrNode * )mn->next;
}
return ( MgrNode * )0;
}