Added unnamed types to Schema.

* Unnamed types where created, but never destroyed, added unnamed types
  list to Schema and delete the unnamed types in Schema destructor.
This commit is contained in:
davyw committed 2012-04-05 20:40:06 +02:00
1 parent 0a12237f8b
commit 04f4c1da66
4 files changed
+21

No files matched your search

+6
View File
@@ -59,6 +59,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
t_0->Description( "SET [1:?] OF section_name" );
t_0->OriginatingSchema( s_header_section_schema );
t_0->ReferentType( header_section_schemat_section_name );
s_header_section_schema->AddUnnamedType(t_0);
a_4governed_sections =
new AttrDescriptor( "governed_sections", t_0, LTrue, LFalse, AttrType_Explicit,
*header_section_schemae_file_population );
@@ -86,6 +87,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
t_1->Description( "LIST [1:?] OF STRING (256)" );
t_1->OriginatingSchema( s_header_section_schema );
t_1->ReferentType( t_sdaiSTRING );
s_header_section_schema->AddUnnamedType(t_1);
a_7author =
new AttrDescriptor( "author", t_1, LFalse, LFalse, AttrType_Explicit,
*header_section_schemae_file_name );
@@ -98,6 +100,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
t_2->Description( "LIST [1:?] OF STRING (256)" );
t_2->OriginatingSchema( s_header_section_schema );
t_2->ReferentType( t_sdaiSTRING );
s_header_section_schema->AddUnnamedType(t_2);
a_8organization =
new AttrDescriptor( "organization", t_2, LFalse, LFalse, AttrType_Explicit,
*header_section_schemae_file_name );
@@ -135,6 +138,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
t_3->Description( "LIST [1:?] OF context_name" );
t_3->OriginatingSchema( s_header_section_schema );
t_3->ReferentType( header_section_schemat_context_name );
s_header_section_schema->AddUnnamedType(t_3);
a_13context_identifiers =
new AttrDescriptor( "context_identifiers", t_3, LFalse, LFalse, AttrType_Explicit,
*header_section_schemae_section_context );
@@ -152,6 +156,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
t_4->Description( "LIST [1:?] OF STRING (256)" );
t_4->OriginatingSchema( s_header_section_schema );
t_4->ReferentType( t_sdaiSTRING );
s_header_section_schema->AddUnnamedType(t_4);
a_14description =
new AttrDescriptor( "description", t_4, LFalse, LFalse, AttrType_Explicit,
*header_section_schemae_file_description );
@@ -175,6 +180,7 @@ void SdaiHEADER_SECTION_SCHEMAInit( Registry & reg ) {
t_5->Description( "LIST [1:?] OF UNIQUE schema_name" );
t_5->OriginatingSchema( s_header_section_schema );
t_5->ReferentType( header_section_schemat_schema_name );
s_header_section_schema->AddUnnamedType(t_5);
a_16schema_identifiers =
new AttrDescriptor( "schema_identifiers", t_5, LFalse, LFalse, AttrType_Explicit,
*header_section_schemae_file_schema );
+5
View File
@@ -657,6 +657,7 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
const char * _name ;
EntityDescriptorList _entList; // list of entities in the schema
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
@@ -725,6 +726,10 @@ class SCL_CORE_EXPORT Schema : public Dictionary_instance {
return _typeList.AddNode( td );
}
TypeDescLinkNode * AddUnnamedType( TypeDescriptor * td ) {
return _unnamed_typeList.AddNode( td );
}
// the whole schema
void GenerateExpress( ostream & out ) const;
+7
View File
@@ -25,6 +25,8 @@ Schema::Schema( const char * schemaName )
}
Schema::~Schema() {
TypeDescLinkNode *node;
if( _use_interface_list != 0 ) {
delete _use_interface_list;
}
@@ -34,6 +36,11 @@ Schema::~Schema() {
if( _global_rules != 0 ) {
delete _global_rules;
}
node = (TypeDescLinkNode*) _unnamed_typeList.GetHead();
while ( node ) {
delete node->TypeDesc();
node = (TypeDescLinkNode*) node->NextNode();
}
}
Interfaced_item::Interfaced_item() {
+3
View File
@@ -1983,6 +1983,9 @@ void print_typechain( FILE * f, const Type t, char * buf, Schema schema ) {
fprintf( f, " %s%d->ReferentType(%s);\n", TD_PREFIX, count, callee_buffer );
}
sprintf( buf, "%s%d", TD_PREFIX, count );
/* Types */
fprintf( f, " %s::schema->AddUnnamedType(%s%d);\n", SCHEMAget_name( schema ), TD_PREFIX, count );
}
/**************************************************************//**