]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM/geom.cxx
Salome HOME
Correct make file for shared modules script
[modules/geom.git] / src / GEOM / geom.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  GEOM GEOM : implementaion of GEOM_Gen.idl
23 //  File   : geom.cxx
24 //  Author : Lucien PIGNOLONI
25 //  Module : GEOM
26 //  $Header$
27 //
28 #include <Standard_Stream.hxx>
29
30 #include <CORBA.h>
31 #include <GEOM_Gen_i.hh>
32 #include <SALOME_NamingService.hxx>
33
34 #include "utilities.h"
35
36 //==================================================================================
37 // function : main()                      MAIN 
38 // purpose  :
39 //==================================================================================
40 int main(int argc, char** argv)
41 {
42   try {
43     // Create and initialise the ORB.
44     //    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4");
45     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
46     
47     // Obtain a reference to the root POA.
48     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
49     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
50
51     // We allocate the objects on the heap.  Since these are reference
52     // counted objects, they will be deleted by the POA when they are no
53     // longer needed.    
54 #ifdef WNT
55     GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i((CORBA::ORB_ptr)orb, poa, 0, 0, 0 );
56 #else
57     GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb);
58 #endif
59
60     // Activate the objects.  This tells the POA that the objects are
61     // ready to accept requests.
62     PortableServer::ObjectId_var myGEOM_Gen_iid = poa->activate_object(myGEOM_Gen_i);
63     myGEOM_Gen_i->register_name("/myGEOM_Gen");
64  
65     // Obtain a POAManager, and tell the POA to start accepting
66     // requests on its objects.
67     PortableServer::POAManager_var pman = poa->the_POAManager();
68     pman->activate();
69
70     orb->run();
71     orb->destroy();
72   }
73   catch(CORBA::SystemException&) {
74     INFOS ( "Caught CORBA::SystemException." );
75   }
76   catch(CORBA::Exception&) {
77     INFOS ( "Caught CORBA::Exception." );
78   }
79   catch(omniORB::fatalException& fe) {
80     INFOS ( "Caught omniORB::fatalException:" );
81     INFOS ( "  file: " << fe.file() );
82     INFOS ( "  line: " << fe.line() );
83     INFOS ( "  msg: " << fe.errmsg() );
84   }
85   catch(...) {
86     INFOS ( "Caught unknown exception." );
87   }
88   return 0;
89 }