From: rahuel Date: Tue, 30 Aug 2005 06:50:16 +0000 (+0000) Subject: Used for test of omniORB4 : problem with object references X-Git-Tag: V_3_0_2~18 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsuperv.git;a=commitdiff_plain;h=2ec1d902f3b25df08e5ec66e0be7fd5ba62eb43d Used for test of omniORB4 : problem with object references --- diff --git a/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx b/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx index e41144b..4e24a56 100644 --- a/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx +++ b/src/GraphBase/SuperVisionBase_CheckOfUndefined.cxx @@ -35,14 +35,14 @@ using namespace std; #include "SALOME_NamingService.hxx" #include "SALOME_LifeCycleCORBA.hxx" +#include "DataFlowBase_Base.hxx" + int _ArgC ; char ** _ArgV ; int main(int argc, char **argv) { - Engines::Component_var objComponent ; - CORBA::Any * anAny = new CORBA::Any() ; - CORBA::Object_ptr obj ; + Engines::Component_ptr objComponent ; char * IOR ; ORB_INIT &init = *SINGLETON_::Instance() ; @@ -54,19 +54,87 @@ int main(int argc, char **argv) { SALOME_LifeCycleCORBA LCC( NamingService ) ; objComponent = LCC.FindOrLoad_Component( "FactoryServer" , "AddComponent" ); if ( CORBA::is_nil( objComponent ) ) { - //cout << " LCC.FindOrLoad_Component( FactoryServer , AddComponent )" << endl; + cout << "ERROR LCC.FindOrLoad_Component( FactoryServer , AddComponent )" << endl; return 0 ; } + objComponent->ping() ; - *anAny <<= objComponent ; IOR = orb->object_to_string( objComponent ); - //cout << "objComponent " << objComponent << " IOR " << IOR << " nil " << CORBA::is_nil( objComponent ) - // << endl ; + cout << "objComponent " << objComponent << " IOR " << IOR << " nil " + << CORBA::is_nil( objComponent ) << endl ; + + Engines::Component_ptr mySuperVision ; + mySuperVision = LCC.FindOrLoad_Component( "SuperVisionContainer","SUPERV" ) ; + SUPERV::SuperG_ptr mySuperVisionComponent ; + mySuperVisionComponent = SUPERV::SuperG::_narrow( mySuperVision ) ; + + CORBA::Any anAny ; +// anAny <<= CORBA::Object::_nil() ; + anAny <<= objComponent ; +// CORBA::Any anAny = CORBA::Any( CORBA::_tc_Object, objComponent ) ; +// anAny.replace( CORBA::_tc_Object, objComponent ); + + CORBA::Object * obj ; + anAny >>= obj ; + + IOR = orb->object_to_string( objComponent ); + cout << "objComponent " << objComponent << " IOR " << IOR << " nil " + << CORBA::is_nil( objComponent ) << endl ; + +// Crash +// IOR = orb->object_to_string( obj ); +// cout << "obj " << obj << " IOR " << IOR << " nil " << CORBA::is_nil( obj ) +// << endl ; + + Engines::Component_ptr objComponentfromAny ; + objComponentfromAny = Engines::Component::_narrow( obj ) ; + IOR = orb->object_to_string( objComponentfromAny ); + cout << "obComponentfromAny " << objComponentfromAny << " IOR " << IOR << " nil " + << CORBA::is_nil( objComponentfromAny ) << endl ; + + + +// CORBA::Object_var myObj = NamingService->ResolveComponent("xmen","FactoryServer" , +// "AddComponent" ); +// SuperVisionTest::AddComponent_ptr myObjComponent ; +// myObjComponent = SuperVisionTest::AddComponent::_narrow( myObj ) ; +// IOR = orb->object_to_string( myObjComponent ); +// cout << "myObjComponent " << myObjComponent << " IOR " << IOR << " nil " +// << CORBA::is_nil( myObjComponent ) << endl ; +// anAny <<= myObjComponent ; +// anAny >>= obj ; +// objComponentfromAny = Engines::Component::_narrow( obj ) ; +// IOR = orb->object_to_string( objComponentfromAny ); +// cout << "objComponentfromAny " << objComponentfromAny << " IOR " << IOR << " nil " +// << CORBA::is_nil( objComponentfromAny ) << endl ; + +// SuperVisionTest::Adder_ptr myAdder = myObjComponent->Addition() ; +// myAdder->ping() ; +// IOR = orb->object_to_string( myAdder ); +// cout << "myAdder " << myAdder << " IOR " << IOR << " nil " +// << CORBA::is_nil( myAdder ) << endl ; +// anAny <<= myAdder ; +// anAny <<= orb->string_to_object( IOR ) ; +// anAny >>= obj ; +// SuperVisionTest::Adder_ptr objAdderfromAny ; +// objAdderfromAny = SuperVisionTest::Adder::_narrow( obj ) ; +// IOR = orb->object_to_string( objAdderfromAny ); +// cout << "objAdderfromAny " << objAdderfromAny << " IOR " << IOR << " nil " +// << CORBA::is_nil( objAdderfromAny ) << endl ; + + +// Engines::Container_ptr myContainer = myObjComponent-> GetContainerRef() ; +// IOR = orb->object_to_string( myContainer ); +// cout << "myContainer " << myContainer << " IOR " << IOR << " nil " +// << CORBA::is_nil( myContainer ) << endl ; +// anAny <<= myContainer ; +// anAny >>= obj ; +// Engines::Container_ptr objContainerfromAny ; +// objContainerfromAny = Engines::Container::_narrow( obj ) ; +// IOR = orb->object_to_string( objContainerfromAny ); +// cout << "objContainerfromAny " << objContainerfromAny << " IOR " << IOR << " nil " +// << CORBA::is_nil( objContainerfromAny ) << endl ; - *anAny >>= obj ; - IOR = orb->object_to_string( obj ); - //cout << "obj " << obj << " IOR " << IOR << " nil " << CORBA::is_nil( obj ) - // << endl ; return 0; }