Back to index

salome-kernel  6.5.0
Functions
SALOME_LauncherServer.cxx File Reference
#include "SALOME_Launcher.hxx"
#include "utilities.h"
#include <sstream>
#include <iostream>
#include <stdexcept>
#include <libxml/parser.h>

Go to the source code of this file.

Functions

void AttachDebugger ()
void terminateHandler (void)
void unexpectedHandler (void)
int main (int argc, char *argv[])

Function Documentation

void AttachDebugger ( )
int main ( int  argc,
char *  argv[] 
)

Definition at line 61 of file SALOME_LauncherServer.cxx.

{
  if(getenv ("DEBUGGER"))
    {
//       setsig(SIGSEGV,&Handler);
      std::set_terminate(&terminateHandler);
      std::set_unexpected(&unexpectedHandler);
    }
  /* Init libxml 
   * To avoid memory leak, need to call xmlInitParser in the main thread
   * and not call xmlCleanupParser later (cause implicit reinitialization in thread)
   */
  xmlInitParser();

  PortableServer::POA_var root_poa;
  PortableServer::POAManager_var pman;
  CORBA::Object_var obj;

  CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
  //  LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
  INFOS_COMPILATION;
  BEGIN_OF(argv[0]);
  try{ 
    obj = orb->resolve_initial_references("RootPOA");
    if(!CORBA::is_nil(obj))
      root_poa = PortableServer::POA::_narrow(obj);
    if(!CORBA::is_nil(root_poa))
      pman = root_poa->the_POAManager();
  }
  catch(CORBA::COMM_FAILURE&){
    MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
  }
  try{
    SALOME_Launcher *lServ=new SALOME_Launcher(orb,root_poa);
    pman->activate();
    lServ->_remove_ref();
    orb->run();
    orb->destroy();
  }catch(CORBA::SystemException&){
    MESSAGE("Caught CORBA::SystemException.");
  }catch(PortableServer::POA::WrongPolicy&){
    MESSAGE("Caught CORBA::WrongPolicyException.");
  }catch(PortableServer::POA::ServantAlreadyActive&){
    MESSAGE("Caught CORBA::ServantAlreadyActiveException");
  }catch(CORBA::Exception&){
    MESSAGE("Caught CORBA::Exception.");
  }catch(std::exception& exc){
    MESSAGE("Caught std::exception - "<<exc.what()); 
  }catch(...){
    MESSAGE("Caught unknown exception.");
  }
  END_OF(argv[0]);
  //  delete myThreadTrace;
}

Here is the call graph for this function:

void terminateHandler ( void  )
void unexpectedHandler ( void  )