-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathSTEPaggrInt.cc
More file actions
110 lines (90 loc) · 2.29 KB
/
STEPaggrInt.cc
File metadata and controls
110 lines (90 loc) · 2.29 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
#include "STEPaggrInt.h"
IntAggregate::IntAggregate() {
}
IntAggregate::~IntAggregate() {
}
SingleLinkNode * IntAggregate::NewNode() {
return new IntNode();
}
/// COPY
STEPaggregate & IntAggregate::ShallowCopy( const STEPaggregate & a ) {
const IntNode * tmp = ( const IntNode * ) a.GetHead();
IntNode * to;
while( tmp ) {
to = ( IntNode * ) NewNode();
to -> value = tmp -> value;
AddNode( to );
tmp = ( const IntNode * ) tmp -> NextNode();
}
if( head ) {
_null = 0;
} else {
_null = 1;
}
return *this;
}
IntNode::IntNode() {
value = S_INT_NULL;
}
IntNode::IntNode( SDAI_Integer v ) {
value = v;
}
IntNode::~IntNode() {
}
SingleLinkNode * IntNode::NewNode() {
return new IntNode();
}
Severity IntNode::StrToVal( const char * s, ErrorDescriptor * err ) {
if( ReadInteger( value, s, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_INT_NULL;
}
return err->severity();
}
Severity IntNode::StrToVal( istream & in, ErrorDescriptor * err ) {
if( ReadInteger( value, in, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_INT_NULL;
}
return err->severity();
}
Severity IntNode::STEPread( const char * s, ErrorDescriptor * err ) {
if( ReadInteger( value, s, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_INT_NULL;
}
return err->severity();
}
Severity IntNode::STEPread( istream & in, ErrorDescriptor * err ) {
if( ReadInteger( value, in, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_INT_NULL;
}
return err->severity();
}
const char * IntNode::asStr( std::string & s ) {
STEPwrite( s );
return const_cast<char *>( s.c_str() );
}
const char * IntNode::STEPwrite( std::string & s, const char * ) {
char tmp[BUFSIZ];
if( value != S_INT_NULL ) {
sprintf( tmp, "%ld", value );
s = tmp;
} else {
s.clear();
}
return const_cast<char *>( s.c_str() );
}
void IntNode::STEPwrite( ostream & out ) {
std::string s;
out << STEPwrite( s );
}