void TestObjectFactory::init( SuifEnv* suif ) { _object_factory = suif->get_object_factory(); ObjectFactory *of = _object_factory; MetaClass* intMetaClass = of->lookupMetaClass("int"); assert( intMetaClass ); AggregateMetaClass* meta_SuifObject = of->find_aggregate_meta_class(SuifObject::get_class_name()); AggregateMetaClass* testX = 0; testX = of->create_object_meta_class( TestX::get_class_name(), sizeof( TestX ), TestX::constructorFunction, meta_SuifObject ); PointerMetaClass* owningPointerToTestX = of->get_pointer_meta_class( testX, true ); testX-> add_field_description( "i", intMetaClass, OFFSETOF(TestX,i) ); testX-> add_field_description( "x1", owningPointerToTestX, OFFSETOF(TestX,x1) ); testX-> add_field_description( "x2", owningPointerToTestX, OFFSETOF(TestX,x2) ); STLMetaClass* meta_TestX_vector =of-> get_stl_meta_class("LIST:suif_vector<TestX*>", new STLDescriptor< suif_vector<TestX*> >( owningPointerToTestX ) ); PointerMetaClass* meta_TestX_owner = of->get_pointer_meta_class(meta_TestX_vector,true,true); testX-> add_field_description( "_vector", meta_TestX_owner, OFFSETOF(TestX,_vector) ); testX->add_virtual_field( "int", "i" ); testX->add_virtual_field( "pointers", "x1;x2" ); testX->add_virtual_field( "TestX", "x1/*;x2/*" ); testX->add_virtual_field( "int-indirect", "i;x1/i;x2/i" ); testX->add_virtual_field( "vectorPtr", "_vector" ); testX->add_virtual_field( "vector", "_vector/*" ); testX->add_virtual_field( "vectorContents", "_vector/*/*" ); // ------------ make meta class for TestY ------------- AggregateMetaClass* testY = 0; testY = of->create_object_meta_class( TestY::get_class_name(), sizeof( TestY ), TestY::constructorFunction, testX ); testY-> add_field_description( "x3", owningPointerToTestX, OFFSETOF(TestY,x3) ); testY->add_virtual_field( "int", "i" ); testY->add_virtual_field( "pointers", "^;x3" ); testY->add_virtual_field( "TestX", "^;x3/*" ); }
void SuifEnv::init() { ObjectFactory* of = new SuifEnvObjectFactory; set_object_factory( of ); of -> init( this ); AggregateMetaClass* suifObjectMC = of->create_object_meta_class( SuifObject::get_class_name(), sizeof( SuifObject ), SuifObject::constructorFunction, (AggregateMetaClass*)of->lookupMetaClass( Object::get_class_name() ) ); PointerMetaClass* pointerToSuifObjectR = of->get_pointer_meta_class( suifObjectMC, false ); suifObjectMC -> add_field_description( "parent", pointerToSuifObjectR, OFFSETOF( SuifObject, parent ) ); // Brick::init_meta_class(this); input_sub_system = new InputSubSystemDefaultImplementation( this ); output_subsystem = new OutputSubSystemDefaultImplementation( this ); cloneSubSystem = new CloneSubSystemDefaultImplementation( this ); _dll_subsystem = new DLLSubSystem( this ); _module_subsystem = new ModuleSubSystem( this ); _error_subsystem = new ErrorSubSystem( this ); _print_subsystem = new PrintSubSystem( this ); }