00001 #include <exception>
00002 #include <iostream>
00003 #include <cstdlib>
00004 #include "IMPL/LCIOExceptionHandler.h"
00005
00006 namespace IMPL {
00007
00008
00009
00010 LCIOExceptionHandler* LCIOExceptionHandler::_me = 0 ;
00011
00012
00013
00014
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 }