1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
23 // File : SuperVisionBase_CheckOfUndefined.cxx
31 #include "Utils_ORB_INIT.hxx"
32 #include "Utils_SINGLETON.hxx"
34 #include "SALOME_NamingService.hxx"
35 #include "SALOME_LifeCycleCORBA.hxx"
37 #include "DataFlowBase_Base.hxx"
39 #include CORBA_CLIENT_HEADER(SALOME_Component)
46 int main(int argc, char **argv) {
48 Engines::Component_ptr objComponent ;
51 ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
52 ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
53 CORBA::ORB_var &orb = init( argc , argv ) ;
55 SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ;
57 SALOME_LifeCycleCORBA LCC( NamingService ) ;
58 objComponent = LCC.FindOrLoad_Component( "FactoryServer" , "AddComponent" );
59 if ( CORBA::is_nil( objComponent ) ) {
60 cout << "ERROR LCC.FindOrLoad_Component( FactoryServer , AddComponent )" << endl;
63 objComponent->ping() ;
65 IOR = orb->object_to_string( objComponent );
66 cout << "objComponent " << objComponent << " IOR " << IOR << " nil "
67 << CORBA::is_nil( objComponent ) << endl ;
69 Engines::Component_ptr mySuperVision ;
70 mySuperVision = LCC.FindOrLoad_Component( "SuperVisionContainer","SUPERV" ) ;
71 SUPERV::SuperG_ptr mySuperVisionComponent ;
72 mySuperVisionComponent = SUPERV::SuperG::_narrow( mySuperVision ) ;
75 // anAny <<= CORBA::Object::_nil() ;
76 anAny <<= objComponent ;
77 // CORBA::Any anAny = CORBA::Any( CORBA::_tc_Object, objComponent ) ;
78 // anAny.replace( CORBA::_tc_Object, objComponent );
83 IOR = orb->object_to_string( objComponent );
84 cout << "objComponent " << objComponent << " IOR " << IOR << " nil "
85 << CORBA::is_nil( objComponent ) << endl ;
88 // IOR = orb->object_to_string( obj );
89 // cout << "obj " << obj << " IOR " << IOR << " nil " << CORBA::is_nil( obj )
92 Engines::Component_ptr objComponentfromAny ;
93 objComponentfromAny = Engines::Component::_narrow( obj ) ;
94 IOR = orb->object_to_string( objComponentfromAny );
95 cout << "obComponentfromAny " << objComponentfromAny << " IOR " << IOR << " nil "
96 << CORBA::is_nil( objComponentfromAny ) << endl ;
100 // CORBA::Object_var myObj = NamingService->ResolveComponent("xmen","FactoryServer" ,
102 // SuperVisionTest::AddComponent_ptr myObjComponent ;
103 // myObjComponent = SuperVisionTest::AddComponent::_narrow( myObj ) ;
104 // IOR = orb->object_to_string( myObjComponent );
105 // cout << "myObjComponent " << myObjComponent << " IOR " << IOR << " nil "
106 // << CORBA::is_nil( myObjComponent ) << endl ;
107 // anAny <<= myObjComponent ;
109 // objComponentfromAny = Engines::Component::_narrow( obj ) ;
110 // IOR = orb->object_to_string( objComponentfromAny );
111 // cout << "objComponentfromAny " << objComponentfromAny << " IOR " << IOR << " nil "
112 // << CORBA::is_nil( objComponentfromAny ) << endl ;
114 // SuperVisionTest::Adder_ptr myAdder = myObjComponent->Addition() ;
116 // IOR = orb->object_to_string( myAdder );
117 // cout << "myAdder " << myAdder << " IOR " << IOR << " nil "
118 // << CORBA::is_nil( myAdder ) << endl ;
119 // anAny <<= myAdder ;
120 // anAny <<= orb->string_to_object( IOR ) ;
122 // SuperVisionTest::Adder_ptr objAdderfromAny ;
123 // objAdderfromAny = SuperVisionTest::Adder::_narrow( obj ) ;
124 // IOR = orb->object_to_string( objAdderfromAny );
125 // cout << "objAdderfromAny " << objAdderfromAny << " IOR " << IOR << " nil "
126 // << CORBA::is_nil( objAdderfromAny ) << endl ;
129 // Engines::Container_ptr myContainer = myObjComponent-> GetContainerRef() ;
130 // IOR = orb->object_to_string( myContainer );
131 // cout << "myContainer " << myContainer << " IOR " << IOR << " nil "
132 // << CORBA::is_nil( myContainer ) << endl ;
133 // anAny <<= myContainer ;
135 // Engines::Container_ptr objContainerfromAny ;
136 // objContainerfromAny = Engines::Container::_narrow( obj ) ;
137 // IOR = orb->object_to_string( objContainerfromAny );
138 // cout << "objContainerfromAny " << objContainerfromAny << " IOR " << IOR << " nil "
139 // << CORBA::is_nil( objContainerfromAny ) << endl ;