1 #ifndef EXPDICT_H
2 #define EXPDICT_H
3 
4 /*
5 * NIST STEP Core Class Library
6 * clstepcore/ExpDict.h
7 * April, 1997
8 * K. C. Morris
9 * David Sauder
10 
11 * Development of this software was funded by the United States Government,
12 * and is not subject to copyright.
13 */
14 
15 #include <sc_export.h>
16 #include <sdai.h>
17 
18 #include <vector>
19 #include <string>
20 #include <assert.h>
21 
22 typedef  SDAI_Application_instance * ( * Creator )();
23 
24 enum AttrType_Enum {
25     AttrType_Explicit = 0,
26     AttrType_Inverse,
27     AttrType_Deriving,
28     AttrType_Redefining
29 };
30 
31 enum AggrBoundTypeEnum {
32     bound_unset = 0,
33     bound_constant,
34     bound_runtime,
35     bound_funcall
36 };
37 
38 #include <SingleLinkList.h>
39 
40 #include <baseType.h>
41 #include <dictdefs.h>
42 #include <Str.h>
43 
44 // defined and created in Registry.inline.cc
45 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiINTEGER;
46 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiREAL;
47 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiNUMBER;
48 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiSTRING;
49 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiBINARY;
50 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiBOOLEAN;
51 extern SC_CORE_EXPORT const TypeDescriptor  * t_sdaiLOGICAL;
52 
53 ///////////////////////////////////////////////////////////////////////////////
54 // Dictionary_instance
55 ///////////////////////////////////////////////////////////////////////////////
56 
57 class SC_CORE_EXPORT Dictionary_instance {
58 
59     protected:
Dictionary_instance()60         Dictionary_instance() {}
Dictionary_instance(const Dictionary_instance &)61         Dictionary_instance( const Dictionary_instance & ) {}
62 
63         virtual ~Dictionary_instance();
64 };
65 
66 ///////////////////////////////////////////////////////////////////////////////
67 
68 class SC_CORE_EXPORT TypeDescLinkNode : public SingleLinkNode {
69     private:
70     protected:
71         TypeDescriptor * _typeDesc;
72     public:
73         TypeDescLinkNode();
74         virtual ~TypeDescLinkNode();
75 
TypeDesc()76         const TypeDescriptor * TypeDesc() const {
77             return _typeDesc;
78         }
TypeDesc(TypeDescriptor * td)79         void TypeDesc( TypeDescriptor * td ) {
80             _typeDesc = td;
81         }
82 };
83 
84 class SC_CORE_EXPORT TypeDescriptorList : public SingleLinkList {
85     private:
86     protected:
87     public:
88         TypeDescriptorList();
89         virtual ~TypeDescriptorList();
90 
NewNode()91         virtual SingleLinkNode * NewNode() {
92             return new TypeDescLinkNode;
93         }
94 
AddNode(TypeDescriptor * td)95         TypeDescLinkNode * AddNode( TypeDescriptor * td ) {
96             TypeDescLinkNode * node = ( TypeDescLinkNode * ) NewNode();
97             node->TypeDesc( td );
98             SingleLinkList::AppendNode( node );
99             return node;
100         }
101 };
102 
103 class SC_CORE_EXPORT TypeDescItr {
104     protected:
105         const TypeDescriptorList & tdl;
106         const TypeDescLinkNode * cur;
107 
108     public:
109         TypeDescItr( const TypeDescriptorList & tdList );
110         virtual ~TypeDescItr();
111 
ResetItr()112         void ResetItr() {
113             cur = ( TypeDescLinkNode * )( tdl.GetHead() );
114         }
115 
116         const TypeDescriptor * NextTypeDesc();
117 };
118 
119 ///////////////////////////////////////////////////////////////////////////////
120 
121 class SC_CORE_EXPORT EntityDescLinkNode : public SingleLinkNode {
122 
123     private:
124     protected:
125         EntityDescriptor * _entityDesc;
126 
127     public:
128         EntityDescLinkNode();
129         virtual ~EntityDescLinkNode();
130 
EntityDesc()131         EntityDescriptor * EntityDesc() const {
132             return _entityDesc;
133         }
EntityDesc(EntityDescriptor * ed)134         void EntityDesc( EntityDescriptor * ed ) {
135             _entityDesc = ed;
136         }
137 };
138 
139 class SC_CORE_EXPORT EntityDescriptorList : public SingleLinkList {
140 
141     private:
142     protected:
143     public:
144         EntityDescriptorList();
145         virtual ~EntityDescriptorList();
146 
NewNode()147         virtual SingleLinkNode * NewNode() {
148             return new EntityDescLinkNode;
149         }
150 
AddNode(EntityDescriptor * ed)151         EntityDescLinkNode * AddNode( EntityDescriptor * ed ) {
152             EntityDescLinkNode * node = ( EntityDescLinkNode * ) NewNode();
153             node->EntityDesc( ed );
154             SingleLinkList::AppendNode( node );
155             return node;
156         }
157 };
158 
159 typedef EntityDescriptorList * Entity__set_ptr;
160 typedef Entity__set_ptr Entity__set_var;
161 
162 class SC_CORE_EXPORT EntityDescItr {
163     protected:
164         const EntityDescriptorList & edl;
165         const EntityDescLinkNode * cur;
166 
167     public:
168         EntityDescItr( const EntityDescriptorList & edList );
169         virtual ~EntityDescItr();
170 
ResetItr()171         void ResetItr() {
172             cur = ( EntityDescLinkNode * )( edl.GetHead() );
173         }
174 
NextEntityDesc()175         inline const EntityDescriptor * NextEntityDesc() {
176             return NextEntityDesc_nc();
177         }
178         EntityDescriptor * NextEntityDesc_nc();
179 
180 };
181 
182 
183 ///////////////////////////////////////////////////////////////////////////////
184 
185 
186 ///////////////////////////////////////////////////////////////////////////////
187 // Interfaced_item
188 ///////////////////////////////////////////////////////////////////////////////
189 
190 class SC_CORE_EXPORT Interfaced_item : public Dictionary_instance {
191     protected:
192         Interfaced_item();
193         Interfaced_item( const Interfaced_item & );
194         Interfaced_item( const char * foreign_schema );
195         virtual ~Interfaced_item();
196     public:
197         Express_id _foreign_schema;
198 
199         const Express_id foreign_schema_();
200 //  private:
201         void foreign_schema_( const Express_id & );
202 };
203 
204 ///////////////////////////////////////////////////////////////////////////////
205 // Explicit_item_id
206 ///////////////////////////////////////////////////////////////////////////////
207 
208 class SC_CORE_EXPORT Explicit_item_id : public Interfaced_item {
209     protected:
210         Explicit_item_id();
211         Explicit_item_id( const Explicit_item_id & );
Explicit_item_id(const char * foreign_schema,TypeDescriptor * ld,const char * oi,const char * ni)212         Explicit_item_id( const char * foreign_schema, TypeDescriptor * ld,
213                           const char * oi, const char * ni )
214             : Interfaced_item( foreign_schema ), _local_definition( ld ), _original_id( oi ), _new_id( ni ) {}
215         virtual ~Explicit_item_id();
216     public:
217         // definition in the local schema. The TypeDescriptor (or subtype) is not
218         // implemented quite right - the name in it is the original (foreign
219         // schema) name. The USE or REFERENCED renames are listed in
220         // TypeDescriptor's altNames member variable.
221         // Warning: This is currently a null ptr for objects other than
222         // types and entities - that is - if this is a USEd FUNCTION or PROCEDURE
223         // this ptr will be null.
224         const TypeDescriptor * _local_definition;
225 
226         // name in originating schema - only exists if it has been renamed.
227         Express_id _original_id;
228 
229         Express_id _new_id; // original or renamed name via USE or REFERENCE (non-SDAI)
230 
local_definition_()231         const TypeDescriptor * local_definition_() const {
232             return _local_definition;
233         }
234 
original_id_()235         const Express_id original_id_() const {
236             return _original_id;
237         }
238 
239         // non-sdai, renamed name
new_id_()240         const Express_id new_id_() const {
241             return _new_id;
242         }
243 
244         // return string "USE" or "REFERENCE"
245         virtual const char * EXPRESS_type() = 0;
246 
247 //  private:
local_definition_(const TypeDescriptor * td)248         void local_definition_( const TypeDescriptor * td ) {
249             _local_definition = td;
250         }
original_id_(const Express_id & ei)251         void original_id_( const Express_id & ei ) {
252             _original_id = ei;
253         }
254 
255         // non-sdai
new_id_(const Express_id & ni)256         void new_id_( const Express_id & ni ) {
257             _new_id = ni;
258         }
259 };
260 
261 typedef Explicit_item_id * Explicit_item_id_ptr;
262 
263 class SC_CORE_EXPORT Used_item : public Explicit_item_id {
264     public:
Used_item()265         Used_item() {}
Used_item(const char * foreign_schema,TypeDescriptor * ld,const char * oi,const char * ni)266         Used_item( const char * foreign_schema, TypeDescriptor * ld,
267                    const char * oi, const char * ni )
268             : Explicit_item_id( foreign_schema, ld, oi, ni ) {}
269         virtual ~Used_item();
270 
EXPRESS_type()271         const char * EXPRESS_type() {
272             return "USE";
273         }
274 };
275 
276 typedef Used_item * Used_item_ptr;
277 
278 class SC_CORE_EXPORT Referenced_item : public Explicit_item_id {
279     public:
Referenced_item()280         Referenced_item() {}
Referenced_item(const char * foreign_schema,TypeDescriptor * ld,const char * oi,const char * ni)281         Referenced_item( const char * foreign_schema, TypeDescriptor * ld,
282                          const char * oi, const char * ni )
283             : Explicit_item_id( foreign_schema, ld, oi, ni ) {}
284         virtual ~Referenced_item();
285 
EXPRESS_type()286         const char * EXPRESS_type() {
287             return "REFERENCE";
288         }
289 };
290 
291 typedef Referenced_item * Referenced_item_ptr;
292 
293 class SC_CORE_EXPORT Explicit_item_id__set {
294     public:
295         Explicit_item_id__set( int = 16 );
296         ~Explicit_item_id__set();
297 
298         Explicit_item_id_ptr & operator[]( int index );
299         void Insert( Explicit_item_id_ptr, int index );
300         void Append( Explicit_item_id_ptr );
301         void Remove( int index );
302         int Index( Explicit_item_id_ptr );
303 
304         int Count();
305         void Clear();
306     private:
307         void Check( int index );
308     private:
309         Explicit_item_id_ptr * _buf;
310         int _bufsize;
311         int _count;
312 };
313 
314 typedef Explicit_item_id__set * Explicit_item_id__set_ptr;
315 typedef Explicit_item_id__set_ptr Explicit_item_id__set_var;
316 
317 ///////////////////////////////////////////////////////////////////////////////
318 // Implicit_item_id
319 ///////////////////////////////////////////////////////////////////////////////
320 
321 class SC_CORE_EXPORT Implicit_item_id : public Interfaced_item {
322     protected:
323         Implicit_item_id();
324         Implicit_item_id( Implicit_item_id & );
325         virtual ~Implicit_item_id();
326     public:
327         const TypeDescriptor * _local_definition;
328 
local_definition_()329         const TypeDescriptor * local_definition_() const {
330             return _local_definition;
331         }
332 
333 //  private:
local_definition_(const TypeDescriptor * td)334         void local_definition_( const TypeDescriptor * td ) {
335             _local_definition = td;
336         }
337 };
338 
339 typedef Implicit_item_id * Implicit_item_id_ptr;
340 
341 ///////////////////////////////////////////////////////////////////////////////
342 // Implicit_item_id__set
343 ///////////////////////////////////////////////////////////////////////////////
344 
345 class SC_CORE_EXPORT Implicit_item_id__set {
346     public:
347         Implicit_item_id__set( int = 16 );
348         ~Implicit_item_id__set();
349 
350         Implicit_item_id_ptr & operator[]( int index );
351         void Insert( Implicit_item_id_ptr, int index );
352         void Append( Implicit_item_id_ptr );
353         void Remove( int index );
354         int Index( Implicit_item_id_ptr );
355 
356         int Count();
357         void Clear();
358     private:
359         void Check( int index );
360     private:
361         Implicit_item_id_ptr * _buf;
362         int _bufsize;
363         int _count;
364 };
365 
366 typedef Implicit_item_id__set * Implicit_item_id__set_ptr;
367 typedef Implicit_item_id__set_ptr Implicit_item_id__set_var;
368 
369 ///////////////////////////////////////////////////////////////////////////////
370 // Interface_spec
371 ///////////////////////////////////////////////////////////////////////////////
372 
373 class SC_CORE_EXPORT Interface_spec : public Dictionary_instance {
374     public:
375         Express_id _current_schema_id; // schema containing the USE/REF stmt
376         // set of objects from USE/REFERENCE stmt(s)
377         Explicit_item_id__set_var _explicit_items;
378         Implicit_item_id__set_var _implicit_items; //not yet initialized for schema
379 
380         // non-SDAI, not useful for SDAI use of Interface_spec (it would need to
381         // be a list).
382         // schema that defined the USE/REFd objects
383         Express_id _foreign_schema_id;
384 
385         // non-SDAI, not useful for SDAI use of Interface_spec (it would need to
386         // be a list of ints).
387         // schema USEs or REFERENCEs all objects from foreign schema
388         int _all_objects;
389 
390         Interface_spec();
391         Interface_spec( Interface_spec & ); // not tested
392         Interface_spec( const char * cur_sch_id, const char * foreign_sch_id,
393                         int all_objects = 0 );
394         virtual ~Interface_spec();
395 
current_schema_id_()396         Express_id current_schema_id_() {
397             return _current_schema_id;
398         }
foreign_schema_id_()399         Express_id foreign_schema_id_() {
400             return _foreign_schema_id;
401         }
402 
explicit_items_()403         Explicit_item_id__set_var explicit_items_() {
404             return _explicit_items;
405         }
406 
407         // this is not yet initialized for the schema
implicit_items_()408         Implicit_item_id__set_var implicit_items_() {
409             return _implicit_items;
410         }
411 
412 //  private:
current_schema_id_(const Express_id & ei)413         void current_schema_id_( const Express_id & ei ) {
414             _current_schema_id = ei;
415         }
foreign_schema_id_(const Express_id & fi)416         void foreign_schema_id_( const Express_id & fi ) {
417             _foreign_schema_id = fi;
418         }
419 
all_objects_()420         int all_objects_() {
421             return _all_objects;
422         }
all_objects_(int ao)423         void all_objects_( int ao ) {
424             _all_objects = ao;
425         }
426 };
427 
428 typedef Interface_spec * Interface_spec_ptr;
429 
430 class SC_CORE_EXPORT Interface_spec__set {
431     public:
432         Interface_spec__set( int = 16 );
433         ~Interface_spec__set();
434 
435         Interface_spec_ptr & operator[]( int index );
436         void Insert( Interface_spec_ptr, int index );
437         void Append( Interface_spec_ptr );
438         void Remove( int index );
439         int Index( Interface_spec_ptr );
440 
441         int Count();
442         void Clear();
443     private:
444         void Check( int index );
445     private:
446         Interface_spec_ptr * _buf;
447         int _bufsize;
448         int _count;
449 };
450 
451 typedef Interface_spec__set * Interface_spec__set_ptr;
452 typedef Interface_spec__set_ptr Interface_spec__set_var;
453 
454 
455 class SC_CORE_EXPORT Type_or_rule : public Dictionary_instance {
456     public:
457         Type_or_rule();
458         Type_or_rule( const Type_or_rule & );
459         virtual ~Type_or_rule();
460 };
461 
462 typedef Type_or_rule * Type_or_rule_ptr;
463 typedef Type_or_rule_ptr Type_or_rule_var;
464 
465 class SC_CORE_EXPORT Where_rule : public Dictionary_instance {
466     public:
467         Express_id _label;
468         Type_or_rule_var _type_or_rule;
469 
470         // non-SDAI
471         std::string _comment; // Comment contained in the EXPRESS.
472         // Should be properly formatted to include (* *)
473         // Will be written to EXPRESS as-is (w/out formatting)
474 
475         Where_rule();
476         Where_rule( const Where_rule & );
477         Where_rule( const char * label, Type_or_rule_var tor = 0 )
_label(label)478             : _label( label ), _type_or_rule( tor ) { }
479         virtual ~Where_rule();
480 
label_()481         Express_id label_() const {
482             return _label;
483         }
parent_item()484         Type_or_rule_var parent_item() const {
485             return _type_or_rule;
486         }
comment_()487         std::string comment_() const {
488             return _comment;
489         }
490 
label_(const Express_id & ei)491         void label_( const Express_id & ei ) {
492             _label = ei;
493         }
parent_item(const Type_or_rule_var & tor)494         void parent_item( const Type_or_rule_var & tor ) {
495             _type_or_rule = tor;
496         }
comment_(const char * c)497         void comment_( const char * c ) {
498             _comment = c;
499         }
500 };
501 
502 typedef Where_rule * Where_rule_ptr;
503 
504 class SC_CORE_EXPORT Where_rule__list {
505     public:
506         Where_rule__list( int = 16 );
507         ~Where_rule__list();
508 
509         Where_rule_ptr & operator[]( int index );
510         void Insert( Where_rule_ptr, int index );
511         void Append( Where_rule_ptr );
512         void Remove( int index );
513         int Index( Where_rule_ptr );
514 
515         int Count();
516         void Clear();
517     private:
518         void Check( int index );
519     private:
520         Where_rule_ptr * _buf;
521         int _bufsize;
522         int _count;
523 };
524 
525 typedef Where_rule__list * Where_rule__list_ptr;
526 typedef Where_rule__list_ptr Where_rule__list_var;
527 
528 class SC_CORE_EXPORT Global_rule : public Dictionary_instance {
529     public:
530         Express_id _name;
531         Entity__set_var _entities; // not implemented
532         Where_rule__list_var _where_rules;
533         Schema_ptr _parent_schema;
534         std::string _rule_text; // non-SDAI
535 
536         Global_rule();
537         Global_rule( const char * n, Schema_ptr parent_sch, const std::string & rt );
538         Global_rule( Global_rule & ); // not fully implemented
539         virtual ~Global_rule();
540 
name_()541         Express_id name_() const {
542             return _name;
543         }
entities_()544         Entity__set_var entities_() const {
545             return _entities;
546         }
where_rules_()547         Where_rule__list_var where_rules_() const {
548             return _where_rules;
549         }
parent_schema_()550         Schema_ptr parent_schema_() const {
551             return _parent_schema;
552         }
rule_text_()553         const char * rule_text_() {
554             return _rule_text.c_str();
555         }
556 
name_(Express_id & n)557         void name_( Express_id & n ) {
558             _name = n;
559         }
560         void entities_( const Entity__set_var & e ); // not implemented
561         void where_rules_( const Where_rule__list_var & wrl ); // not implemented
parent_schema_(const Schema_ptr & s)562         void parent_schema_( const Schema_ptr & s ) {
563             _parent_schema = s;
564         }
rule_text_(const char * rt)565         void rule_text_( const char * rt ) {
566             _rule_text = rt;
567         }
568 
569 };
570 
571 typedef Global_rule * Global_rule_ptr;
572 
573 class SC_CORE_EXPORT Global_rule__set {
574     public:
575         Global_rule__set( int = 16 );
576         ~Global_rule__set();
577 
578         Global_rule_ptr & operator[]( int index );
579         void Insert( Global_rule_ptr, int index );
580         void Append( Global_rule_ptr );
581         void Remove( int index );
582         int Index( Global_rule_ptr );
583 
584         int Count();
585         void Clear();
586     private:
587         void Check( int index );
588     private:
589         Global_rule_ptr * _buf;
590         int _bufsize;
591         int _count;
592 };
593 
594 typedef Global_rule__set * Global_rule__set_ptr;
595 typedef Global_rule__set_ptr Global_rule__set_var;
596 
597 class SC_CORE_EXPORT Uniqueness_rule : public Dictionary_instance {
598     public:
599         Express_id _label;
600         const EntityDescriptor * _parent_entity;
601 
602         // non-SDAI
603         std::string _comment; // Comment contained in the EXPRESS.
604         // Should be properly formatted to include (* *)
605         // Will be written to EXPRESS as-is (w/out formatting)
606 
607         Uniqueness_rule();
608         Uniqueness_rule( const Uniqueness_rule & );
609         Uniqueness_rule( const char * label, EntityDescriptor * pe = 0 )
_label(label)610             : _label( label ), _parent_entity( pe ) { }
611         virtual ~Uniqueness_rule();
612 
label_()613         Express_id label_() const {
614             return _label;
615         }
parent_()616         const EntityDescriptor * parent_() const {
617             return _parent_entity;
618         }
comment_()619         std::string & comment_() {
620             return _comment;
621         }
622 
label_(const Express_id & ei)623         void label_( const Express_id & ei ) {
624             _label = ei;
625         }
parent_(const EntityDescriptor * pe)626         void parent_( const EntityDescriptor * pe ) {
627             _parent_entity = pe;
628         }
comment_(const char * c)629         void comment_( const char * c ) {
630             _comment = c;
631         }
632 
633 };
634 
635 typedef Uniqueness_rule * Uniqueness_rule_ptr;
636 
637 class SC_CORE_EXPORT Uniqueness_rule__set {
638     public:
639         Uniqueness_rule__set( int = 16 );
640         ~Uniqueness_rule__set();
641 
642         Uniqueness_rule_ptr & operator[]( int index );
643         void Insert( Uniqueness_rule_ptr, int index );
644         void Append( Uniqueness_rule_ptr );
645         void Remove( int index );
646         int Index( Uniqueness_rule_ptr );
647 
648         int Count();
649         void Clear();
650     private:
651         void Check( int index );
652     private:
653         Uniqueness_rule_ptr * _buf;
654         int _bufsize;
655         int _count;
656 };
657 
658 typedef Uniqueness_rule__set * Uniqueness_rule__set_ptr;
659 typedef Uniqueness_rule__set_ptr Uniqueness_rule__set_var;
660 
661 typedef  SDAI_Model_contents_ptr( * ModelContentsCreator )();
662 
663 /**
664  * \class Schema (was SchemaDescriptor) - a class of this type is generated and contains schema info.
665  */
666 class SC_CORE_EXPORT Schema : public Dictionary_instance {
667 
668     protected:
669         const char  * _name;
670         EntityDescriptorList _entList; // list of entities in the schema
671         EntityDescriptorList _entsWithInverseAttrs;
672         TypeDescriptorList _typeList; // list of types in the schema
673         TypeDescriptorList _unnamed_typeList; // list of unnamed types in the schema (for cleanup)
674         Interface_spec _interface; // list of USE and REF interfaces  (SDAI)
675 
676         // non-SDAI lists
677         Interface_spec__set_var _use_interface_list; // list of USE interfaces
678         Interface_spec__set_var _ref_interface_list; // list of REFERENCE interfaces
679         std::vector< std::string > _function_list; // of EXPRESS functions
680         std::vector< std::string > _procedure_list; // of EXPRESS procedures
681 
682         Global_rule__set_var _global_rules;
683 
684     public:
685         ModelContentsCreator CreateNewModelContents;
686 
687         Schema( const char * schemaName );
688         virtual ~Schema();
689 
690         void AssignModelContentsCreator( ModelContentsCreator f = 0 ) {
691             CreateNewModelContents = f;
692         }
693 
Name()694         const char * Name() const   {
695             return _name;
696         }
Name(const char * n)697         void Name( const char  * n )  {
698             _name = n;
699         }
700 
interface_()701         Interface_spec & interface_() {
702             return _interface;
703         }
704 
use_interface_list_()705         Interface_spec__set_var use_interface_list_() {
706             return
707                 _use_interface_list;
708         }
709 
ref_interface_list_()710         Interface_spec__set_var ref_interface_list_() {
711             return _ref_interface_list;
712         }
713 
function_list_()714         std::vector< std::string > function_list_() {
715             return _function_list;
716         }
717 
718         void AddFunction( const std::string & f );
719 
global_rules_()720         Global_rule__set_var global_rules_() { // const
721             return _global_rules;
722         }
723 
724         void AddGlobal_rule( Global_rule_ptr gr );
725 
726         void global_rules_( Global_rule__set_var & grs ); // not implemented
727 
procedure_list_()728         std::vector< std::string > procedure_list_() {
729             return _procedure_list;
730         }
731 
732         void AddProcedure( const std::string & p );
733 
AddEntity(EntityDescriptor * ed)734         EntityDescLinkNode * AddEntity( EntityDescriptor * ed ) {
735             return _entList.AddNode( ed );
736         }
737         /// must be called in addition to AddEntity()
AddEntityWInverse(EntityDescriptor * ed)738         EntityDescLinkNode * AddEntityWInverse( EntityDescriptor * ed ) {
739             return _entsWithInverseAttrs.AddNode( ed );
740         }
741 
AddType(TypeDescriptor * td)742         TypeDescLinkNode * AddType( TypeDescriptor * td ) {
743             return _typeList.AddNode( td );
744         }
AddUnnamedType(TypeDescriptor * td)745         TypeDescLinkNode * AddUnnamedType( TypeDescriptor * td ) {
746             return _unnamed_typeList.AddNode( td );
747         }
748 
Entities()749         const EntityDescriptorList * Entities() const {
750             return & _entList;
751         }
EntsWInverse()752         const EntityDescriptorList * EntsWInverse() const {
753             return & _entsWithInverseAttrs;
754         }
Types()755         const TypeDescriptorList * Types() const {
756             return & _typeList;
757         }
UnnamedTypes()758         const TypeDescriptorList * UnnamedTypes() const {
759             return & _unnamed_typeList;
760         }
Entities()761         EntityDescriptorList * Entities() {
762             return & _entList;
763         }
EntsWInverse()764         EntityDescriptorList * EntsWInverse() {
765             return & _entsWithInverseAttrs;
766         }
Types()767         TypeDescriptorList * Types() {
768             return & _typeList;
769         }
UnnamedTypes()770         TypeDescriptorList * UnnamedTypes() {
771             return & _unnamed_typeList;
772         }
773 
774         // the whole schema
775         void GenerateExpress( ostream & out ) const;
776 
777         // USE, REFERENCE definitions
778         void GenerateUseRefExpress( ostream & out ) const;
779 
780         // TYPE definitions
781         void GenerateTypesExpress( ostream & out ) const;
782 
783         // Entity definitions
784         void GenerateEntitiesExpress( ostream & out ) const;
785 };
786 
787 typedef Schema SchemaDescriptor;
788 
789 ///////////////////////////////////////////////////////////////////////////////
790 
791 class SC_CORE_EXPORT AttrDescLinkNode : public SingleLinkNode {
792     private:
793     protected:
794         AttrDescriptor * _attrDesc;
795     public:
796         AttrDescLinkNode();
797         virtual ~AttrDescLinkNode();
798 
AttrDesc()799         const AttrDescriptor * AttrDesc() const {
800             return _attrDesc;
801         }
AttrDesc(AttrDescriptor * ad)802         void AttrDesc( AttrDescriptor * ad ) {
803             _attrDesc = ad;
804         }
805 };
806 
807 class SC_CORE_EXPORT AttrDescriptorList : public SingleLinkList {
808     private:
809     protected:
810     public:
811         AttrDescriptorList();
812         virtual ~AttrDescriptorList();
813 
NewNode()814         virtual SingleLinkNode * NewNode() {
815             return new AttrDescLinkNode;
816         }
817 
818         AttrDescLinkNode * AddNode( AttrDescriptor * ad );
819 };
820 
821 class SC_CORE_EXPORT AttrDescItr {
822     protected:
823         const AttrDescriptorList & adl;
824         const AttrDescLinkNode * cur;
825 
826     public:
827         AttrDescItr( const AttrDescriptorList & adList );
828         virtual ~AttrDescItr();
829 
ResetItr()830         void ResetItr() {
831             cur = ( AttrDescLinkNode * )( adl.GetHead() );
832         }
833 
834         const AttrDescriptor * NextAttrDesc();
835 };
836 
837 ///////////////////////////////////////////////////////////////////////////////
838 
839 class SC_CORE_EXPORT Inverse_attributeLinkNode : public  SingleLinkNode {
840     private:
841     protected:
842         Inverse_attribute * _invAttr;
843     public:
844         Inverse_attributeLinkNode();
845         virtual ~Inverse_attributeLinkNode();
846 
Inverse_attr()847         Inverse_attribute * Inverse_attr() const {
848             return _invAttr;
849         }
Inverse_attr(Inverse_attribute * ia)850         void Inverse_attr( Inverse_attribute * ia ) {
851             _invAttr = ia;
852         }
853 };
854 
855 class SC_CORE_EXPORT Inverse_attributeList : public  SingleLinkList {
856     private:
857     protected:
NewNode()858         virtual SingleLinkNode * NewNode() {
859             return new Inverse_attributeLinkNode;
860         }
861     public:
862         Inverse_attributeList();
863         virtual ~Inverse_attributeList();
864         Inverse_attributeLinkNode * AddNode( Inverse_attribute * ia );
865 };
866 
867 class SC_CORE_EXPORT InverseAItr {
868     protected:
869         const Inverse_attributeList * ial;
870         const Inverse_attributeLinkNode * cur;
871 
872     public:
873         InverseAItr( const Inverse_attributeList * iaList );
874         virtual ~InverseAItr();
875 
876         void ResetItr( const Inverse_attributeList * iaList = 0 ) {
877             if( iaList ) {
878                 ial = iaList;
879             }
880             cur = ( Inverse_attributeLinkNode * )( ial->GetHead() );
881         }
882 
883         Inverse_attribute * NextInverse_attribute();
884 };
885 
886 /**
887  * \class AttrDescriptor
888  * An instance of this class will be generated for each attribute for
889  * an Entity.  They will be pointed to by the EntityTypeDescriptors.
890  */
891 class SC_CORE_EXPORT AttrDescriptor {
892 
893     protected:
894         const char  * _name;   // the attributes name
895         // this defines the domain of the attribute
896         const TypeDescriptor * _domainType;
897         SDAI_LOGICAL _optional;
898         SDAI_LOGICAL _unique;
899         AttrType_Enum _attrType; // former attribute _derived
900         const EntityDescriptor & _owner;  // the owning entityDescriptor
901     public:
902 
903         AttrDescriptor(
904             const char * name,       // i.e. char *
905             const TypeDescriptor * domainType,
906             Logical optional,    // i.e. F U or T
907             Logical unique,  // i.e. F U or T
908             AttrType_Enum at,// AttrType_Explicit, AttrType_Inverse,
909             // AttrType_Deriving,AttrType_Redefining
910             const EntityDescriptor & owner
911         );
912         virtual ~AttrDescriptor();
913 
914         const char * GenerateExpress( std::string & buf ) const;
915 
916         // the attribute Express def
917         virtual const char * AttrExprDefStr( std::string & s ) const;
918 
919         // left side of attr def
Name()920         const char * Name() const      {
921             return _name;
922         }
Name(const char * n)923         void     Name( const char  * n ) {
924             _name = n;
925         }
926 
927         /** BaseType() is the underlying type of this attribute.
928          * NonRefType() is the first non REFERENCE_TYPE type
929          * e.g. Given attributes of each of the following types
930          * TYPE count = INTEGER;
931          * TYPE ref_count = count;
932          * TYPE count_set = SET OF ref_count;
933          *  BaseType() will return INTEGER_TYPE for an attr of each type.
934          *  BaseTypeDescriptor() returns the TypeDescriptor for Integer
935          *  NonRefType() will return INTEGER_TYPE for the first two. For an
936          *    attribute of type count_set NonRefType() would return
937          *    AGGREGATE_TYPE
938          *  NonRefTypeDescriptor() returns the TypeDescriptor for Integer
939          *     for the first two and a TypeDescriptor for an
940          *     aggregate for the last.
941          *
942          * \sa NonRefType()
943          * \sa NonRefTypeDescriptor()
944          */
945         ///@{
946         PrimitiveType BaseType() const;
947         const TypeDescriptor * BaseTypeDescriptor() const;
948         ///@}
949 
950         /**
951          * the first PrimitiveType that is not REFERENCE_TYPE (the first
952          * TypeDescriptor *_referentType that does not have REFERENCE_TYPE
953          * for it's fundamentalType variable).  This would return the same
954          * as BaseType() for fundamental types.  An aggregate type
955          * would return AGGREGATE_TYPE then you could find out the type of
956          * an element by calling AggrElemType().  Select types
957          * would work the same?
958          *
959          * \sa BaseType()
960          */
961         ///@{
962         PrimitiveType NonRefType() const;
963         const TypeDescriptor * NonRefTypeDescriptor() const;
964         ///@}
965 
966         int   IsAggrType() const;
967         PrimitiveType   AggrElemType() const;
968         const TypeDescriptor * AggrElemTypeDescriptor() const;
969 
970         // The type of the attributes TypeDescriptor
971         PrimitiveType Type() const;
972         const char * TypeName() const;  // right side of attr def
973 
974         // an expanded right side of attr def
975         const char * ExpandedTypeName( std::string & s ) const;
976 
RefersToType()977         int RefersToType() const    {
978             return !( _domainType == 0 );
979         }
980 
ReferentType()981         const TypeDescriptor * ReferentType() const {
982             return _domainType;
983         }
DomainType()984         const TypeDescriptor * DomainType() const {
985             return _domainType;
986         }
DomainType(const TypeDescriptor * td)987         void DomainType( const TypeDescriptor * td )  {
988             _domainType = td;
989         }
ReferentType(const TypeDescriptor * td)990         void ReferentType( const TypeDescriptor * td ) {
991             _domainType = td;
992         }
993 
Optional()994         const SDAI_LOGICAL & Optional() const {
995             return _optional;
996         }
Optional(SDAI_LOGICAL & opt)997         void Optional( SDAI_LOGICAL & opt ) {
998             _optional.put( opt.asInt() );
999         }
1000 
Optional(Logical opt)1001         void Optional( Logical opt ) {
1002             _optional.put( opt );
1003         }
Optional(const char * opt)1004         void Optional( const char * opt ) {
1005             _optional.put( opt );
1006         }
1007 
Unique()1008         const SDAI_LOGICAL & Unique() const {
1009             return _unique;
1010         }
Unique(SDAI_LOGICAL uniq)1011         void Unique( SDAI_LOGICAL uniq ) {
1012             _unique.put( uniq.asInt() );
1013         }
Unique(Logical uniq)1014         void Unique( Logical uniq ) {
1015             _unique.put( uniq );
1016         }
Unique(const char * uniq)1017         void Unique( const char * uniq )  {
1018             _unique.put( uniq );
1019         }
1020 
AttrType(enum AttrType_Enum ate)1021         void AttrType( enum AttrType_Enum ate ) {
1022             _attrType = ate;
1023         }
AttrType()1024         enum AttrType_Enum AttrType() const {
1025             return _attrType;
1026         }
1027 
1028         Logical Explicit() const;
1029         Logical Inverse() const;
1030         Logical Redefining() const;
1031         Logical Deriving() const;
1032 
1033         //outdated functions, use AttrType func above, new support of redefined
Derived()1034         Logical Derived() const {
1035             return Deriving();
1036         }
1037         void Derived( Logical x );    // outdated DAS
1038         void Derived( SDAI_LOGICAL x ); // outdated DAS
1039         void Derived( const char * x ); // outdated DAS
1040 
Optionality()1041         const SDAI_LOGICAL & Optionality() const {
1042             return _optional;
1043         }
Optionality(SDAI_LOGICAL & opt)1044         void Optionality( SDAI_LOGICAL & opt ) {
1045             _optional.put( opt.asInt() );
1046         }
Optionality(Logical opt)1047         void Optionality( Logical opt ) {
1048             _optional.put( opt );
1049         }
Optionality(const char * opt)1050         void Optionality( const char * opt ) {
1051             _optional.put( opt );
1052         }
1053 
Uniqueness()1054         const SDAI_LOGICAL & Uniqueness() const {
1055             return _unique;
1056         }
Uniqueness(SDAI_LOGICAL uniq)1057         void Uniqueness( SDAI_LOGICAL uniq ) {
1058             _unique.put( uniq.asInt() );
1059         }
Uniqueness(Logical uniq)1060         void Uniqueness( Logical uniq ) {
1061             _unique.put( uniq );
1062         }
Uniqueness(const char * uniq)1063         void Uniqueness( const char * uniq ) {
1064             _unique.put( uniq );
1065         }
1066 
Owner()1067         const EntityDescriptor & Owner() const {
1068             return _owner;
1069         }
1070 };
1071 
1072 
1073 ///////////////////////////////////////////////////////////////////////////////
1074 // Derived_attribute
1075 ///////////////////////////////////////////////////////////////////////////////
1076 
1077 class SC_CORE_EXPORT Derived_attribute  :    public AttrDescriptor  {
1078     public:
1079         const char * _initializer;
1080 
1081         Derived_attribute(
1082             const char * name,                // i.e. char *
1083             const TypeDescriptor * domainType,
1084             Logical optional,        // i.e. F U or T
1085             Logical unique,        // i.e. F U or T
1086             AttrType_Enum at,// AttrType_Explicit, AttrType_Inverse,
1087             // AttrType_Deriving,AttrType_Redefining
1088             const EntityDescriptor & owner
1089         );
1090         virtual ~Derived_attribute();
1091         const char * AttrExprDefStr( std::string & s ) const;
1092 
initializer_()1093         const char * initializer_() {
1094             return _initializer;
1095         }
initializer_(const char * i)1096         void initializer_( const char * i ) {
1097             _initializer = i;
1098         }
1099 };
1100 
1101 ///////////////////////////////////////////////////////////////////////////////
1102 // Inverse_attribute
1103 ///////////////////////////////////////////////////////////////////////////////
1104 
1105 class SC_CORE_EXPORT Inverse_attribute  :    public AttrDescriptor  {
1106 
1107     public:
1108         const char * _inverted_attr_id;
1109         const char * _inverted_entity_id;
1110     protected:
1111         const AttrDescriptor * _inverted_attr; // not implemented (?!) (perhaps this means "not used"?)
1112     public:
1113 
1114         Inverse_attribute(
1115             const char * name,                // i.e. char *
1116             TypeDescriptor * domainType,
1117             Logical optional,        // i.e. F U or T*/
1118             Logical unique,        // i.e. F U or T
1119             const EntityDescriptor & owner,
1120             const char * inverted_attr_id = 0
AttrDescriptor(name,domainType,optional,unique,AttrType_Inverse,owner)1121         ) : AttrDescriptor( name, domainType, optional, unique,
1122                                 AttrType_Inverse, owner ),
1123             _inverted_attr_id( inverted_attr_id ),
1124             _inverted_entity_id( 0 ), _inverted_attr( 0 )
1125         { }
~Inverse_attribute()1126         virtual ~Inverse_attribute() { }
1127 
1128         const char * AttrExprDefStr( std::string & s ) const;
1129 
inverted_attr_id_()1130         const char * inverted_attr_id_() const {
1131             return _inverted_attr_id;
1132         }
1133 
inverted_attr_id_(const char * iai)1134         void inverted_attr_id_( const char * iai ) {
1135             _inverted_attr_id = iai;
1136         }
1137 
inverted_entity_id_()1138         const char * inverted_entity_id_() const {
1139             return _inverted_entity_id;
1140         }
1141 
inverted_entity_id_(const char * iei)1142         void inverted_entity_id_( const char * iei ) {
1143             _inverted_entity_id = iei;
1144         }
1145 
1146         /// FIXME not implemented (?!) (perhaps this means "not set"?)
1147         //set _inverted_attr in an extra init step in generated code? any other way to ensure pointers are valid?
inverted_attr_()1148         const class AttrDescriptor * inverted_attr_() const {
1149                 return _inverted_attr;
1150         }
1151 
inverted_attr_(const AttrDescriptor * ia)1152         void inverted_attr_( const AttrDescriptor * ia ) {
1153             _inverted_attr = ia;
1154         }
1155 
1156         // below are obsolete (and not implemented anyway)
1157 //         class AttrDescriptor * InverseAttribute() {
1158 //                 return _inverted_attr;
1159 //         }
1160 //         void InverseOf( AttrDescriptor * invAttr ) {
1161 //             _inverted_attr = invAttr;
1162 //         }
1163 };
1164 
1165 /** \class SchRename
1166  * SchRename is a structure which partially support the concept of USE and RE-
1167  * FERENCE in EXPRESS.  Say schema A USEs object X from schema B and renames it
1168  * to Y (i.e., "USE (X as Y);").  SchRename stores the name of the schema (B)
1169  * plus the new object name for that schema (Y).  Each TypeDescriptor has a
1170  * SchRename object (actually a linked list of SchRenames) corresponding to all
1171  * the possible different names of itself depending on the current schema (the
1172  * schema which is currently reading or writing this object).  (The current
1173  * schema is determined by the file schema section of the header section of a
1174  * part21 file (the _headerInstances of STEPfile).
1175  */
1176 class SC_CORE_EXPORT SchRename {
1177     public:
1178         SchRename( const char * sch = "\0", const char * newnm = "\0" ) : next( 0 ) {
1179             strcpy( schName, sch );
1180             strcpy( newName, newnm );
1181         }
~SchRename()1182         ~SchRename() {
1183             delete next;
1184         }
objName()1185         const char * objName() const {
1186             return newName;
1187         }
1188         int operator< ( SchRename & schrnm ) {
1189             return ( strcmp( schName, schrnm.schName ) < 0 );
1190         }
1191         bool choice( const char * nm ) const;
1192         // is nm one of our possible choices?
1193         char * rename( const char * schm, char * newnm ) const;
1194         // given a schema name, returns new object name if exists
1195         SchRename * next;
1196 
1197     private:
1198         char schName[BUFSIZ];
1199         char newName[BUFSIZ];
1200 };
1201 
1202 /**
1203  * TypeDescriptor
1204  * This class and the classes inherited from this class are used to describe
1205  * all types (base types and created types).  There will be an instance of this
1206  * class generated for each type found in the schema.
1207  * A TypeDescriptor will be generated in three contexts:
1208  * 1) to describe a base type - e.g. INTEGER, REAL, STRING.  There is only one
1209  *        TypeDescriptor created for each Express base type. Each of these will
1210  *        be pointed to by several other AttrDescriptors and TypeDescriptors)
1211  * 2) to describe a type created by an Express TYPE statement.
1212  *        e.g. TYPE label = STRING END_TYPE;
1213  *        These TypeDescriptors will be pointed to by other AttrDescriptors (and
1214  *        TypeDescriptors) representing attributes (and Express TYPEs) that are
1215  *        of the type created by this Express TYPE.
1216  * 3) to describe a type created in an attribute definition
1217  *        e.g. part_label_grouping : ARRAY [1.10] label;
1218  *        or part_codes : ARRAY [1.10] INTEGER;
1219  *        In this #3 context there will not be a name associated with the type.
1220  *        The TypeDescriptor created in this case will only be pointed to by the
1221  *        single AttrDescriptor associated with the attribute it was created for.
1222  *
1223  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1224  *
1225  * \var _name
1226     * \brief the name of the type.
1227     * In the case of the TypeDescriptors representing the Express base
1228     * types this will be the name of the base type.
1229     * In the case where this TypeDescriptor is representing an Express
1230     * TYPE it is the LEFT side of an Express TYPE statement (i.e. label
1231     * as in TYPE label = STRING END_TYPE;) This name would in turn be
1232     * found on the RIGHT side of an Express attribute definition (e.g.
1233     * attr defined as part_label : label; )
1234     * In the case where this TypeDescriptor was generated to describe a
1235     * type created in an attr definition, it will be a null pointer (e.g
1236     * attr defined as part_label_grouping : ARRAY [1..10] label)
1237  * \var _fundamentalType
1238     *  the 'type' of the type being represented by
1239     *  the TypeDescriptor . i.e. the following 2 stmts
1240     *  would cause 2 TypeDescriptors to be generated - the 1st having
1241     *  _fundamentalType set to STRING_TYPE and for the 2nd to
1242     *  REFERENCE_TYPE.
1243     * TYPE label = STRING END_TYPE;
1244     * TYPE part_label = label END_TYPE;
1245     * part_label and label would be the value of the respective
1246     * _name member variables for the 2 TypeDescriptors.
1247  * \var _referentType
1248     * will point at another TypeDescriptor furthur specifying
1249     *  the type in all cases except when the type is directly
1250     *  an enum or select.  i.e. in the following... _referentType for
1251     *  the 1st type does not point at anything and for the 2nd it does:
1252     * TYPE color = ENUMERATION OF (red, blue); END_TYPE;
1253     * TYPE color_ref = color; END_TYPE;
1254  ** var _fundamentalType
1255     * being REFERENCE_TYPE (as would be the case for
1256     * part_label and color_ref above) means that the _referentType
1257     * member variable points at a TypeDescriptor representing a type
1258     * that has been defined in an Express TYPE stmt.
1259     *  Otherwise _fundamental type reflects
1260     *  the type directly as in the type label above.  type label above
1261     *  has a _referentType that points at a TypeDescriptor for STRING
1262     *  described in the next sentence (also see #1 above).
1263     * A TypeDescriptor would be generated for each of the EXPRESS base
1264     * types (int, string, real, etc) having _fundamentalType member
1265     * variables set to match the EXPRESS base type being represented.
1266  ** var _referentType
1267     * For the TypeDescriptors describing the EXPRESS base types this will
1268     * be a null pointer.  For all other TypeDescriptors this will point
1269     * to another TypeDescriptor which furthur describes the type. e.g.
1270     * TYPE part_label = label END_TYPE; TYPE label = STRING END_TYPE;
1271     * part_label's _referentType will point to the TypeDescriptor for
1272     * label.  label's _referentType will point to the TypeDescriptor
1273     * for STRING. The _fundamentalType for part_label will be
1274     * REFERENCE_TYPE and for label will be STRING_TYPE.
1275     * The _fundamentalType for the EXPRESS base type STRING's
1276     * TypeDescriptor will be STRING_TYPE.
1277     * The _referentType member variable will in most cases point to
1278     * a subtype of TypeDescriptor.
1279  * \var _description
1280     * This is the string description of the type as found in the
1281     * EXPRESS file. e.g. aggr of [aggr of ...] [list of ...] someType
1282     * It is the RIGHT side of an Express TYPE statement
1283     * (i.e. LIST OF STRING as in
1284     * TYPE label_group = LIST OF STRING END_TYPE;)
1285     * It is the same as _name for EXPRESS base types TypeDescriptors (with
1286     * the possible exception of upper or lower case differences).
1287 */
1288 class SC_CORE_EXPORT TypeDescriptor {
1289 
1290     protected:
1291 
1292         // the name of the type (see above)
1293         //
1294         // NOTE - memory is not allocated for this, or for _description
1295         // below.  It is assumed that at creation, _name will be made
1296         // to point to a static location in memory.  The exp2cxx
1297         // generated code, for example, places a literal string in its
1298         // TypeDesc constructor calls.  This creates a location in me-
1299         // mory static throughout the lifetime of the calling program.
1300         const char  * _name ;
1301 
1302         // an alternate name of type - such as one given by a different
1303         // schema which USEs/ REFERENCEs this.  (A complete list of
1304         // alternate names is stored in altNames below.  _altname pro-
1305         // vides storage space for the currently used one.)
1306         char _altname[BUFSIZ];
1307 
1308         // contains list of renamings of type - used by other schemas
1309         // which USE/ REFERENCE this
1310         const SchRename * altNames;
1311 
1312         // the type of the type (see above).
1313         // it is an enum see file clstepcore/baseType.h
1314         PrimitiveType _fundamentalType;
1315 
1316         const Schema * _originatingSchema;
1317 
1318         // further describes the type (see above)
1319         // most often (or always) points at a subtype.
1320         const TypeDescriptor * _referentType;
1321 
1322         // Express file description (see above)
1323         // e.g. the right side of an Express TYPE stmt
1324         // (See note above by _name regarding memory allocation.)
1325         const char  * _description;
1326 
1327     public:
1328         // a Where_rule may contain only a comment
1329         Where_rule__list_var _where_rules; // initially a null pointer
1330 
where_rules_()1331         Where_rule__list_var & where_rules_() {
1332             return _where_rules;
1333         }
1334 
where_rules_(Where_rule__list * wrl)1335         void where_rules_( Where_rule__list * wrl ) {
1336             _where_rules = wrl;
1337         }
1338 
1339     protected:
1340         // Functions used to check the current name of the type (may
1341         // != _name if altNames has diff name for current schema).
1342         bool PossName( const char * ) const;
1343         bool OurName( const char * ) const;
1344         bool AltName( const char * ) const;
1345 
1346     public:
1347 
1348         TypeDescriptor( const char * nm, PrimitiveType ft, const char * d );
1349         TypeDescriptor( const char * nm, PrimitiveType ft,
1350                         Schema * origSchema, const char * d );
1351         TypeDescriptor( );
1352         virtual ~TypeDescriptor();
1353 
1354         virtual const char * GenerateExpress( std::string & buf ) const;
1355 
1356         // The name of this type.  If schnm != NULL, the name we're
1357         // referred to by schema schnm (may be diff name in our alt-
1358         // names list (based on schnm's USE/REF list)).
1359         const char * Name( const char * schnm = NULL ) const;
1360 
1361         // The name that would be found on the right side of an
1362         // attribute definition. In the case of a type defined like
1363         // TYPE name = STRING END_TYPE;
1364         // with attribute definition   employee_name : name;
1365         // it would be the _name member variable. If it was a type
1366         // defined in an attribute it will be the _description
1367         // member variable since _name will be null. e.g. attr. def.
1368         // project_names : ARRAY [1..10] name;
1369         const char * AttrTypeName( std::string & buf, const char * schnm = NULL ) const;
1370 
1371         // Linked link of alternate names for the type:
AltNameList()1372         const SchRename * AltNameList() const {
1373             return altNames;
1374         }
1375 
1376         // This is a fully expanded description of the type.
1377         // This returns a string like the _description member variable
1378         // except it is more thorough of a description where possible
1379         // e.g. if the description contains a TYPE name it will also
1380         // be explained.
1381         const char * TypeString( std::string & s ) const;
1382 
1383         // This TypeDescriptor's type
Type()1384         PrimitiveType Type() const {
1385             return _fundamentalType;
1386         }
Type(const PrimitiveType type)1387         void Type( const PrimitiveType type ) {
1388             _fundamentalType = type;
1389         }
1390 
1391         // This is the underlying Express base type of this type. It will
1392         // be the type of the last TypeDescriptor following the
1393         // _referentType member variable pointers. e.g.
1394         // TYPE count = INTEGER;
1395         // TYPE ref_count = count;
1396         // TYPE count_set = SET OF ref_count;
1397         //  each of the above will generate a TypeDescriptor and for
1398         //  each one, PrimitiveType BaseType() will return INTEGER_TYPE.
1399         //  TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
1400         //  for Integer.
1401         PrimitiveType       BaseType() const;
1402         const TypeDescriptor * BaseTypeDescriptor() const;
1403         const char * BaseTypeName() const;
1404 
1405         // the first PrimitiveType that is not REFERENCE_TYPE (the first
1406         // TypeDescriptor *_referentType that does not have REFERENCE_TYPE
1407         // for it's fundamentalType variable).  This would return the same
1408         // as BaseType() for fundamental types.  An aggregate type
1409         // would return AGGREGATE_TYPE then you could find out the type of
1410         // an element by calling AggrElemType().  Select types
1411         // would work the same?
1412 
1413         PrimitiveType   NonRefType() const;
1414         const TypeDescriptor * NonRefTypeDescriptor() const;
1415 
1416         int   IsAggrType() const;
1417         PrimitiveType   AggrElemType() const;
1418         const TypeDescriptor * AggrElemTypeDescriptor() const;
1419 
FundamentalType()1420         PrimitiveType FundamentalType() const {
1421             return _fundamentalType;
1422         }
FundamentalType(PrimitiveType ftype)1423         void FundamentalType( PrimitiveType ftype ) {
1424             _fundamentalType = ftype;
1425         }
1426 
1427         // The TypeDescriptor for the type this type is based on
ReferentType()1428         const TypeDescriptor * ReferentType() const {
1429             return _referentType;
1430         }
ReferentType(const TypeDescriptor * rtype)1431         void ReferentType( const TypeDescriptor * rtype ) {
1432             _referentType = rtype;
1433         }
1434 
1435 
OriginatingSchema()1436         const Schema * OriginatingSchema()  const {
1437             return _originatingSchema;
1438         }
OriginatingSchema(const Schema * os)1439         void OriginatingSchema( const Schema * os ) {
1440             _originatingSchema = os;
1441         }
schemaName()1442         const char * schemaName() const {
1443             if( _originatingSchema ) {
1444                 return _originatingSchema->Name();
1445             } else {
1446                 return "";
1447             }
1448         }
1449 
1450         // A description of this type's type. Basically you
1451         // get the right side of a TYPE statement minus END_TYPE.
1452         // For base type TypeDescriptors it is the same as _name.
Description()1453         const char * Description() const    {
1454             return _description;
1455         }
Description(const char * desc)1456         void Description( const char * desc ) {
1457             _description = desc;
1458         }
1459 
1460         virtual const TypeDescriptor * IsA( const TypeDescriptor * ) const;
1461         virtual const TypeDescriptor * BaseTypeIsA( const TypeDescriptor * )
1462         const;
1463         virtual const TypeDescriptor * IsA( const char * ) const;
CanBe(const TypeDescriptor * n)1464         virtual const TypeDescriptor * CanBe( const TypeDescriptor * n ) const {
1465             return IsA( n );
1466         }
CanBe(const char * n)1467         virtual const TypeDescriptor * CanBe( const char * n ) const {
1468             return IsA( n );
1469         }
1470         virtual const TypeDescriptor * CanBeSet( const char * n,
1471                 const char * schNm = 0 ) const {
1472             return ( CurrName( n, schNm ) ? this : 0 );
1473         }
1474         bool CurrName( const char *, const char * = 0 ) const;
1475         void addAltName( const char * schnm, const char * newnm );
1476         // Adds an additional name, newnm, to be use when schema schnm
1477         // is USE/REFERENCE'ing us (added to altNames).
1478 };
1479 
1480 typedef SDAI_Enum * ( * EnumCreator )();
1481 
1482 class SC_CORE_EXPORT EnumTypeDescriptor  :    public TypeDescriptor  {
1483     public:
1484         EnumCreator CreateNewEnum;
1485 
1486         const char * GenerateExpress( std::string & buf ) const;
1487 
1488         void AssignEnumCreator( EnumCreator f = 0 ) {
1489             CreateNewEnum = f;
1490         }
1491 
1492         SDAI_Enum * CreateEnum();
1493 
EnumTypeDescriptor()1494         EnumTypeDescriptor( ) { }
1495         EnumTypeDescriptor( const char * nm, PrimitiveType ft,
1496                             Schema * origSchema, const char * d,
1497                             EnumCreator f = 0 );
1498 
~EnumTypeDescriptor()1499         virtual ~EnumTypeDescriptor() { }
1500 };
1501 
1502 
1503 
1504 /**
1505  * EntityDescriptor
1506  * An instance of this class will be generated for each entity type
1507  * found in the schema.  This should probably be derived from the
1508  * CreatorEntry class (see sdaiApplicaton_instance.h).  Then the binary tree
1509  * that the current software  builds up containing the entities in the schema
1510  * will be building the same thing but using the new schema info.
1511  * nodes (i.e. EntityDesc nodes) for each entity.
1512  */
1513 
1514 class Registry;
1515 
1516 class SC_CORE_EXPORT EntityDescriptor  :    public TypeDescriptor  {
1517 
1518     protected:
1519         //used in InitIAttrs so we don't have to #include registry.h
1520 
1521         SDAI_LOGICAL _abstractEntity;
1522         SDAI_LOGICAL _extMapping;
1523         // does external mapping have to be used to create an instance of
1524         // us (see STEP Part 21, sect 11.2.5.1)
1525 
1526         EntityDescriptorList _subtypes;   // OPTIONAL
1527         EntityDescriptorList _supertypes; // OPTIONAL
1528         AttrDescriptorList _explicitAttr; // OPTIONAL
1529         Inverse_attributeList _inverseAttr;  // OPTIONAL
1530         std::string _supertype_stmt;
1531     public:
1532         Uniqueness_rule__set_var _uniqueness_rules; // initially a null pointer
1533 
1534         // pointer to a function that will create a new instance of a SDAI_Application_instance
1535         Creator NewSTEPentity;
1536 
1537         EntityDescriptor( );
1538         EntityDescriptor( const char * name, // i.e. char *
1539                           Schema * origSchema,
1540                           Logical abstractEntity, // i.e. F U or T
1541                           Logical extMapping,
1542                           Creator f = 0
1543                         );
1544 
1545         virtual ~EntityDescriptor();
1546 
1547         void InitIAttrs( Registry & reg, const char * schNm );
1548 
1549         const char * GenerateExpress( std::string & buf ) const;
1550 
1551         const char * QualifiedName( std::string & s ) const;
1552 
AbstractEntity()1553         const SDAI_LOGICAL & AbstractEntity() const {
1554             return _abstractEntity;
1555         }
ExtMapping()1556         const SDAI_LOGICAL & ExtMapping() const   {
1557             return _extMapping;
1558         }
AbstractEntity(SDAI_LOGICAL & ae)1559         void AbstractEntity( SDAI_LOGICAL & ae ) {
1560             _abstractEntity.put( ae.asInt() );
1561         }
ExtMapping(SDAI_LOGICAL & em)1562         void ExtMapping( SDAI_LOGICAL & em ) {
1563             _extMapping.put( em.asInt() );
1564         }
AbstractEntity(Logical ae)1565         void AbstractEntity( Logical ae ) {
1566             _abstractEntity.put( ae );
1567         }
ExtMapping(Logical em)1568         void ExtMapping( Logical em ) {
1569             _extMapping.put( em );
1570         }
ExtMapping(const char * em)1571         void ExtMapping( const char * em )    {
1572             _extMapping.put( em );
1573         }
1574 
Subtypes()1575         const EntityDescriptorList & Subtypes() const {
1576             return _subtypes;
1577         }
1578 
Supertypes()1579         const EntityDescriptorList & Supertypes() const {
1580             return _supertypes;
1581         }
1582 
GetSupertypes()1583         const EntityDescriptorList & GetSupertypes()  const {
1584             return _supertypes;
1585         }
1586 
ExplicitAttr()1587         const AttrDescriptorList & ExplicitAttr() const {
1588             return _explicitAttr;
1589         }
1590 
InverseAttr()1591         const Inverse_attributeList & InverseAttr() const {
1592             return _inverseAttr;
1593         }
1594 
1595         virtual const EntityDescriptor * IsA( const EntityDescriptor * ) const;
1596         virtual const TypeDescriptor * IsA( const TypeDescriptor * td ) const;
IsA(const char * n)1597         virtual const TypeDescriptor * IsA( const char * n ) const {
1598             return TypeDescriptor::IsA( n );
1599         }
CanBe(const TypeDescriptor * o)1600         virtual const TypeDescriptor * CanBe( const TypeDescriptor * o ) const {
1601             return o -> IsA( this );
1602         }
1603 
CanBe(const char * n)1604         virtual const TypeDescriptor * CanBe( const char * n ) const {
1605             return TypeDescriptor::CanBe( n );
1606         }
1607 
1608         // The following will be used by schema initialization functions
1609 
AddSubtype(EntityDescriptor * ed)1610         void AddSubtype( EntityDescriptor * ed ) {
1611             _subtypes.AddNode( ed );
1612         }
AddSupertype_Stmt(const std::string & s)1613         void AddSupertype_Stmt( const std::string & s ) {
1614             _supertype_stmt = s;
1615         }
Supertype_Stmt()1616         const char * Supertype_Stmt() {
1617             return _supertype_stmt.c_str();
1618         }
supertype_stmt_()1619         std::string & supertype_stmt_() {
1620             return _supertype_stmt;
1621         }
1622 
AddSupertype(EntityDescriptor * ed)1623         void AddSupertype( EntityDescriptor * ed ) {
1624             _supertypes.AddNode( ed );
1625         }
1626 
AddExplicitAttr(AttrDescriptor * ad)1627         void AddExplicitAttr( AttrDescriptor * ad ) {
1628             _explicitAttr.AddNode( ad );
1629         }
1630 
AddInverseAttr(Inverse_attribute * ia)1631         void AddInverseAttr( Inverse_attribute * ia ) {
1632             _inverseAttr.AddNode( ia );
1633         }
uniqueness_rules_(Uniqueness_rule__set * urs)1634         void uniqueness_rules_( Uniqueness_rule__set * urs ) {
1635             _uniqueness_rules = urs;
1636         }
uniqueness_rules_()1637         Uniqueness_rule__set_var & uniqueness_rules_() {
1638             return _uniqueness_rules;
1639         }
1640 
1641 };
1642 
1643 /** \class EnumerationTypeDescriptor
1644  * FIXME not implemented
1645 */
1646 #ifdef NOT_YET
1647 class SC_CORE_EXPORT EnumerationTypeDescriptor  :    public TypeDescriptor  {
1648 
1649     protected:
1650         StringAggregate * _elements;     //  of  (null)
1651 
1652     public:
1653         EnumerationTypeDescriptor( );
~EnumerationTypeDescriptor()1654         virtual ~EnumerationTypeDescriptor() { }
1655 
1656 
Elements()1657         StringAggregate & Elements() {
1658             return *_elements;
1659         }
1660 //        void Elements (StringAggregate  e);
1661 };
1662 #endif
1663 
1664 class STEPaggregate;
1665 class EnumAggregate;
1666 class GenericAggregate;
1667 class EntityAggregate;
1668 class SelectAggregate;
1669 class StringAggregate;
1670 class BinaryAggregate;
1671 class RealAggregate;
1672 class IntAggregate;
1673 
1674 typedef STEPaggregate * ( * AggregateCreator )();
1675 typedef EnumAggregate * ( * EnumAggregateCreator )();
1676 typedef GenericAggregate * ( * GenericAggregateCreator )();
1677 typedef EntityAggregate * ( * EntityAggregateCreator )();
1678 typedef SelectAggregate * ( * SelectAggregateCreator )();
1679 typedef StringAggregate * ( * StringAggregateCreator )();
1680 typedef BinaryAggregate * ( * BinaryAggregateCreator )();
1681 typedef RealAggregate * ( * RealAggregateCreator )();
1682 typedef IntAggregate * ( * IntAggregateCreator )();
1683 
1684 SC_CORE_EXPORT EnumAggregate * create_EnumAggregate();
1685 
1686 SC_CORE_EXPORT GenericAggregate * create_GenericAggregate();
1687 
1688 SC_CORE_EXPORT EntityAggregate * create_EntityAggregate();
1689 
1690 SC_CORE_EXPORT SelectAggregate * create_SelectAggregate();
1691 
1692 SC_CORE_EXPORT StringAggregate * create_StringAggregate();
1693 
1694 SC_CORE_EXPORT BinaryAggregate * create_BinaryAggregate();
1695 
1696 SC_CORE_EXPORT RealAggregate * create_RealAggregate();
1697 
1698 SC_CORE_EXPORT IntAggregate * create_IntAggregate();
1699 
1700 typedef SDAI_Integer( *boundCallbackFn )( SDAI_Application_instance * );
1701 
1702 /**
1703  * \class AggrTypeDescriptor
1704  * I think we decided on a simplistic representation of aggr. types for now?
1705  * i.e. just have one AggrTypeDesc for Array of [list of] [set of] someType
1706  * the inherited variable _referentType will point to the TypeDesc for someType
1707  * So I don't believe this class was necessary.  If we were to retain
1708  * info for each of the [aggr of]'s in the example above then there would be
1709  * one of these for each [aggr of] above and they would be strung
1710  * together by the _aggrDomainType variables.  If you can make this
1711  * work then go for it.
1712  */
1713 class SC_CORE_EXPORT AggrTypeDescriptor  :    public TypeDescriptor  {
1714 
1715     protected:
1716 
1717         SDAI_Integer  _bound1, _bound2;
1718         SDAI_LOGICAL _uniqueElements;
1719         TypeDescriptor * _aggrDomainType;
1720         AggregateCreator CreateNewAggr;
1721 
1722         AggrBoundTypeEnum _bound1_type, _bound2_type;
1723         boundCallbackFn _bound1_callback, _bound2_callback;
1724         std::string _bound1_str, _bound2_str;
1725 
1726     public:
1727 
1728         void AssignAggrCreator( AggregateCreator f = 0 );
1729 
1730         STEPaggregate * CreateAggregate();
1731 
1732         AggrTypeDescriptor( );
1733         AggrTypeDescriptor( SDAI_Integer b1, SDAI_Integer b2,
1734                             Logical uniqElem,
1735                             TypeDescriptor * aggrDomType );
1736         AggrTypeDescriptor( const char * nm, PrimitiveType ft,
1737                             Schema * origSchema, const char * d,
1738                             AggregateCreator f = 0 )
TypeDescriptor(nm,ft,origSchema,d)1739             : TypeDescriptor( nm, ft, origSchema, d ), _bound1( 0 ), _bound2( 0 ), _uniqueElements( 0 ), _aggrDomainType( NULL ), CreateNewAggr( f ) { }
1740         virtual ~AggrTypeDescriptor();
1741 
1742 
1743         /// find bound type
Bound1Type()1744         AggrBoundTypeEnum Bound1Type() const {
1745             return _bound1_type;
1746         }
1747         /// get a constant bound
Bound1()1748         SDAI_Integer Bound1( ) const {
1749             assert( _bound1_type == bound_constant );
1750             return _bound1;
1751         }
1752         /// get a runtime bound using an object's 'this' pointer
Bound1Runtime(SDAI_Application_instance * this_ptr)1753         SDAI_Integer Bound1Runtime( SDAI_Application_instance * this_ptr ) const {
1754             assert( this_ptr && ( _bound1_type == bound_runtime ) );
1755             return _bound1_callback( this_ptr ) ;
1756         }
1757         /// get a bound's EXPRESS function call string
Bound1Funcall()1758         std::string Bound1Funcall() const {
1759             return _bound1_str;
1760         }
1761         /// set bound to a constant
SetBound1(SDAI_Integer b1)1762         void SetBound1( SDAI_Integer  b1 )   {
1763             _bound1 = b1;
1764             _bound1_type = bound_constant;
1765         }
1766         ///set bound's callback fn. only for bounds dependent on an attribute
SetBound1FromMemberAccessor(boundCallbackFn callback)1767         void SetBound1FromMemberAccessor( boundCallbackFn callback ) {
1768             _bound1_callback = callback;
1769             _bound1_type = bound_runtime;
1770         }
1771         ///set bound from express function call. currently, this only stores the function call as a string.
SetBound1FromExpressFuncall(std::string s)1772         void SetBound1FromExpressFuncall( std::string s ) {
1773             _bound1_str = s;
1774             _bound1_type = bound_funcall;
1775         }
1776 
1777         /// find bound type
Bound2Type()1778         AggrBoundTypeEnum Bound2Type() const {
1779             return _bound2_type;
1780         }
1781         /// get a constant bound
Bound2()1782         SDAI_Integer Bound2( ) const {
1783             assert( _bound2_type == bound_constant );
1784             return _bound2;
1785         }
1786         /// get a runtime bound using an object's 'this' pointer
Bound2Runtime(SDAI_Application_instance * this_ptr)1787         SDAI_Integer Bound2Runtime( SDAI_Application_instance * this_ptr ) const {
1788             assert( this_ptr && ( _bound2_type == bound_runtime ) );
1789             return _bound2_callback( this_ptr ) ;
1790         }
1791         /// get a bound's EXPRESS function call string
Bound2Funcall()1792         std::string Bound2Funcall() const {
1793             return _bound2_str;
1794         }
1795         /// set bound to a constant
SetBound2(SDAI_Integer b2)1796         void SetBound2( SDAI_Integer  b2 )   {
1797             _bound2 = b2;
1798             _bound2_type = bound_constant;
1799         }
1800         ///set bound's callback fn
SetBound2FromMemberAccessor(boundCallbackFn callback)1801         void SetBound2FromMemberAccessor( boundCallbackFn callback ) {
1802             _bound2_callback = callback;
1803             _bound2_type = bound_runtime;
1804         }
1805         ///set bound from express function call. currently, this only stores the function call as a string.
SetBound2FromExpressFuncall(std::string s)1806         void SetBound2FromExpressFuncall( std::string s ) {
1807             _bound2_str = s;
1808             _bound2_type = bound_funcall;
1809         }
1810 
UniqueElements()1811         SDAI_LOGICAL & UniqueElements() {
1812             return _uniqueElements;
1813         }
UniqueElements(SDAI_LOGICAL & ue)1814         void UniqueElements( SDAI_LOGICAL & ue ) {
1815             _uniqueElements.put( ue.asInt() );
1816         }
UniqueElements(Logical ue)1817         void UniqueElements( Logical ue )     {
1818             _uniqueElements.put( ue );
1819         }
UniqueElements(const char * ue)1820         void UniqueElements( const char * ue ) {
1821             _uniqueElements.put( ue );
1822         }
1823 
AggrDomainType()1824         class TypeDescriptor * AggrDomainType()    {
1825                 return _aggrDomainType;
1826         }
AggrDomainType(TypeDescriptor * adt)1827         void AggrDomainType( TypeDescriptor * adt ) {
1828             _aggrDomainType = adt;
1829         }
1830 };
1831 
1832 ///////////////////////////////////////////////////////////////////////////////
1833 // ArrayTypeDescriptor
1834 ///////////////////////////////////////////////////////////////////////////////
1835 class SC_CORE_EXPORT ArrayTypeDescriptor  :    public AggrTypeDescriptor  {
1836 
1837     protected:
1838         SDAI_LOGICAL  _optionalElements;
1839     public:
1840 
ArrayTypeDescriptor()1841         ArrayTypeDescriptor( ) : _optionalElements( "UNKNOWN_TYPE" ) { }
ArrayTypeDescriptor(Logical optElem)1842         ArrayTypeDescriptor( Logical optElem ) : _optionalElements( optElem )
1843         { }
1844         ArrayTypeDescriptor( const char * nm, PrimitiveType ft,
1845                              Schema * origSchema, const char * d,
1846                              AggregateCreator f = 0 )
AggrTypeDescriptor(nm,ft,origSchema,d,f)1847             : AggrTypeDescriptor( nm, ft, origSchema, d, f ),
1848               _optionalElements( "UNKNOWN_TYPE" )
1849         { }
1850 
~ArrayTypeDescriptor()1851         virtual ~ArrayTypeDescriptor() {}
1852 
1853 
OptionalElements()1854         SDAI_LOGICAL & OptionalElements() {
1855             return _optionalElements;
1856         }
OptionalElements(SDAI_LOGICAL & oe)1857         void OptionalElements( SDAI_LOGICAL & oe ) {
1858             _optionalElements.put( oe.asInt() );
1859         }
OptionalElements(Logical oe)1860         void OptionalElements( Logical oe )     {
1861             _optionalElements.put( oe );
1862         }
OptionalElements(const char * oe)1863         void OptionalElements( const char * oe ) {
1864             _optionalElements.put( oe );
1865         }
1866 };
1867 
1868 class SC_CORE_EXPORT ListTypeDescriptor  :    public AggrTypeDescriptor  {
1869 
1870     protected:
1871     public:
ListTypeDescriptor()1872         ListTypeDescriptor( ) { }
1873         ListTypeDescriptor( const char * nm, PrimitiveType ft,
1874                             Schema * origSchema, const char * d,
1875                             AggregateCreator f = 0 )
AggrTypeDescriptor(nm,ft,origSchema,d,f)1876             : AggrTypeDescriptor( nm, ft, origSchema, d, f ) { }
~ListTypeDescriptor()1877         virtual ~ListTypeDescriptor() { }
1878 
1879 };
1880 
1881 class SC_CORE_EXPORT SetTypeDescriptor  :    public AggrTypeDescriptor  {
1882 
1883     protected:
1884     public:
1885 
SetTypeDescriptor()1886         SetTypeDescriptor( ) { }
1887         SetTypeDescriptor( const char * nm, PrimitiveType ft,
1888                            Schema * origSchema, const char * d,
1889                            AggregateCreator f = 0 )
AggrTypeDescriptor(nm,ft,origSchema,d,f)1890             : AggrTypeDescriptor( nm, ft, origSchema, d, f ) { }
~SetTypeDescriptor()1891         virtual ~SetTypeDescriptor() { }
1892 
1893 };
1894 
1895 class SC_CORE_EXPORT BagTypeDescriptor  :    public AggrTypeDescriptor  {
1896 
1897     protected:
1898     public:
1899 
BagTypeDescriptor()1900         BagTypeDescriptor( ) { }
1901         BagTypeDescriptor( const char * nm, PrimitiveType ft,
1902                            Schema * origSchema, const char * d,
1903                            AggregateCreator f = 0 )
AggrTypeDescriptor(nm,ft,origSchema,d,f)1904             : AggrTypeDescriptor( nm, ft, origSchema, d, f ) { }
~BagTypeDescriptor()1905         virtual ~BagTypeDescriptor() { }
1906 
1907 };
1908 
1909 typedef SDAI_Select * ( * SelectCreator )();
1910 
1911 class SC_CORE_EXPORT SelectTypeDescriptor  :    public TypeDescriptor  {
1912 
1913     protected:
1914         TypeDescriptorList _elements;    //  of  TYPE_DESCRIPTOR
1915         int _unique_elements;
1916 
1917     public:
1918 
1919         SelectCreator CreateNewSelect;
1920 
1921         void AssignSelectCreator( SelectCreator f = 0 ) {
1922             CreateNewSelect = f;
1923         }
1924 
1925         SDAI_Select * CreateSelect();
1926 
1927         SelectTypeDescriptor( int b, const char * nm, PrimitiveType ft,
1928                               Schema * origSchema,
1929                               const char * d, SelectCreator f = 0 )
TypeDescriptor(nm,ft,origSchema,d)1930             : TypeDescriptor( nm, ft, origSchema, d ),
1931               _unique_elements( b ), CreateNewSelect( f )
1932         { }
~SelectTypeDescriptor()1933         virtual ~SelectTypeDescriptor() { }
1934 
Elements()1935         TypeDescriptorList & Elements() {
1936             return _elements;
1937         }
GetElements()1938         const TypeDescriptorList & GetElements() const {
1939             return _elements;
1940         }
UniqueElements()1941         int UniqueElements() const {
1942             return _unique_elements;
1943         }
1944         virtual const TypeDescriptor * IsA( const TypeDescriptor * ) const;
IsA(const char * n)1945         virtual const TypeDescriptor * IsA( const char * n ) const {
1946             return TypeDescriptor::IsA( n );
1947         }
1948         virtual const TypeDescriptor * CanBe( const TypeDescriptor * ) const;
1949         virtual const TypeDescriptor * CanBe( const char * n ) const;
1950         virtual const TypeDescriptor * CanBeSet( const char *, const char * )
1951         const;
1952 };
1953 
1954 class SC_CORE_EXPORT StringTypeDescriptor  :    public TypeDescriptor  {
1955 
1956     protected:
1957         SDAI_Integer   _width;  //  OPTIONAL
1958         SDAI_LOGICAL  _fixedSize;
1959     public:
1960 
StringTypeDescriptor()1961         StringTypeDescriptor( ) : _fixedSize( "UNKNOWN_TYPE" ) {
1962             _width = 0;
1963         }
~StringTypeDescriptor()1964         virtual ~StringTypeDescriptor() { }
1965 
1966 
Width()1967         SDAI_Integer Width() {
1968             return _width;
1969         }
Width(SDAI_Integer w)1970         void Width( SDAI_Integer w ) {
1971             _width = w;
1972         }
1973 
FixedSize()1974         SDAI_LOGICAL & FixedSize() {
1975             return _fixedSize;
1976         }
FixedSize(SDAI_LOGICAL fs)1977         void FixedSize( SDAI_LOGICAL fs ) {
1978             _fixedSize.put( fs.asInt() );
1979         }
FixedSize(Logical fs)1980         void FixedSize( Logical fs ) {
1981             _fixedSize.put( fs );
1982         }
1983 };
1984 
1985 class SC_CORE_EXPORT RealTypeDescriptor  :    public TypeDescriptor  {
1986 
1987     protected:
1988         SDAI_Integer _precisionSpec;  //  OPTIONAL
1989     public:
1990 
RealTypeDescriptor()1991         RealTypeDescriptor( ) {
1992             _precisionSpec = 0;
1993         }
~RealTypeDescriptor()1994         virtual ~RealTypeDescriptor() { }
1995 
PrecisionSpec()1996         SDAI_Integer PrecisionSpec() {
1997             return _precisionSpec;
1998         }
PrecisionSpec(SDAI_Integer ps)1999         void PrecisionSpec( SDAI_Integer ps ) {
2000             _precisionSpec = ps;
2001         }
2002 };
2003 
2004 
2005 #endif
2006