1313#include < Registry.h>
1414#include " scl_memmgr.h"
1515
16- const TypeDescriptor * t_sdaiINTEGER;
17- const TypeDescriptor * t_sdaiREAL;
18- const TypeDescriptor * t_sdaiNUMBER;
19- const TypeDescriptor * t_sdaiSTRING;
20- const TypeDescriptor * t_sdaiBINARY;
21- const TypeDescriptor * t_sdaiBOOLEAN;
22- const TypeDescriptor * t_sdaiLOGICAL;
16+ const TypeDescriptor * t_sdaiINTEGER = NULL ;
17+ const TypeDescriptor * t_sdaiREAL = NULL ;
18+ const TypeDescriptor * t_sdaiNUMBER = NULL ;
19+ const TypeDescriptor * t_sdaiSTRING = NULL ;
20+ const TypeDescriptor * t_sdaiBINARY = NULL ;
21+ const TypeDescriptor * t_sdaiBOOLEAN = NULL ;
22+ const TypeDescriptor * t_sdaiLOGICAL = NULL ;
2323
2424static int uniqueNames ( const char *, const SchRename * );
2525
@@ -30,34 +30,42 @@ Registry::Registry( CF_init initFunct )
3030 active_schemas = SCL_HASHcreate ( 10 );
3131 active_types = SCL_HASHcreate ( 100 );
3232
33- t_sdaiINTEGER = new TypeDescriptor ( " INTEGER" , // Name
34- sdaiINTEGER, // FundamentalType
35- 0 , // Originating Schema
36- " INTEGER" ); // Description;
37-
38- t_sdaiREAL = new TypeDescriptor ( " REAL" , sdaiREAL,
39- 0 , // Originating Schema
40- " Real" );
41-
42- t_sdaiSTRING = new TypeDescriptor ( " STRING" , sdaiSTRING,
43- 0 , // Originating Schema
44- " String" );
45-
46- t_sdaiBINARY = new TypeDescriptor ( " BINARY" , sdaiBINARY,
47- 0 , // Originating Schema
48- " Binary" );
49-
50- t_sdaiBOOLEAN = new TypeDescriptor ( " BOOLEAN" , sdaiBOOLEAN,
51- 0 , // Originating Schema
52- " Boolean" );
53-
54- t_sdaiLOGICAL = new TypeDescriptor ( " LOGICAL" , sdaiLOGICAL,
55- 0 , // Originating Schema
56- " Logical" );
57-
58- t_sdaiNUMBER = new TypeDescriptor ( " NUMBER" , sdaiNUMBER,
59- 0 , // Originating Schema
60- " Number" );
33+ if ( !t_sdaiINTEGER ) {
34+ t_sdaiINTEGER = new TypeDescriptor ( " INTEGER" , // Name
35+ sdaiINTEGER, // FundamentalType
36+ 0 , // Originating Schema
37+ " INTEGER" ); // Description;
38+ }
39+ if ( !t_sdaiREAL ) {
40+ t_sdaiREAL = new TypeDescriptor ( " REAL" , sdaiREAL,
41+ 0 , // Originating Schema
42+ " Real" );
43+ }
44+ if ( !t_sdaiSTRING) {
45+ t_sdaiSTRING = new TypeDescriptor ( " STRING" , sdaiSTRING,
46+ 0 , // Originating Schema
47+ " String" );
48+ }
49+ if ( !t_sdaiBINARY) {
50+ t_sdaiBINARY = new TypeDescriptor ( " BINARY" , sdaiBINARY,
51+ 0 , // Originating Schema
52+ " Binary" );
53+ }
54+ if ( !t_sdaiBOOLEAN ) {
55+ t_sdaiBOOLEAN = new TypeDescriptor ( " BOOLEAN" , sdaiBOOLEAN,
56+ 0 , // Originating Schema
57+ " Boolean" );
58+ }
59+ if ( !t_sdaiLOGICAL ) {
60+ t_sdaiLOGICAL = new TypeDescriptor ( " LOGICAL" , sdaiLOGICAL,
61+ 0 , // Originating Schema
62+ " Logical" );
63+ }
64+ if ( !t_sdaiNUMBER ) {
65+ t_sdaiNUMBER = new TypeDescriptor ( " NUMBER" , sdaiNUMBER,
66+ 0 , // Originating Schema
67+ " Number" );
68+ }
6169
6270 initFunct ( *this );
6371 SCL_HASHlistinit ( active_types, &cur_type );
@@ -66,10 +74,41 @@ Registry::Registry( CF_init initFunct )
6674}
6775
6876Registry::~Registry () {
77+ DeleteContents ();
78+
6979 SCL_HASHdestroy ( primordialSwamp );
7080 SCL_HASHdestroy ( active_schemas );
7181 SCL_HASHdestroy ( active_types );
7282 delete col;
83+
84+ if ( t_sdaiINTEGER ) {
85+ delete t_sdaiINTEGER;
86+ t_sdaiINTEGER = NULL ;
87+ }
88+ if ( t_sdaiREAL ) {
89+ delete t_sdaiREAL;
90+ t_sdaiREAL = NULL ;
91+ }
92+ if ( t_sdaiSTRING ) {
93+ delete t_sdaiSTRING;
94+ t_sdaiSTRING = NULL ;
95+ }
96+ if ( t_sdaiBINARY ) {
97+ delete t_sdaiBINARY;
98+ t_sdaiBINARY = NULL ;
99+ }
100+ if ( t_sdaiBOOLEAN ) {
101+ delete t_sdaiBOOLEAN;
102+ t_sdaiBOOLEAN = NULL ;
103+ }
104+ if ( t_sdaiLOGICAL ) {
105+ delete t_sdaiLOGICAL;
106+ t_sdaiLOGICAL = NULL ;
107+ }
108+ if ( t_sdaiNUMBER ) {
109+ delete t_sdaiNUMBER;
110+ t_sdaiNUMBER = NULL ;
111+ }
73112}
74113
75114void Registry::DeleteContents () {
0 commit comments