1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEDS_Server.cxx
25 // Author : Yves FRICAUD
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(SALOMEDS)
32 #include "SALOMEDS_StudyManager_i.hxx"
33 #include "utilities.h"
37 #include <Utils_Timer.hxx>
41 // { // for ccmalloc memory debug
42 // void ccmalloc_static_initialization(void);
45 ///////////////////////////// MAIN ///////////////////////////////////////
46 //////////////////////////////////////////////////////////////////////////
47 int main(int argc, char** argv)
49 // ccmalloc_static_initialization();
51 MESSAGE("SALOMEDS_Server - main");
53 // Initialise the ORB.
54 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
55 omniORB::MaxMessageSize(100 * 1024 * 1024);
57 // Obtain a reference to the root POA.
58 CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
59 PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
62 // We allocate the objects on the heap. Since these are reference
63 // counted objects, they will be deleted by the POA when they are no
65 SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb);
67 // Activate the objects. This tells the POA that the objects are
68 // ready to accept requests.
69 PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i);
70 myStudyManager_i->register_name("/myStudyManager");
72 // Obtain a POAManager, and tell the POA to start accepting
73 // requests on its objects.
74 PortableServer::POAManager_var pman = poa->the_POAManager();
81 MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
87 catch(CORBA::SystemException&) {
88 MESSAGE( "Caught CORBA::SystemException." )
90 catch(CORBA::Exception&) {
91 MESSAGE( "Caught CORBA::Exception." )
93 catch(omniORB::fatalException& fe) {
94 MESSAGE( "Caught omniORB::fatalException:" )
95 MESSAGE( " file: " << fe.file() )
96 MESSAGE( " line: " << fe.line() )
97 MESSAGE( " mesg: " << fe.errmsg() )
100 MESSAGE( "Caught unknown exception." )