1 #ifndef STEPCOMPLEX_H
2 #define STEPCOMPLEX_H
3 
4 #include <sc_export.h>
5 #include <errordesc.h>
6 #include <sdai.h>
7 #include <baseType.h>
8 #include <ExpDict.h>
9 #include <Registry.h>
10 
11 #include <list>
12 
13 typedef std::list<void *>            STEPcomplex_attr_data_list;
14 typedef std::list<void *>::iterator  STEPcomplex_attr_data;
15 
16 /** TODO add a method to ed to create iAttr structure
17  * either call same method in all parents, or add their iAttrs in some other way
18  * does not need to be ordered
19  *
20  * simply move iAttrs into eDesc? don't recall whether that data can be safely shared amongst multiple instances or not
21  * if it can't be shared, we'd need to enforce copy-on-write somehow - perhaps making iAttrs protected with a getter
22  * that requires an instance as an arg - i.e. inst->eDesc->iAttrSetup(inst)
23  *
24  * what about inheritance? should each eDesc include all iattrs, or assemble the list as necessary at runtime?
25  * eDesc should assemble a complete list on demand at runtime...
26  *
27  * How to initialize iAttrs for SC's? BuildIAttrs( eDesc )
28  */
29 
30 
31 class SC_CORE_EXPORT STEPcomplex : public SDAI_Application_instance {
32     public: //TODO should this _really_ be public?!
33         STEPcomplex * sc;
34         STEPcomplex * head;
35         Registry * _registry;
36         int visited; ///< used when reading (or as you wish?)
37         STEPcomplex_attr_data_list _attr_data_list; //< what is this for?
38     public:
39         STEPcomplex( Registry * registry, int fileid );
40         STEPcomplex( Registry * registry, const std::string ** names, int fileid,
41                      const char * schnm = 0 );
42         STEPcomplex( Registry * registry, const char ** names, int fileid,
43                      const char * schnm = 0 );
44         virtual ~STEPcomplex();
45 
46         int EntityExists( const char * name, const char * currSch = 0 );
47         STEPcomplex * EntityPart( const char * name, const char * currSch = 0 );
48 
49 
50         virtual const EntityDescriptor * IsA( const EntityDescriptor * ) const;
51 
52         virtual Severity ValidLevel( ErrorDescriptor * error, InstMgrBase * im,
53                                      int clearError = 1 );
54 // READ
55         virtual Severity STEPread( int id, int addFileId,
56                                    class InstMgrBase * instance_set,
57                                    istream & in = cin, const char * currSch = NULL,
58                                    bool useTechCor = true, bool strict = true );
59 
60         virtual void STEPread_error( char c, int index, istream& in, const char * schnm );
61 
62 // WRITE
63         virtual void STEPwrite( ostream & out = cout, const char * currSch = NULL,
64                                 int writeComment = 1 );
65         virtual const char * STEPwrite( std::string & buf, const char * currSch = NULL );
66 
67         SDAI_Application_instance * Replicate();
68 
69         virtual void WriteExtMapEntities( ostream & out = cout,
70                                           const char * currSch = NULL );
71         virtual const char * WriteExtMapEntities( std::string & buf,
72                 const char * currSch = NULL );
73         virtual void AppendEntity( STEPcomplex * stepc );
74 
75     protected:
76         virtual void CopyAs( SDAI_Application_instance * se );
77         void BuildAttrs( const char * s );
78         void AddEntityPart( const char * name );
79         void AssignDerives();
80         void Initialize( const char ** names, const char * schnm );
81 };
82 
83 #endif
84