]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDS/SALOMEDS_Server.cxx
Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Server.cxx
1 using namespace std;
2 //  File      : SALOMEDS_Server.cxx
3 //  Created   : Wed Nov 28 16:26:15 2001
4 //  Author    : Yves FRICAUD
5
6 //  Project   : SALOME
7 //  Module    : SALOMEDS
8 //  Copyright : Open CASCADE 2001
9 //  $Header$
10
11 #include <SALOMEconfig.h>
12 #include CORBA_SERVER_HEADER(SALOMEDS)
13 #include "SALOMEDS_StudyManager_i.hxx"
14 #include "utilities.h"
15
16 // extern "C"
17 // { // for ccmalloc memory debug
18 // void ccmalloc_static_initialization(void);
19 // }
20
21 ///////////////////////////// MAIN ///////////////////////////////////////
22 //////////////////////////////////////////////////////////////////////////
23 int main(int argc, char** argv)
24 {
25 //   ccmalloc_static_initialization();
26
27   MESSAGE("SALOMEDS_Server - main");
28   try {
29     // Initialise the ORB.
30     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
31     
32     // Obtain a reference to the root POA.
33     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
34     PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
35
36
37     // We allocate the objects on the heap.  Since these are reference
38     // counted objects, they will be deleted by the POA when they are no
39     // longer needed.    
40     SALOMEDS_StudyManager_i * myStudyManager_i = new  SALOMEDS_StudyManager_i(orb);
41  
42     // Activate the objects.  This tells the POA that the objects are
43     // ready to accept requests.
44     PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i);
45     myStudyManager_i->register_name("/myStudyManager");
46        
47     // Obtain a POAManager, and tell the POA to start accepting
48     // requests on its objects.
49     PortableServer::POAManager_var pman = poa->the_POAManager();
50     pman->activate();
51
52     orb->run();
53     orb->destroy();
54   }
55   catch(CORBA::SystemException&) {
56     MESSAGE( "Caught CORBA::SystemException." )
57   }
58   catch(CORBA::Exception&) {
59     MESSAGE( "Caught CORBA::Exception." )
60   }
61   catch(omniORB::fatalException& fe) {
62     MESSAGE( "Caught omniORB::fatalException:" )
63     MESSAGE( "  file: " << fe.file() )
64     MESSAGE( "  line: " << fe.line() )
65     MESSAGE( "  mesg: " << fe.errmsg() )
66   }
67   catch(...) {
68     MESSAGE( "Caught unknown exception." )
69   }
70   return 0;
71 }
72