2 // File : SALOMEDS_Server.cxx
3 // Created : Wed Nov 28 16:26:15 2001
4 // Author : Yves FRICAUD
8 // Copyright : Open CASCADE 2001
11 #include <SALOMEconfig.h>
12 #include CORBA_SERVER_HEADER(SALOMEDS)
13 #include "SALOMEDS_StudyManager_i.hxx"
14 #include "utilities.h"
17 // { // for ccmalloc memory debug
18 // void ccmalloc_static_initialization(void);
21 ///////////////////////////// MAIN ///////////////////////////////////////
22 //////////////////////////////////////////////////////////////////////////
23 int main(int argc, char** argv)
25 // ccmalloc_static_initialization();
27 MESSAGE("SALOMEDS_Server - main");
29 // Initialise the ORB.
30 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
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);
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
40 SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb);
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");
47 // Obtain a POAManager, and tell the POA to start accepting
48 // requests on its objects.
49 PortableServer::POAManager_var pman = poa->the_POAManager();
55 catch(CORBA::SystemException&) {
56 MESSAGE( "Caught CORBA::SystemException." )
58 catch(CORBA::Exception&) {
59 MESSAGE( "Caught CORBA::Exception." )
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() )
68 MESSAGE( "Caught unknown exception." )