-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathSTEPaggrBinary.cc
More file actions
109 lines (84 loc) · 2.35 KB
/
STEPaggrBinary.cc
File metadata and controls
109 lines (84 loc) · 2.35 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
#include "clstepcore/STEPaggrBinary.h"
#include <sstream>
/** \file STEPaggrBinary.cc
* implement classes BinaryAggregate, BinaryNode
*/
BinaryAggregate::BinaryAggregate() {
}
BinaryAggregate::~BinaryAggregate() {
}
STEPaggregate & BinaryAggregate::ShallowCopy( const STEPaggregate & a ) {
Empty();
SingleLinkNode * next = a.GetHead();
SingleLinkNode * copy;
while( next ) {
copy = new BinaryNode( *( BinaryNode * )next );
AddNode( copy );
next = next->NextNode();
}
if( head ) {
_null = 0;
} else {
_null = 1;
}
return *this;
}
SingleLinkNode * BinaryAggregate::NewNode() {
return new BinaryNode();
}
BinaryNode::BinaryNode() {
value = 0;
}
BinaryNode::~BinaryNode() {
}
BinaryNode::BinaryNode( BinaryNode & bn ) {
value = bn.value.c_str();
}
BinaryNode::BinaryNode( const char * sStr ) {
// value is an SDAI_Binary (the memory is copied)
value = sStr;
}
SingleLinkNode *
BinaryNode::NewNode() {
return new BinaryNode();
}
/**
* non-whitespace chars following s are considered garbage and is an error.
* a valid value will still be assigned if it exists before the garbage.
*/
Severity BinaryNode::StrToVal( const char * s, ErrorDescriptor * err ) {
return STEPread( s, err );
}
/**
* this function assumes you will check for garbage following input
*/
Severity BinaryNode::StrToVal( istream & in, ErrorDescriptor * err ) {
return value.STEPread( in, err );
}
/**
* non-whitespace chars following s are considered garbage and is an error.
* a valid value will still be assigned if it exists before the garbage.
*/
Severity BinaryNode::STEPread( const char * s, ErrorDescriptor * err ) {
istringstream in( ( char * )s );
value.STEPread( in, err );
CheckRemainingInput( in, err, "binary", ",)" );
return err->severity();
}
/**
* this function assumes you will check for garbage following input
*/
Severity BinaryNode::STEPread( istream & in, ErrorDescriptor * err ) {
return value.STEPread( in, err );
}
const char * BinaryNode::asStr( std::string & s ) {
s = value.c_str();
return const_cast<char *>( s.c_str() );
}
const char * BinaryNode::STEPwrite( std::string & s, const char * ) {
value.STEPwrite( s );
return const_cast<char *>( s.c_str() );
}
void BinaryNode::STEPwrite( ostream & out ) {
value.STEPwrite( out );
}