1- /* * \file inverse_attr.cc
2- ** 1-Jul-2012
3- ** Test inverse attributes; uses a tiny schema similar to a subset of IFC2x3
4- **
5- */
1+ /* * \file inverse_attr3.cc
2+ * Oct 2013
3+ * Test inverse attributes; uses a tiny schema similar to a subset of IFC2x3
4+ *
5+ * This test originally used STEPfile, which didn't work. Fixing STEPfile would have been very difficult, it uses lazyInstMgr now.
6+ */
67#include < sc_cf.h>
78extern void SchemaInit ( class Registry & );
89#include " sc_version_string.h"
9- #include < STEPfile.h>
10+ #include < lazyInstMgr.h>
11+ #include < lazyRefs.h>
1012#include < sdai.h>
1113#include < STEPattribute.h>
1214#include < ExpDict.h>
@@ -21,22 +23,24 @@ extern void SchemaInit( class Registry & );
2123#include " schema.h"
2224
2325int main ( int argc, char * argv[] ) {
24- Registry registry ( SchemaInit );
25- InstMgr instance_list;
26- STEPfile sfile ( registry, instance_list, " " , false );
2726 if ( argc != 2 ) {
27+ cerr << " Wrong number of args!" << endl;
2828 exit ( EXIT_FAILURE );
2929 }
30- sfile.ReadExchangeFile ( argv[1 ] );
30+ lazyInstMgr lim;
31+ lim.initRegistry ( SchemaInit );
3132
32- if ( sfile.Error ().severity () <= SEVERITY_INCOMPLETE ) {
33- sfile.Error ().PrintContents ( cout );
33+ lim.openFile ( argv[1 ] );
34+
35+ // find attributes
36+ instanceTypes_t::cvector * insts = lim.getInstances ( " window" );
37+ if ( !insts || insts->empty () ) {
38+ cout << " No window instances found!" << endl;
3439 exit ( EXIT_FAILURE );
3540 }
36- // find attributes
37- SdaiWindow * instance = ( SdaiWindow * ) instance_list.GetApplication_instance ( " window" );
41+ SdaiWindow * instance = dynamic_cast < SdaiWindow * >( lim.loadInstance ( insts->at ( 0 ) ) );
3842 if ( !instance ) {
39- cout << " NULL " << endl;
43+ cout << " Problem loading instance " << endl;
4044 exit ( EXIT_FAILURE );
4145 }
4246 cout << " instance #" << instance->StepFileId () << endl;
0 commit comments