forked from stepcode/stepcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdaiApplication_instance.h
More file actions
209 lines (175 loc) · 6.75 KB
/
sdaiApplication_instance.h
File metadata and controls
209 lines (175 loc) · 6.75 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
204
205
206
207
208
209
#ifndef STEPENTITY_H
#define STEPENTITY_H
/*
* NIST STEP Core Class Library
* clstepcore/sdaiApplication_instance.h
* April 1997
* K. C. Morris
* David Sauder
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
#include <map>
#include <iostream>
#include <sc_export.h>
#include "cldai/sdaiDaObject.h"
class EntityAggregate;
class Inverse_attribute;
typedef struct {
union {
EntityAggregate * a;
SDAI_Application_instance * i;
};
} iAstruct;
/** @class
* this used to be STEPentity
*/
class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
private:
int _cur; // provides a built-in way of accessing attributes in order.
public:
typedef std::map< const Inverse_attribute * const, iAstruct> iAMap_t;
const EntityDescriptor * eDesc;
protected:
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
iAMap_t iAMap;
#ifdef _MSC_VER
#pragma warning( pop )
#endif
bool _complex;
public: //TODO make these private?
STEPattributeList attributes;
/* see mgrnode.cc where -1 is returned when there is no sdai
* instance. might be possible to treat 0 for this purpose
* instead of negative so the ID's can become unsigned.
*/
int STEPfile_id;
ErrorDescriptor _error;
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
std::string p21Comment;
#ifdef _MSC_VER
#pragma warning( pop )
#endif
/**
** head entity for multiple inheritance. If it is null then this
** SDAI_Application_instance is not part of a multiply inherited entity. If it
** points to a SDAI_Application_instance then this SDAI_Application_instance is part of a mi entity
** and head points at the root SDAI_Application_instance of the primary inheritance
** path (the one that is the root of the leaf entity).
*/
SDAI_Application_instance * headMiEntity;
/// these form a chain of other entity parents for multiple inheritance
SDAI_Application_instance * nextMiEntity;
public:
SDAI_Application_instance();
SDAI_Application_instance( int fileid, int complex = 0 );
virtual ~SDAI_Application_instance();
bool IsComplex() const {
return _complex;
}
/// initialize inverse attribute list
void InitIAttrs();
void StepFileId( int fid ) {
STEPfile_id = fid;
}
int StepFileId() const {
return STEPfile_id;
}
void AddP21Comment( const std::string & s, bool replace = true );
void AddP21Comment( const char * s, bool replace = true );
void PrependP21Comment( const std::string & s );
void DeleteP21Comment() {
p21Comment = "";
}
std::string P21Comment() const {
return p21Comment;
}
const char * EntityName( const char * schnm = NULL ) const;
virtual const EntityDescriptor * IsA( const EntityDescriptor * ) const;
virtual Severity ValidLevel( ErrorDescriptor * error, InstMgrBase * im,
int clearError = 1 );
ErrorDescriptor & Error() {
return _error;
}
// clears entity's error and optionally all attr's errors
void ClearError( int clearAttrs = 1 );
// clears all attr's errors
void ClearAttrError();
virtual SDAI_Application_instance * Replicate();
// ACCESS attributes in order.
int AttributeCount();
STEPattribute * NextAttribute();
void ResetAttributes() {
_cur = 0;
}
// ACCESS inverse attributes
const iAstruct getInvAttr( const Inverse_attribute * const ia ) const;
const iAMap_t::value_type getInvAttr( const char * name ) const;
void setInvAttr( const Inverse_attribute * const ia, const iAstruct ias );
const iAMap_t & getInvAttrs() const {
return iAMap;
}
// READ
virtual Severity STEPread( int id, int addFileId,
class InstMgrBase * instance_set,
std::istream & in = std::cin, const char * currSch = NULL,
bool useTechCor = true, bool strict = true );
virtual void STEPread_error( char c, int i, std::istream& in, const char * schnm );
// WRITE
virtual void STEPwrite( std::ostream & out = std::cout, const char * currSch = NULL,
int writeComments = 1 );
virtual const char * STEPwrite( std::string & buf, const char * currSch = NULL );
void WriteValuePairs( std::ostream & out, const char * currSch = NULL,
int writeComments = 1, int mixedCase = 1 );
void STEPwrite_reference( std::ostream & out = std::cout );
const char * STEPwrite_reference( std::string & buf );
void beginSTEPwrite( std::ostream & out = std::cout ); ///< writes out the SCOPE section
void endSTEPwrite( std::ostream & out = std::cout );
// MULTIPLE INHERITANCE
int MultipleInheritance() {
return !( headMiEntity == 0 );
}
void HeadEntity( SDAI_Application_instance * se ) {
headMiEntity = se;
}
SDAI_Application_instance * HeadEntity() {
return headMiEntity;
}
SDAI_Application_instance * GetNextMiEntity() {
return nextMiEntity;
}
SDAI_Application_instance * GetMiEntity( char * entName );
void AppendMultInstance( SDAI_Application_instance * se );
protected:
STEPattribute * GetSTEPattribute( const char * nm, const char * entity = NULL );
STEPattribute * MakeDerived( const char * nm, const char * entity = NULL );
STEPattribute * MakeRedefined( STEPattribute * redefiningAttr,
const char * nm );
virtual void CopyAs( SDAI_Application_instance * );
void PrependEntityErrMsg();
public:
// these functions are going to go away in the future.
int SetFileId( int fid ) {
return STEPfile_id = fid;
}
int GetFileId() const {
return STEPfile_id;
}
int FileId( int fid ) {
return STEPfile_id = fid;
}
int FileId() const {
return STEPfile_id;
}
};
// current style of CORBA handles for Part 23 - NOTE - used for more than CORBA
typedef SDAI_Application_instance * SDAI_Application_instance_ptr;
typedef SDAI_Application_instance_ptr SDAI_Application_instance_var;
SC_CORE_EXPORT bool isNilSTEPentity( const SDAI_Application_instance * ai );
#endif //STEPENTITY_H