4747// note - doing this well will require major changes, since each inst automatically loads every instance that it references
4848// TODO what about complex instances? scanning each on disk could be a bitch; should the compositional types be scanned during lazy loading?
4949
50+ // TODO/FIXME in generated code, store ia data in map and eliminate data members that are currently used. modify accessors to use map.
5051class lazyRefs {
5152 public:
5253 typedef std::set< instanceID > referentInstances_t;
@@ -76,7 +77,7 @@ class lazyRefs {
7677 potentialReferentInsts ( edL );
7778 // 3d - load each inst
7879 /* invAttrListNode * invNode*/
79- iAstruct * ias = invAttr ( _inst, ia /* , iaList */ );
80+ iAstruct * ias = invAttr ( _inst, ia );
8081 referentInstances_t::iterator insts = _referentInstances.begin ();
8182 for ( ; insts != _referentInstances.end (); ++insts ) {
8283 loadInstIFFreferent ( *insts, ias, ia );
@@ -85,13 +86,21 @@ class lazyRefs {
8586 }
8687
8788 void loadInstIFFreferent ( instanceID inst, iAstruct * ias, const Inverse_attribute * ia ) {
89+ std::cout << " liir for inst #" << _inst->STEPfile_id << " , referent #" << inst << " , ia " << ia->Name () << " (" << (void *) ia;
90+ std::cout << " ), ias " << (void *) ias << std::endl;
8891 bool prevLoaded = _lim->isLoaded ( inst );
8992 SDAI_Application_instance * rinst = _lim->loadInstance ( inst );
9093 bool ref = refersToCurrentInst ( ia, rinst );
9194 if ( ref ) {
9295 if ( ia->inverted_attr_ ()->IsAggrType () ) {
96+ if ( !ias->a ) {
97+ ias->a = new EntityAggregate;
98+ _inst->setInvAttr ( ia, *ias );
99+ assert ( invAttr ( _inst, ia )->a == ias->a );
100+ }
93101 EntityAggregate * ea = ias->a ;
94- assert ( ea && " is it possible for this to be null here? if so, must create & assign" );
102+ // assert( ias->a && "is it possible for this to be null here? if so, must create & assign");
103+ // FIXME InitIAttrs has been called, but this is null. what to do? init here? if not, where???
95104 // TODO check if duplicate
96105 ea->AddNode ( new EntityNode ( rinst ) );
97106 } else {
@@ -183,12 +192,14 @@ END_ENTITY; -- 10303-42: geometry_schema
183192 }
184193 iai = map.begin ();
185194 // FIXME treat as unrecoverable?
195+ // need to call inst->InitIAttrs();
186196 std::cerr << " Error! inverse attr " << ia->Name () << " (" << ia << " ) not found in iAMap for entity " << inst->getEDesc ()->Name () << " . Map contents:" << std::endl;
187197 for ( ; iai != map.end (); ++iai ) {
188198 std::cerr << iai->first ->Name () << " : " << (void *)(iai->second .a ) << " , " ;
189199 }
190200 std::cerr << std::endl;
191- return NULL ;
201+ abort ();
202+ // // return NULL;
192203 }
193204
194205 /* * 3c. compare the type of each item in R with types in A
0 commit comments