Salome HOME
e41144bf8ea4a66125c49e86d19c887a2fa9539e
[modules/superv.git] / src / GraphBase / SuperVisionBase_CheckOfUndefined.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SuperVisionBase_CheckOfUndefined.cxx
25 //  Module : SUPERV
26
27 using namespace std;
28 #include <iostream>
29 #include <fstream>
30 #include <unistd.h>
31
32 #include "Utils_ORB_INIT.hxx"
33 #include "Utils_SINGLETON.hxx"
34
35 #include "SALOME_NamingService.hxx"
36 #include "SALOME_LifeCycleCORBA.hxx"
37
38 int _ArgC ;
39 char ** _ArgV ;
40
41 int main(int argc, char **argv) {
42
43   Engines::Component_var objComponent ;
44   CORBA::Any * anAny = new CORBA::Any() ;
45   CORBA::Object_ptr obj ;
46   char * IOR ;
47
48   ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
49   ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
50   CORBA::ORB_var &orb = init( argc , argv ) ;
51
52   SALOME_NamingService * NamingService = new SALOME_NamingService( orb ) ;
53
54   SALOME_LifeCycleCORBA LCC( NamingService ) ;
55   objComponent = LCC.FindOrLoad_Component( "FactoryServer" , "AddComponent" );
56   if ( CORBA::is_nil( objComponent ) ) {
57     //cout << " LCC.FindOrLoad_Component( FactoryServer , AddComponent )" << endl;
58     return 0 ;
59   }
60
61   *anAny <<= objComponent ;
62   IOR = orb->object_to_string( objComponent );
63   //cout << "objComponent " << objComponent << " IOR " << IOR << " nil " << CORBA::is_nil( objComponent )
64   //       << endl ;
65
66   *anAny >>= obj ;
67   IOR = orb->object_to_string( obj );
68   //cout << "obj " << obj << " IOR " << IOR << " nil " << CORBA::is_nil( obj )
69   //       << endl ;
70
71   return 0;
72 }
73