-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathdictSchema.h
More file actions
147 lines (117 loc) · 3.91 KB
/
dictSchema.h
File metadata and controls
147 lines (117 loc) · 3.91 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#ifndef DICTSCHEMA_H
#define DICTSCHEMA_H
#include <vector>
#include "entityDescriptorList.h"
#include "typeDescriptorList.h"
#include "interfaceSpec.h"
#include "globalRule.h"
#include "dictionaryInstance.h"
typedef SDAI_Model_contents_ptr( * ModelContentsCreator )();
/**
* \class Schema (was SchemaDescriptor) - a class of this type is generated and contains schema info.
*/
class SC_CORE_EXPORT Schema : public Dictionary_instance {
protected:
const char * _name;
EntityDescriptorList _entList; // list of entities in the schema
EntityDescriptorList _entsWithInverseAttrs;
TypeDescriptorList _typeList; // list of types in the schema
TypeDescriptorList _unnamed_typeList; // list of unnamed types in the schema (for cleanup)
Interface_spec _interface; // list of USE and REF interfaces (SDAI)
// non-SDAI lists
Interface_spec__set_var _use_interface_list; // list of USE interfaces
Interface_spec__set_var _ref_interface_list; // list of REFERENCE interfaces
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4251 )
#endif
std::vector< std::string > _function_list; // of EXPRESS functions
std::vector< std::string > _procedure_list; // of EXPRESS procedures
#ifdef _MSC_VER
#pragma warning( pop )
#endif
Global_rule__set_var _global_rules;
public:
ModelContentsCreator CreateNewModelContents;
Schema( const char * schemaName );
virtual ~Schema();
void AssignModelContentsCreator( ModelContentsCreator f = 0 ) {
CreateNewModelContents = f;
}
const char * Name() const {
return _name;
}
void Name( const char * n ) {
_name = n;
}
Interface_spec & interface_() {
return _interface;
}
Interface_spec__set_var use_interface_list_() {
return
_use_interface_list;
}
Interface_spec__set_var ref_interface_list_() {
return _ref_interface_list;
}
std::vector< std::string > function_list_() {
return _function_list;
}
void AddFunction( const std::string & f );
Global_rule__set_var global_rules_() { // const
return _global_rules;
}
void AddGlobal_rule( Global_rule_ptr gr );
void global_rules_( Global_rule__set_var & grs ); // not implemented
std::vector< std::string > procedure_list_() {
return _procedure_list;
}
void AddProcedure( const std::string & p );
EntityDescLinkNode * AddEntity( EntityDescriptor * ed ) {
return _entList.AddNode( ed );
}
/// must be called in addition to AddEntity()
EntityDescLinkNode * AddEntityWInverse( EntityDescriptor * ed ) {
return _entsWithInverseAttrs.AddNode( ed );
}
TypeDescLinkNode * AddType( TypeDescriptor * td ) {
return _typeList.AddNode( td );
}
TypeDescLinkNode * AddUnnamedType( TypeDescriptor * td ) {
return _unnamed_typeList.AddNode( td );
}
const EntityDescriptorList * Entities() const {
return & _entList;
}
const EntityDescriptorList * EntsWInverse() const {
return & _entsWithInverseAttrs;
}
const TypeDescriptorList * Types() const {
return & _typeList;
}
const TypeDescriptorList * UnnamedTypes() const {
return & _unnamed_typeList;
}
EntityDescriptorList * Entities() {
return & _entList;
}
EntityDescriptorList * EntsWInverse() {
return & _entsWithInverseAttrs;
}
TypeDescriptorList * Types() {
return & _typeList;
}
TypeDescriptorList * UnnamedTypes() {
return & _unnamed_typeList;
}
// the whole schema
void GenerateExpress( ostream & out ) const;
// USE, REFERENCE definitions
void GenerateUseRefExpress( ostream & out ) const;
// TYPE definitions
void GenerateTypesExpress( ostream & out ) const;
// Entity definitions
void GenerateEntitiesExpress( ostream & out ) const;
};
typedef Schema SchemaDescriptor;
#endif //DICTSCHEMA_H