ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Athena::IMessageSvcHolder Class Reference

get a IMessageSvc* on 1st use (if not set) and release it on ~ More...

#include <getMessageSvc.h>

Collaboration diagram for Athena::IMessageSvcHolder:

Public Member Functions

 IMessageSvcHolder ()
 will take the IMessageSvc* lazily from getMessageSvc() in get() Slow, but useful for classes without direct access to IMessageSvc* More...
 
 IMessageSvcHolder (const Options::CreateOptions o)
 allows to get the IMessageSvc immediately More...
 
 IMessageSvcHolder (IMessageSvc *ims)
 
 IMessageSvcHolder (const IMessageSvcHolder &)
 behaves like the constructor taking an IMessageSvc * More...
 
IMessageSvcHolderoperator= (const IMessageSvcHolder &)
 
 ~IMessageSvcHolder ()
 releases the IMessageSvc More...
 
IMessageSvc * get ()
 upon first access sets m_ims as needed More...
 
 operator IMessageSvc * ()
 conversion to IMessageSvc*, same as get More...
 

Private Attributes

IMessageSvc * m_ims
 

Detailed Description

get a IMessageSvc* on 1st use (if not set) and release it on ~

Definition at line 60 of file getMessageSvc.h.

Constructor & Destructor Documentation

◆ IMessageSvcHolder() [1/4]

Athena::IMessageSvcHolder::IMessageSvcHolder ( )
inline

will take the IMessageSvc* lazily from getMessageSvc() in get() Slow, but useful for classes without direct access to IMessageSvc*

Definition at line 64 of file getMessageSvc.h.

64 : m_ims() {}

◆ IMessageSvcHolder() [2/4]

IMessageSvcHolder::IMessageSvcHolder ( const Options::CreateOptions  o)

allows to get the IMessageSvc immediately

Parameters
oif o is Athena::Options::Eager it will create a MessageSvc instance there and then.

Definition at line 77 of file getMessageSvc.cxx.

77  :
78  m_ims(0)
79 {
81 }

◆ IMessageSvcHolder() [3/4]

IMessageSvcHolder::IMessageSvcHolder ( IMessageSvc *  ims)

Definition at line 56 of file getMessageSvc.cxx.

56  : m_ims(ims) {
57  assert(m_ims);
58  m_ims->addRef(); //take ownership till we go out of scope
59 }

◆ IMessageSvcHolder() [4/4]

IMessageSvcHolder::IMessageSvcHolder ( const IMessageSvcHolder rhs)

behaves like the constructor taking an IMessageSvc *

Definition at line 61 of file getMessageSvc.cxx.

61  :
62  m_ims(rhs.m_ims)
63 {
64  if (m_ims) m_ims->addRef(); //take ownership till we go out of scope
65 }

◆ ~IMessageSvcHolder()

IMessageSvcHolder::~IMessageSvcHolder ( )

releases the IMessageSvc

Definition at line 83 of file getMessageSvc.cxx.

83  {
84  if (m_ims) m_ims->release();
85 }

Member Function Documentation

◆ get()

IMessageSvc * IMessageSvcHolder::get ( )

upon first access sets m_ims as needed

Definition at line 88 of file getMessageSvc.cxx.

88  {
89  if (!m_ims) m_ims = getMessageSvc();
90  return m_ims;
91 }

◆ operator IMessageSvc *()

Athena::IMessageSvcHolder::operator IMessageSvc * ( )
inline

conversion to IMessageSvc*, same as get

Definition at line 87 of file getMessageSvc.h.

87 { return this->get(); }

◆ operator=()

IMessageSvcHolder & IMessageSvcHolder::operator= ( const IMessageSvcHolder rhs)

Definition at line 68 of file getMessageSvc.cxx.

68  {
69  if (this != & rhs && m_ims != rhs.m_ims) {
70  if (m_ims) m_ims->release(); //give up our IMessageSvc*
71  m_ims = rhs.m_ims;
72  if (m_ims) m_ims->addRef(); //take ownership till we go out of scope
73  }
74  return *this;
75 }

Member Data Documentation

◆ m_ims

IMessageSvc* Athena::IMessageSvcHolder::m_ims
private

Definition at line 89 of file getMessageSvc.h.


The documentation for this class was generated from the following files:
Athena::IMessageSvcHolder::m_ims
IMessageSvc * m_ims
Definition: getMessageSvc.h:89
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
Athena::IMessageSvcHolder::get
IMessageSvc * get()
upon first access sets m_ims as needed
Definition: getMessageSvc.cxx:88
Athena::Options::Eager
@ Eager
Definition: getMessageSvc.h:22