Skip to content

Commit 4bac203

Browse files
committed
move IntAggregate and IntNode out of STEPaggregate
1 parent ad2e50b commit 4bac203

File tree

5 files changed

+158
-148
lines changed

5 files changed

+158
-148
lines changed

src/clstepcore/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ set(LIBSTEPCORE_SRCS
4141
selectTypeDescriptor.cc
4242
SingleLinkList.cc
4343
STEPaggregate.cc
44+
STEPaggrInt.cc
4445
STEPattribute.cc
4546
STEPattributeList.cc
4647
STEPcomplex.cc
@@ -93,6 +94,7 @@ set(SC_CLSTEPCORE_HDRS
9394
selectTypeDescriptor.h
9495
SingleLinkList.h
9596
STEPaggregate.h
97+
STEPaggrInt.h
9698
STEPattribute.h
9799
STEPattributeList.h
98100
STEPcomplex.h

src/clstepcore/STEPaggrInt.cc

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#include "STEPaggrInt.h"
2+
3+
4+
IntAggregate::IntAggregate() {
5+
}
6+
7+
IntAggregate::~IntAggregate() {
8+
}
9+
10+
SingleLinkNode * IntAggregate::NewNode() {
11+
return new IntNode();
12+
}
13+
14+
/// COPY
15+
STEPaggregate & IntAggregate::ShallowCopy( const STEPaggregate & a ) {
16+
const IntNode * tmp = ( const IntNode * ) a.GetHead();
17+
IntNode * to;
18+
19+
while( tmp ) {
20+
to = ( IntNode * ) NewNode();
21+
to -> value = tmp -> value;
22+
AddNode( to );
23+
tmp = ( const IntNode * ) tmp -> NextNode();
24+
}
25+
if( head ) {
26+
_null = 0;
27+
} else {
28+
_null = 1;
29+
}
30+
return *this;
31+
}
32+
33+
34+
35+
36+
IntNode::IntNode() {
37+
value = S_INT_NULL;
38+
}
39+
40+
IntNode::IntNode( SDAI_Integer v ) {
41+
value = v;
42+
}
43+
44+
IntNode::~IntNode() {
45+
}
46+
47+
SingleLinkNode * IntNode::NewNode() {
48+
return new IntNode();
49+
}
50+
51+
Severity IntNode::StrToVal( const char * s, ErrorDescriptor * err ) {
52+
if( ReadInteger( value, s, err, ",)" ) ) { // returns true if value is assigned
53+
_null = 0;
54+
} else {
55+
set_null();
56+
value = S_INT_NULL;
57+
}
58+
return err->severity();
59+
}
60+
61+
Severity IntNode::StrToVal( istream & in, ErrorDescriptor * err ) {
62+
if( ReadInteger( value, in, err, ",)" ) ) { // returns true if value is assigned
63+
_null = 0;
64+
} else {
65+
set_null();
66+
value = S_INT_NULL;
67+
}
68+
return err->severity();
69+
}
70+
71+
Severity IntNode::STEPread( const char * s, ErrorDescriptor * err ) {
72+
if( ReadInteger( value, s, err, ",)" ) ) { // returns true if value is assigned
73+
_null = 0;
74+
} else {
75+
set_null();
76+
value = S_INT_NULL;
77+
}
78+
return err->severity();
79+
}
80+
81+
Severity IntNode::STEPread( istream & in, ErrorDescriptor * err ) {
82+
if( ReadInteger( value, in, err, ",)" ) ) { // returns true if value is assigned
83+
_null = 0;
84+
} else {
85+
set_null();
86+
value = S_INT_NULL;
87+
}
88+
return err->severity();
89+
}
90+
91+
const char * IntNode::asStr( std::string & s ) {
92+
STEPwrite( s );
93+
return const_cast<char *>( s.c_str() );
94+
}
95+
96+
const char * IntNode::STEPwrite( std::string & s, const char * ) {
97+
char tmp[BUFSIZ];
98+
if( value != S_INT_NULL ) {
99+
sprintf( tmp, "%ld", value );
100+
s = tmp;
101+
} else {
102+
s.clear();
103+
}
104+
return const_cast<char *>( s.c_str() );
105+
}
106+
107+
void IntNode::STEPwrite( ostream & out ) {
108+
std::string s;
109+
out << STEPwrite( s );
110+
}

src/clstepcore/STEPaggrInt.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#ifndef STEPAGGRINT_H
2+
#define STEPAGGRINT_H
3+
4+
#include "STEPaggregate.h"
5+
#include <sc_export.h>
6+
7+
class SC_CORE_EXPORT IntAggregate : public STEPaggregate {
8+
9+
public:
10+
virtual SingleLinkNode * NewNode();
11+
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
12+
13+
IntAggregate();
14+
virtual ~IntAggregate();
15+
};
16+
typedef IntAggregate * IntAggregateH;
17+
typedef IntAggregate * IntAggregate_ptr;
18+
typedef const IntAggregate * IntAggregate_ptr_c;
19+
typedef IntAggregate_ptr IntAggregate_var;
20+
21+
22+
class SC_CORE_EXPORT IntNode : public STEPnode {
23+
public:
24+
SDAI_Integer value; // long int
25+
// INPUT
26+
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
27+
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
28+
29+
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
30+
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
31+
32+
// OUTPUT
33+
virtual const char * asStr( std::string & s );
34+
virtual const char * STEPwrite( std::string & s, const char * = 0 );
35+
virtual void STEPwrite( ostream & out = cout );
36+
37+
// CONSTRUCTORS
38+
IntNode( SDAI_Integer v );
39+
IntNode();
40+
~IntNode();
41+
42+
virtual SingleLinkNode * NewNode();
43+
};
44+
45+
46+
#endif //STEPAGGRINT_H

src/clstepcore/STEPaggregate.cc

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,38 +1323,6 @@ STEPaggregate & RealAggregate::ShallowCopy( const STEPaggregate & a ) {
13231323
return *this;
13241324
}
13251325

1326-
///////////////////////////////////////////////////////////////////////////////
1327-
// IntAggregate
1328-
///////////////////////////////////////////////////////////////////////////////
1329-
1330-
IntAggregate::IntAggregate() {
1331-
}
1332-
1333-
IntAggregate::~IntAggregate() {
1334-
}
1335-
1336-
SingleLinkNode * IntAggregate::NewNode() {
1337-
return new IntNode();
1338-
}
1339-
1340-
/// COPY
1341-
STEPaggregate & IntAggregate::ShallowCopy( const STEPaggregate & a ) {
1342-
const IntNode * tmp = ( const IntNode * ) a.GetHead();
1343-
IntNode * to;
1344-
1345-
while( tmp ) {
1346-
to = ( IntNode * ) NewNode();
1347-
to -> value = tmp -> value;
1348-
AddNode( to );
1349-
tmp = ( const IntNode * ) tmp -> NextNode();
1350-
}
1351-
if( head ) {
1352-
_null = 0;
1353-
} else {
1354-
_null = 1;
1355-
}
1356-
return *this;
1357-
}
13581326

13591327
///////////////////////////////////////////////////////////////////////////////
13601328
// RealNode
@@ -1435,83 +1403,3 @@ void RealNode::STEPwrite( ostream & out ) {
14351403
std::string s;
14361404
out << STEPwrite( s );
14371405
}
1438-
1439-
///////////////////////////////////////////////////////////////////////////////
1440-
// IntNode
1441-
///////////////////////////////////////////////////////////////////////////////
1442-
1443-
IntNode::IntNode() {
1444-
value = S_INT_NULL;
1445-
}
1446-
1447-
IntNode::IntNode( SDAI_Integer v ) {
1448-
value = v;
1449-
}
1450-
1451-
IntNode::~IntNode() {
1452-
}
1453-
1454-
SingleLinkNode * IntNode::NewNode() {
1455-
return new IntNode();
1456-
}
1457-
1458-
Severity IntNode::StrToVal( const char * s, ErrorDescriptor * err ) {
1459-
if( ReadInteger( value, s, err, ",)" ) ) { // returns true if value is assigned
1460-
_null = 0;
1461-
} else {
1462-
set_null();
1463-
value = S_INT_NULL;
1464-
}
1465-
return err->severity();
1466-
}
1467-
1468-
Severity IntNode::StrToVal( istream & in, ErrorDescriptor * err ) {
1469-
if( ReadInteger( value, in, err, ",)" ) ) { // returns true if value is assigned
1470-
_null = 0;
1471-
} else {
1472-
set_null();
1473-
value = S_INT_NULL;
1474-
}
1475-
return err->severity();
1476-
}
1477-
1478-
Severity IntNode::STEPread( const char * s, ErrorDescriptor * err ) {
1479-
if( ReadInteger( value, s, err, ",)" ) ) { // returns true if value is assigned
1480-
_null = 0;
1481-
} else {
1482-
set_null();
1483-
value = S_INT_NULL;
1484-
}
1485-
return err->severity();
1486-
}
1487-
1488-
Severity IntNode::STEPread( istream & in, ErrorDescriptor * err ) {
1489-
if( ReadInteger( value, in, err, ",)" ) ) { // returns true if value is assigned
1490-
_null = 0;
1491-
} else {
1492-
set_null();
1493-
value = S_INT_NULL;
1494-
}
1495-
return err->severity();
1496-
}
1497-
1498-
const char * IntNode::asStr( std::string & s ) {
1499-
STEPwrite( s );
1500-
return const_cast<char *>( s.c_str() );
1501-
}
1502-
1503-
const char * IntNode::STEPwrite( std::string & s, const char * ) {
1504-
char tmp[BUFSIZ];
1505-
if( value != S_INT_NULL ) {
1506-
sprintf( tmp, "%ld", value );
1507-
s = tmp;
1508-
} else {
1509-
s.clear();
1510-
}
1511-
return const_cast<char *>( s.c_str() );
1512-
}
1513-
1514-
void IntNode::STEPwrite( ostream & out ) {
1515-
std::string s;
1516-
out << STEPwrite( s );
1517-
}

src/clstepcore/STEPaggregate.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,6 @@ typedef RealAggregate * RealAggregate_ptr;
243243
typedef const RealAggregate * RealAggregate_ptr_c;
244244
typedef RealAggregate_ptr RealAggregate_var;
245245

246-
class SC_CORE_EXPORT IntAggregate : public STEPaggregate {
247-
248-
public:
249-
virtual SingleLinkNode * NewNode();
250-
virtual STEPaggregate & ShallowCopy( const STEPaggregate & );
251-
252-
IntAggregate();
253-
virtual ~IntAggregate();
254-
};
255-
typedef IntAggregate * IntAggregateH;
256-
typedef IntAggregate * IntAggregate_ptr;
257-
typedef const IntAggregate * IntAggregate_ptr_c;
258-
typedef IntAggregate_ptr IntAggregate_var;
259246

260247
///////////////////////////////////////////////////////////////////////////////
261248

@@ -538,29 +525,6 @@ class SC_CORE_EXPORT RealNode : public STEPnode {
538525
virtual SingleLinkNode * NewNode();
539526
};
540527

541-
class SC_CORE_EXPORT IntNode : public STEPnode {
542-
public:
543-
SDAI_Integer value; // long int
544-
// INPUT
545-
virtual Severity StrToVal( const char * s, ErrorDescriptor * err );
546-
virtual Severity StrToVal( istream & in, ErrorDescriptor * err );
547-
548-
virtual Severity STEPread( const char * s, ErrorDescriptor * err );
549-
virtual Severity STEPread( istream & in, ErrorDescriptor * err );
550-
551-
// OUTPUT
552-
virtual const char * asStr( std::string & s );
553-
virtual const char * STEPwrite( std::string & s, const char * = 0 );
554-
virtual void STEPwrite( ostream & out = cout );
555-
556-
// CONSTRUCTORS
557-
IntNode( SDAI_Integer v );
558-
IntNode();
559-
~IntNode();
560-
561-
virtual SingleLinkNode * NewNode();
562-
};
563-
564528
/******************************************************************
565529
** FIXME The following classes are currently stubs
566530
**

0 commit comments

Comments
 (0)