1 // SALOME Container : implementation of container and engine for Kernel
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SALOME_Container.cxx
25 // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
39 # include <sys/time.h>
49 #include "SALOME_Container_i.hxx"
50 #include "utilities.h"
51 #include "Utils_ORB_INIT.hxx"
52 #include "Utils_SINGLETON.hxx"
56 #include <Utils_Timer.hxx>
59 #include "Container_init_python.hxx"
63 extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
65 int main(int argc, char* argv[])
68 MPI_Init(&argc,&argv);
71 // Initialise the ORB.
72 //SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
73 //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
74 ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
75 ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
76 CORBA::ORB_ptr orb = init(0 , 0 ) ;
78 // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
84 bool isSupervContainer = false;
85 if (strcmp(argv[1],"SuperVisionContainer") == 0) isSupervContainer = true;
87 if (!isSupervContainer)
91 KERNEL_PYTHON::init_python(argc,argv);
96 PySys_SetArgv( argc , argv ) ;
99 char *containerName = "";
102 containerName = argv[1] ;
107 CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
108 ASSERT(!CORBA::is_nil(obj));
109 PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
111 PortableServer::POAManager_var pman = root_poa->the_POAManager();
113 // add new container to the kill list
115 ostrstream aCommand ;
116 aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << ends ;
117 system(aCommand.str());
120 Engines_Container_i * myContainer
121 = new Engines_Container_i(orb, root_poa, containerName , argc , argv );
129 timer.ShowAbsolute();
132 HandleServerSideSignals(orb);
135 catch(CORBA::SystemException&)
137 INFOS("Caught CORBA::SystemException.");
139 catch(PortableServer::POA::ServantAlreadyActive&)
141 INFOS("Caught CORBA::ServantAlreadyActiveException");
143 catch(CORBA::Exception&)
145 INFOS("Caught CORBA::Exception.");
147 catch(std::exception& exc)
149 INFOS("Caught std::exception - "<<exc.what());
153 INFOS("Caught unknown exception.");
161 //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
162 //bp1->deleteInstance(bp1);