]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM/geom.cxx
Salome HOME
NRI : Merge from V1_2.
[modules/geom.git] / src / GEOM / geom.cxx
1 //  GEOM GEOM : implementaion of GEOM_Gen.idl and GEOM_Shape.idl
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   : geom.cxx
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 using namespace std;
30 #include "GEOM_Gen_i.hh"
31 #include "SALOME_NamingService.hxx"
32
33 //==================================================================================
34 // function : main()                      MAIN 
35 // purpose  :
36 //==================================================================================
37 int main(int argc, char** argv)
38 {
39   try {
40     // Create and initialise the ORB.
41     //    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4");
42     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
43     
44     // Obtain a reference to the root POA.
45     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
46     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
47
48     // We allocate the objects on the heap.  Since these are reference
49     // counted objects, they will be deleted by the POA when they are no
50     // longer needed.    
51     GEOM_Gen_i * myGEOM_Gen_i = new GEOM_Gen_i(orb);
52
53     // Activate the objects.  This tells the POA that the objects are
54     // ready to accept requests.
55     PortableServer::ObjectId_var myGEOM_Gen_iid = poa->activate_object(myGEOM_Gen_i);
56     myGEOM_Gen_i->register_name("/myGEOM_Gen");
57  
58     // Obtain a POAManager, and tell the POA to start accepting
59     // requests on its objects.
60     PortableServer::POAManager_var pman = poa->the_POAManager();
61     pman->activate();
62
63     orb->run();
64     orb->destroy();
65   }
66   catch(CORBA::SystemException&) {
67     cerr << "Caught CORBA::SystemException." << endl;
68   }
69   catch(CORBA::Exception&) {
70     cerr << "Caught CORBA::Exception." << endl;
71   }
72   catch(omniORB::fatalException& fe) {
73     cerr << "Caught omniORB::fatalException:" << endl;
74     cerr << "  file: " << fe.file() << endl;
75     cerr << "  line: " << fe.line() << endl;
76     cerr << "  msg: " << fe.errmsg() << endl;
77   }
78   catch(...) {
79     cerr << "Caught unknown exception." << endl;
80   }
81   return 0;
82 }