CGEM BOSS
6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
MessageSvcProvider.h
Go to the documentation of this file.
1
//============================================
2
/// \warning THIS CLASS IS *NOT* THREAD-SAFE!
3
//============================================
4
#ifndef MESSAGESVCPROVIDER_H
5
#define MESSAGESVCPROVIDER_H
6
7
#include <iostream>
8
#include "GaudiKernel/Bootstrap.h"
9
#include "GaudiKernel/ISvcLocator.h"
10
#include "GaudiKernel/IMessageSvc.h"
11
#include "GaudiKernel/IService.h"
12
#include "GaudiKernel/MsgStream.h"
13
14
/// \class MessageSvcProvider
15
/// \brief Class that provides message services.
16
/// Add to any classes that need message services.
17
class
MessageSvcProvider
{
18
19
public
:
20
static
MessageSvcProvider
*
instance
();
21
22
~MessageSvcProvider
(){}
23
24
/// \fn IMessageSvc* msgSvc() const
25
/// \warning If this fails, without cout there is no way to tell the user!
26
/// \return An IMessageSvc pointer.
27
/// To use, your class needs a MessageSvcProvider as a member.
28
/// You can then do:
29
/// MsgStream log(m_MessageSvcProvider.msgSvc(), m_objectName);
30
IMessageSvc*
msgSvc
()
/*const*/
{
31
// if(!m_pMsgSvc){
32
ISvcLocator* serviceLocator = Gaudi::svcLocator();
33
//IService* theSvc;
34
//std::cout<<"!!!!!!!!!!!!!!!!!1"<<std::endl;
35
StatusCode sc = serviceLocator->service(
"MessageSvc"
,m_pMsgSvc);
36
if
(sc.isFailure()) exit(1);
// Service [MessageSvc] not found
37
//std::cout<<"!!!!!!!!!!!!!!!!!2"<<std::endl;
38
//m_pMsgSvc = dynamic_cast<IMessageSvc*>(theSvc);
39
if
(!m_pMsgSvc) exit(1);
// Dynamic cast IService --> IMessageSvc failed
40
// }
41
//std::cout<<"!!!!!!!!!!!!!!!!!3"<<std::endl;
42
return
m_pMsgSvc;
43
}
44
45
private
:
46
static
MessageSvcProvider
* s_instancePointer;
47
48
MessageSvcProvider
() : m_pMsgSvc(0){}
49
/// \var IMessageSvc* m_pMsgSvc
50
/// \see msgSvc()
51
IMessageSvc* m_pMsgSvc;
52
};
53
54
#endif
// MESSAGESVCPROVIDER_H
55
MessageSvcProvider
Class that provides message services. Add to any classes that need message services.
Definition
MessageSvcProvider.h:17
MessageSvcProvider::msgSvc
IMessageSvc * msgSvc()
Definition
MessageSvcProvider.h:30
MessageSvcProvider::~MessageSvcProvider
~MessageSvcProvider()
Definition
MessageSvcProvider.h:22
MessageSvcProvider::instance
static MessageSvcProvider * instance()
Definition
MessageSvcProvider.cxx:5
6.6.5.i
EventFilter
HltUtilities
HltTools
HltTools-01-00-02
HltTools
MessageSvcProvider.h
Generated by
1.12.0