00001 //============================================ 00003 //============================================ 00004 #ifndef MESSAGESVCPROVIDER_H 00005 #define MESSAGESVCPROVIDER_H 00006 00007 #include <iostream> 00008 #include "GaudiKernel/Bootstrap.h" 00009 #include "GaudiKernel/ISvcLocator.h" 00010 #include "GaudiKernel/IMessageSvc.h" 00011 #include "GaudiKernel/IService.h" 00012 #include "GaudiKernel/MsgStream.h" 00013 00017 class MessageSvcProvider { 00018 00019 public: 00020 static MessageSvcProvider* instance(); 00021 00022 ~MessageSvcProvider(){} 00023 00030 IMessageSvc* msgSvc() /*const*/ { 00031 // if(!m_pMsgSvc){ 00032 ISvcLocator* serviceLocator = Gaudi::svcLocator(); 00033 //IService* theSvc; 00034 //std::cout<<"!!!!!!!!!!!!!!!!!1"<<std::endl; 00035 StatusCode sc = serviceLocator->service("MessageSvc",m_pMsgSvc); 00036 if(sc.isFailure()) exit(1); // Service [MessageSvc] not found 00037 //std::cout<<"!!!!!!!!!!!!!!!!!2"<<std::endl; 00038 //m_pMsgSvc = dynamic_cast<IMessageSvc*>(theSvc); 00039 if(!m_pMsgSvc) exit(1); // Dynamic cast IService --> IMessageSvc failed 00040 // } 00041 //std::cout<<"!!!!!!!!!!!!!!!!!3"<<std::endl; 00042 return m_pMsgSvc; 00043 } 00044 00045 private: 00046 static MessageSvcProvider* s_instancePointer; 00047 00048 MessageSvcProvider() : m_pMsgSvc(0){} 00051 IMessageSvc* m_pMsgSvc; 00052 }; 00053 00054 #endif // MESSAGESVCPROVIDER_H 00055