1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SuperVisionBase_CheckOfUndefined.cxx
32 #include "Utils_ORB_INIT.hxx"
33 #include "Utils_SINGLETON.hxx"
35 #include "SALOME_NamingService.hxx"
36 #include "SALOME_LifeCycleCORBA.hxx"
38 #include "DataFlowBase_Base.hxx"
43 int main(int argc, char **argv) {
45 Engines::Component_ptr objComponent ;
48 ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
49 ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
50 CORBA::ORB_var &orb = init( argc , argv ) ;
52 SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ;
54 SALOME_LifeCycleCORBA LCC( NamingService ) ;
55 objComponent = LCC.FindOrLoad_Component( "FactoryServer" , "AddComponent" );
56 if ( CORBA::is_nil( objComponent ) ) {
57 cout << "ERROR LCC.FindOrLoad_Component( FactoryServer , AddComponent )" << endl;
60 objComponent->ping() ;
62 IOR = orb->object_to_string( objComponent );
63 cout << "objComponent " << objComponent << " IOR " << IOR << " nil "
64 << CORBA::is_nil( objComponent ) << endl ;
66 Engines::Component_ptr mySuperVision ;
67 mySuperVision = LCC.FindOrLoad_Component( "SuperVisionContainer","SUPERV" ) ;
68 SUPERV::SuperG_ptr mySuperVisionComponent ;
69 mySuperVisionComponent = SUPERV::SuperG::_narrow( mySuperVision ) ;
72 // anAny <<= CORBA::Object::_nil() ;
73 anAny <<= objComponent ;
74 // CORBA::Any anAny = CORBA::Any( CORBA::_tc_Object, objComponent ) ;
75 // anAny.replace( CORBA::_tc_Object, objComponent );
80 IOR = orb->object_to_string( objComponent );
81 cout << "objComponent " << objComponent << " IOR " << IOR << " nil "
82 << CORBA::is_nil( objComponent ) << endl ;
85 // IOR = orb->object_to_string( obj );
86 // cout << "obj " << obj << " IOR " << IOR << " nil " << CORBA::is_nil( obj )
89 Engines::Component_ptr objComponentfromAny ;
90 objComponentfromAny = Engines::Component::_narrow( obj ) ;
91 IOR = orb->object_to_string( objComponentfromAny );
92 cout << "obComponentfromAny " << objComponentfromAny << " IOR " << IOR << " nil "
93 << CORBA::is_nil( objComponentfromAny ) << endl ;
97 // CORBA::Object_var myObj = NamingService->ResolveComponent("xmen","FactoryServer" ,
99 // SuperVisionTest::AddComponent_ptr myObjComponent ;
100 // myObjComponent = SuperVisionTest::AddComponent::_narrow( myObj ) ;
101 // IOR = orb->object_to_string( myObjComponent );
102 // cout << "myObjComponent " << myObjComponent << " IOR " << IOR << " nil "
103 // << CORBA::is_nil( myObjComponent ) << endl ;
104 // anAny <<= myObjComponent ;
106 // objComponentfromAny = Engines::Component::_narrow( obj ) ;
107 // IOR = orb->object_to_string( objComponentfromAny );
108 // cout << "objComponentfromAny " << objComponentfromAny << " IOR " << IOR << " nil "
109 // << CORBA::is_nil( objComponentfromAny ) << endl ;
111 // SuperVisionTest::Adder_ptr myAdder = myObjComponent->Addition() ;
113 // IOR = orb->object_to_string( myAdder );
114 // cout << "myAdder " << myAdder << " IOR " << IOR << " nil "
115 // << CORBA::is_nil( myAdder ) << endl ;
116 // anAny <<= myAdder ;
117 // anAny <<= orb->string_to_object( IOR ) ;
119 // SuperVisionTest::Adder_ptr objAdderfromAny ;
120 // objAdderfromAny = SuperVisionTest::Adder::_narrow( obj ) ;
121 // IOR = orb->object_to_string( objAdderfromAny );
122 // cout << "objAdderfromAny " << objAdderfromAny << " IOR " << IOR << " nil "
123 // << CORBA::is_nil( objAdderfromAny ) << endl ;
126 // Engines::Container_ptr myContainer = myObjComponent-> GetContainerRef() ;
127 // IOR = orb->object_to_string( myContainer );
128 // cout << "myContainer " << myContainer << " IOR " << IOR << " nil "
129 // << CORBA::is_nil( myContainer ) << endl ;
130 // anAny <<= myContainer ;
132 // Engines::Container_ptr objContainerfromAny ;
133 // objContainerfromAny = Engines::Container::_narrow( obj ) ;
134 // IOR = orb->object_to_string( objContainerfromAny );
135 // cout << "objContainerfromAny " << objContainerfromAny << " IOR " << IOR << " nil "
136 // << CORBA::is_nil( objContainerfromAny ) << endl ;