/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/IMPL/LCIOExceptionHandler.cc

Go to the documentation of this file.
00001 #include <exception> 
00002 #include <iostream>
00003 #include <cstdlib>
00004 #include "IMPL/LCIOExceptionHandler.h"
00005 
00006 namespace IMPL {
00007 
00008 
00009   // create one globale instance of the handler
00010   LCIOExceptionHandler* LCIOExceptionHandler::_me = 0 ;
00011 
00012 
00013 /** Method catches any std::exception, prints the message to stdout
00014  * and then exits the program. 
00015  */
00016 void lcio_unexpected(){
00017   
00018   try{
00019     
00020     throw ;
00021     
00022   }catch( std::exception& e){
00023     
00024     std::cout << " A runtime error has occured : " 
00025               << e.what() 
00026               << std::endl
00027               << " the program will have to be terminated - sorry." << std::endl ;
00028     exit(1) ;
00029   }
00030 }
00031 
00032   LCIOExceptionHandler::LCIOExceptionHandler(){
00033       
00034     std::set_unexpected( lcio_unexpected ) ;
00035     std::set_terminate( lcio_unexpected ) ;
00036   }
00037     
00038 
00039   LCIOExceptionHandler* LCIOExceptionHandler::createInstance(){
00040 
00041     if( ! _me ){
00042       _me = new LCIOExceptionHandler ;
00043     }
00044 
00045     return _me ;
00046   }
00047 }

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7