Skip to content

Commit d1062cd

Browse files
committed
use lazyInstMgr for inverse_attr3.cc
1 parent 6e636d1 commit d1062cd

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

test/cpp/schema_specific/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ set_tests_properties( test_aggregate_bound_runtime_FAIL1 PROPERTIES
5757

5858
add_schema_dependent_test( "inverse_attr1" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
5959
add_schema_dependent_test( "inverse_attr2" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
60-
add_schema_dependent_test( "inverse_attr3" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
60+
add_schema_dependent_test( "inverse_attr3" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21"
61+
"-I${SC_SOURCE_DIR}/src/cllazyfile -I${SC_SOURCE_DIR}/src/base/judy/src" "steplazyfile" )
6162
add_schema_dependent_test( "attribute" "inverse_attr" "${SC_SOURCE_DIR}/test/p21/test_inverse_attr.p21" )
6263

6364
if(HAVE_STD_THREAD)

test/cpp/schema_specific/inverse_attr3.cc

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
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>
78
extern 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

2325
int 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

Comments
 (0)