forked from stepcode/stepcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTEPattribute.h
More file actions
195 lines (151 loc) · 6.71 KB
/
STEPattribute.h
File metadata and controls
195 lines (151 loc) · 6.71 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
#ifndef STEPATTRIBUTE_H
#define STEPATTRIBUTE_H 1
/*
* NIST STEP Core Class Library
* clstepcore/STEPattribute.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 <scl_export.h>
#include <stdio.h>
#include <errordesc.h>
#include <baseType.h>
#include <sdai.h>
/** \def REAL_NUM_PRECISION
* this is used to set a const int Real_Num_Precision
* in STEPaggregate.cc and STEPattribute.cc
*/
#define REAL_NUM_PRECISION 15
typedef double real;
class InstMgr;
class SDAI_Application_instance;
class STEPaggregate;
class SCLundefined;
class TypeDescriptor;
class AttrDescriptor;
class EntityDescriptor;
#include <sstream>
extern SCL_CORE_EXPORT int SetErrOnNull( const char * attrValue, ErrorDescriptor * error );
extern SCL_CORE_EXPORT SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId );
extern SCL_CORE_EXPORT SDAI_Application_instance * ReadEntityRef( const char * s, ErrorDescriptor * err, const char * tokenList,
InstMgr * instances, int addFileId );
extern SCL_CORE_EXPORT Severity EntityValidLevel( SDAI_Application_instance * se,
const TypeDescriptor * ed, ///< entity type that entity se needs to match. (this must be an EntityDescriptor)
ErrorDescriptor * err );
extern SCL_CORE_EXPORT Severity EntityValidLevel( const char * attrValue, ///< string containing entity ref
const TypeDescriptor * ed, /**< entity type that entity in attrValue (if it exists) needs
* to match. (this must be an EntityDescriptor)
*/
ErrorDescriptor * err, InstMgr * im, int clearError );
////////////////////
////////////////////
extern SCL_CORE_EXPORT SDAI_Application_instance * STEPread_reference( const char * s, ErrorDescriptor * err,
InstMgr * instances, int addFileId );
////////////////////
extern SCL_CORE_EXPORT int QuoteInString( istream & in );
extern SCL_CORE_EXPORT void AppendChar( char c, int & index, char *& s, int & sSize );
extern SCL_CORE_EXPORT void PushPastString( istream & in, std::string & s, ErrorDescriptor * err );
extern SCL_CORE_EXPORT void PushPastImbedAggr( istream & in, std::string & s, ErrorDescriptor * err );
extern SCL_CORE_EXPORT void PushPastAggr1Dim( istream & in, std::string & s, ErrorDescriptor * err );
class SCL_CORE_EXPORT STEPattribute {
friend ostream & operator<< ( ostream &, STEPattribute & );
friend class SDAI_Application_instance;
protected:
ErrorDescriptor _error;
unsigned int _derive : 1;
int Derive( unsigned int n = 1 ) {
return _derive = n;
}
STEPattribute * _redefAttr;
void RedefiningAttr( STEPattribute * a ) {
_redefAttr = a;
}
public:
const AttrDescriptor * aDesc;
int refCount;
/** \union ptr
** You know which of these to use based on the return value of
** NonRefType() - see below. BASE_TYPE is defined in baseType.h
** This variable points to an appropriate member variable in the entity
** class in the generated schema class library (the entity class is
** inherited from SDAI_Application_instance)
*/
union {
SDAI_String * S; // STRING_TYPE
SDAI_Integer * i; // INTEGER_TYPE (Integer is a long int)
SDAI_Binary * b; // BINARY_TYPE
SDAI_Real * r; // REAL_TYPE and NUMBER_TYPE (Real is a double)
SDAI_Application_instance * * c; // ENTITY_TYPE
STEPaggregate * a; // AGGREGATE_TYPE
SDAI_Enum * e; // ENUM_TYPE, BOOLEAN_TYPE, and LOGICAL_TYPE
SDAI_Select * sh; // SELECT_TYPE
SCLundefined * u; // UNKNOWN_TYPE
void * p;
} ptr;
protected:
char SkipBadAttr( istream & in, char * StopChars );
void AddErrorInfo();
public:
///////////// Read, Write, Assign attr value
Severity StrToVal( const char * s, InstMgr * instances = 0,
int addFileId = 0 );
Severity STEPread( istream & in = cin, InstMgr * instances = 0,
int addFileId = 0, const char * = NULL, bool strict = true );
const char * asStr( std::string &, const char * = 0 ) const;
// return the attr value as a string
void STEPwrite( ostream & out = cout, const char * = 0 );
int ShallowCopy( STEPattribute * sa );
Severity set_null();
////////////// Return info on attr
int Nullable() const; // may this attribute be null?
int is_null() const; // is this attribute null?
int IsDerived() const {
return _derive;
}
STEPattribute * RedefiningAttr() {
return _redefAttr;
}
const char * Name() const;
const char * TypeName() const;
const BASE_TYPE Type() const;
const BASE_TYPE NonRefType() const;
const BASE_TYPE BaseType() const;
const TypeDescriptor * ReferentType() const;
ErrorDescriptor & Error() {
return _error;
}
void ClearErrorMsg() {
_error.ClearErrorMsg();
}
Severity ValidLevel( const char * attrValue, ErrorDescriptor * error,
InstMgr * im, int clearError = 1 );
public:
////////////////// Constructors
STEPattribute( const STEPattribute & a );
STEPattribute() {};
~STEPattribute() {};
// INTEGER
STEPattribute( const class AttrDescriptor & d, SDAI_Integer * p );
// BINARY
STEPattribute( const class AttrDescriptor & d, SDAI_Binary * p );
// STRING
STEPattribute( const class AttrDescriptor & d, SDAI_String * p );
// REAL & NUMBER
STEPattribute( const class AttrDescriptor & d, SDAI_Real * p );
// ENTITY
STEPattribute( const class AttrDescriptor & d, SDAI_Application_instance* *p );
// AGGREGATE
STEPattribute( const class AttrDescriptor & d, STEPaggregate * p );
// ENUMERATION and Logical
STEPattribute( const class AttrDescriptor & d, SDAI_Enum * p );
// SELECT
STEPattribute( const class AttrDescriptor & d, SDAI_Select * p );
// UNDEFINED
STEPattribute( const class AttrDescriptor & d, SCLundefined * p );
friend bool operator == ( STEPattribute & a1, STEPattribute & a2 );
};
#endif