-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathSTEPaggrReal.cc
More file actions
111 lines (93 loc) · 2.43 KB
/
STEPaggrReal.cc
File metadata and controls
111 lines (93 loc) · 2.43 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
#include "clstepcore/STEPaggrReal.h"
/** \file STEPaggrReal.cc
* implementation of classes RealAggregate and RealNode
*/
RealAggregate::RealAggregate() {
}
RealAggregate::~RealAggregate() {
}
SingleLinkNode * RealAggregate::NewNode() {
return new RealNode();
}
// COPY
STEPaggregate & RealAggregate::ShallowCopy( const STEPaggregate & a ) {
const RealNode * tmp = ( const RealNode * ) a.GetHead();
RealNode * to;
while( tmp ) {
to = ( RealNode * ) NewNode();
to -> value = tmp -> value;
AddNode( to );
tmp = ( const RealNode * ) tmp -> NextNode();
}
if( head ) {
_null = 0;
} else {
_null = 1;
}
return *this;
}
RealNode::RealNode() {
value = S_REAL_NULL;
}
RealNode::RealNode( SDAI_Real v) {
value = v;
}
RealNode::~RealNode() {
}
SingleLinkNode * RealNode::NewNode() {
return new RealNode();
}
Severity RealNode::StrToVal( const char * s, ErrorDescriptor * err ) {
if( ReadReal( value, s, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_REAL_NULL;
}
return err->severity();
}
Severity RealNode::StrToVal( istream & in, ErrorDescriptor * err ) {
if( ReadReal( value, in, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_REAL_NULL;
}
return err->severity();
}
Severity RealNode::STEPread( const char * s, ErrorDescriptor * err ) {
if( ReadReal( value, s, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_REAL_NULL;
}
return err->severity();
}
Severity RealNode::STEPread( istream & in, ErrorDescriptor * err ) {
if( ReadReal( value, in, err, ",)" ) ) { // returns true if value is assigned
_null = 0;
} else {
set_null();
value = S_REAL_NULL;
}
return err->severity();
}
const char * RealNode::asStr( std::string & s ) {
STEPwrite( s );
return const_cast<char *>( s.c_str() );
}
const char * RealNode::STEPwrite( std::string & s, const char * ) {
//use memcmp to work around -Wfloat-equal warning
SDAI_Real z = S_REAL_NULL;
if( 0 != memcmp( &value, &z, sizeof z ) ) {
s = WriteReal( value );
} else {
s.clear();
}
return s.c_str();
}
void RealNode::STEPwrite( ostream & out ) {
std::string s;
out << STEPwrite( s );
}