-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathaggrTypeDescriptor.cc
More file actions
82 lines (70 loc) · 2.56 KB
/
Copy pathaggrTypeDescriptor.cc
File metadata and controls
82 lines (70 loc) · 2.56 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
#include "clstepcore/aggrTypeDescriptor.h"
#include "clstepcore/STEPaggregate.h"
#include "clstepcore/enumTypeDescriptor.h"
#include "clstepcore/selectTypeDescriptor.h"
namespace {
class DescriptorEnumAggregate : public EnumAggregate {
const EnumTypeDescriptor * _enumType;
public:
explicit DescriptorEnumAggregate( const EnumTypeDescriptor * enumType )
: _enumType( enumType ) {
}
virtual SingleLinkNode * NewNode() {
return new EnumNode( _enumType ? _enumType->CreateEnum() : 0 );
}
};
}
STEPaggregate * AggrTypeDescriptor::CreateAggregate() const {
if( CreateNewAggr ) {
return CreateNewAggr();
}
const TypeDescriptor * element = ReferentType();
const TypeDescriptor * concrete =
element ? element->NonRefTypeDescriptor() : 0;
const PrimitiveType type = element ? element->NonRefType() : UNKNOWN_TYPE;
switch( type ) {
case sdaiINSTANCE:
return new EntityAggregate;
case sdaiSELECT:
return new SelectAggregate(
dynamic_cast<const SelectTypeDescriptor *>( concrete ) );
case sdaiENUMERATION:
return new DescriptorEnumAggregate(
dynamic_cast<const EnumTypeDescriptor *>( concrete ) );
case sdaiBOOLEAN:
return new BOOLEANS;
case sdaiLOGICAL:
return new LOGICALS;
case sdaiINTEGER:
return new IntAggregate;
case sdaiREAL:
case sdaiNUMBER:
return new RealAggregate;
case sdaiSTRING:
return new StringAggregate;
case sdaiBINARY:
return new BinaryAggregate;
default:
return new GenericAggregate;
}
}
void AggrTypeDescriptor::AssignAggrCreator( AggregateCreator f ) {
CreateNewAggr = f;
}
AggrTypeDescriptor::AggrTypeDescriptor( ) :
_bound1( -1 ), _bound2( -1 ), _uniqueElements( "UNKNOWN_TYPE" ),
_aggrDomainType( 0 ), CreateNewAggr( 0 ),
_bound1_type( bound_unset ), _bound2_type( bound_unset ),
_bound1_callback( 0 ), _bound2_callback( 0 ) {
}
AggrTypeDescriptor::AggrTypeDescriptor( SDAI_Integer b1,
SDAI_Integer b2,
Logical uniqElem,
TypeDescriptor * aggrDomType )
: _bound1( b1 ), _bound2( b2 ), _uniqueElements( uniqElem ),
_aggrDomainType( aggrDomType ), CreateNewAggr( 0 ),
_bound1_type( bound_constant ), _bound2_type( bound_constant ),
_bound1_callback( 0 ), _bound2_callback( 0 ) {
}
AggrTypeDescriptor::~AggrTypeDescriptor() {
}