forked from stepcode/stepcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstmgr.h
More file actions
128 lines (100 loc) · 3.89 KB
/
instmgr.h
File metadata and controls
128 lines (100 loc) · 3.89 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
#ifndef instmgr_h
#define instmgr_h
/*
* NIST STEP Editor Class Library
* cleditor/instmgr.h
* April 1997
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
///// future? TODO? ////////////////
// InstMgr can maintain an undo list for the last operation
// performed on a node
// InstMgr can have a startUndo() and endUndo() so it knows when to
// start a new undo list and delete the old undo list.
/////////////////////
#include <sc_export.h>
// IT IS VERY IMPORTANT THAT THE ORDER OF THE FOLLOWING INCLUDE FILES
// BE PRESERVED
#include <gennode.h>
#include <gennodelist.h>
#include <gennodearray.h>
#include <mgrnode.h>
#include <mgrnodelist.h>
#include <dispnode.h>
#include <dispnodelist.h>
#include <mgrnodearray.h>
class SC_CORE_EXPORT InstMgr {
protected:
int maxFileId;
int _ownsInstances; // if true will delete instances inside destructor
MgrNodeArray * master; // master array of all MgrNodes made up of
// complete, incomplete, new, delete MgrNodes lists
// this corresponds to the display list object by index
MgrNodeArraySorted * sortedMaster; // master array sorted by fileId
// StateList *master; // this will be an sorted array of ptrs to MgrNodes
public:
InstMgr( int ownsInstances = 0 );
virtual ~InstMgr();
// MASTER LIST OPERATIONS
int InstanceCount() const {
return master->Count();
}
int OwnsInstances() const {
return _ownsInstances;
}
void OwnsInstances( int ownsInstances ) {
_ownsInstances = ownsInstances;
}
void ClearInstances(); //clears instance lists but doesn't delete instances
void DeleteInstances(); // deletes the instances (ignores _ownsInstances)
Severity VerifyInstances( ErrorDescriptor & e );
// DAS PORT possible BUG two funct's below may create a temp for the cast
MgrNode * GetMgrNode( int index ) {
return ( MgrNode * ) * GetGenNode( index );
}
GenericNode ** GetGenNode( int index ) {
return &( *master ) [index];
}
MgrNode * FindFileId( int fileId );
// get the index into display list given a SDAI_Application_instance
// called by see initiated functions
int GetIndex( SDAI_Application_instance * se );
int GetIndex( MgrNode * mn );
int VerifyEntity( int fileId, const char * expectedType );
// void Append(MgrNode *node);
MgrNode * Append( SDAI_Application_instance * se, stateEnum listState );
// deletes node from master list structure
void Delete( MgrNode * node );
void Delete( SDAI_Application_instance * se );
void ChangeState( MgrNode * node, stateEnum listState );
int MaxFileId() {
return maxFileId;
}
int NextFileId() {
return maxFileId = maxFileId + 1;
}
int EntityKeywordCount( const char * name );
SDAI_Application_instance * GetApplication_instance( int index );
SDAI_Application_instance *
GetApplication_instance( const char * entityKeyword,
int starting_index = 0 );
SDAI_Application_instance * GetApplication_instance( MgrNode * node ) {
return node->GetApplication_instance();
}
void * GetSEE( int index );
void * GetSEE( MgrNode * node ) {
return node->SEE();
}
void PrintSortedFileIds();
// OBSOLETE
SDAI_Application_instance * GetSTEPentity( int index );
SDAI_Application_instance * GetSTEPentity( const char * entityKeyword,
int starting_index = 0 );
SDAI_Application_instance * GetSTEPentity( MgrNode * node ) {
return node->GetApplication_instance();
}
};
#endif