00001 #pragma once
00002
00019 #ifndef TRIGSTEERINGEVENT_MESSAGESVCPROVIDER_H
00020 #define TRIGSTEERINGEVENT_MESSAGESVCPROVIDER_H
00021
00022 #include <iostream>
00023 #include "GaudiKernel/Bootstrap.h"
00024 #include "GaudiKernel/ISvcLocator.h"
00025 #include "GaudiKernel/IMessageSvc.h"
00026 #include "GaudiKernel/IService.h"
00027 #include "GaudiKernel/MsgStream.h"
00028
00035 class MessageSvcProvider {
00036
00037 public:
00038
00039 MessageSvcProvider() : m_pMsgSvc(0) {}
00040
00041 ~MessageSvcProvider(){}
00042
00055 IMessageSvc* msgSvc() const {
00056 if(!m_pMsgSvc){
00057 ISvcLocator* serviceLocator = Gaudi::svcLocator();
00058 IService* theSvc;
00059
00060 StatusCode sc = serviceLocator->getService("MessageSvc", theSvc, true);
00061 if(sc.isFailure()) exit(1);
00062
00063 m_pMsgSvc = dynamic_cast<IMessageSvc*>(theSvc);
00064 if(!m_pMsgSvc) exit(1);
00065 }
00066 return m_pMsgSvc;
00067 }
00068
00069 private:
00070
00075 mutable IMessageSvc* m_pMsgSvc;
00076 };
00077
00078 #endif // MESSAGESVCPROVIDER_H
00079