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

Base class for the dual-use service implementation classes. More...

#include <AsgService.h>

Inherits asg::IAsgService, and AthService.

Inherited by asg::UnitTestService1, AthOnnx::OnnxRuntimeSvc, CP::SelectionNameSvc, CP::SystematicsSvc, egammaMVASvc, FlavorTagDiscriminants::NNSharingSvc, PlotsDefinitionSvc, and TrackAnalysisDefinitionSvc.

Collaboration diagram for asg::AsgService:

Public Member Functions

 AsgService (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual void print () const
 Print the state of the service. More...
 
template<typename T >
void declareServiceInterface ()
 add the given interface to the list of interfaces More...
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvi)
 query interface for gaudi More...
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Private Attributes

std::vector< std::pair< const InterfaceID &(*)(), void *(*)(AsgService *)> > m_interfaces
 list of interfaces we have More...
 
virtual StatusCode initialize ()
 set up/tear down functions More...
 
virtual StatusCode finalize ()
 

Detailed Description

Base class for the dual-use service implementation classes.

This class can be used like AthService can be used for Athena-only services.

Loosely based on the AsgTool implementation.

Definition at line 41 of file AsgService.h.

Constructor & Destructor Documentation

◆ AsgService()

asg::AsgService::AsgService ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 18 of file AsgService.cxx.

22 #ifndef XAOD_STANDALONE
23  name, pSvcLocator
24 #else // not XAOD_STANDALONE
25  name
26 #endif // not XAOD_STANDALONE
27  )
28  {
29  (void) pSvcLocator;
30  }

Member Function Documentation

◆ declareServiceInterface()

template<typename T >
void asg::AsgService::declareServiceInterface

add the given interface to the list of interfaces

Definition at line 76 of file AsgService.h.

77  {
78 #ifndef XAOD_STANDALONE
79  m_interfaces.emplace_back (T::interfaceID, [] (AsgService *self) -> void* {return dynamic_cast<T*>(self);});
80 #endif
81  }

◆ finalize()

StatusCode asg::AsgService::finalize ( )
virtual

Reimplemented in TrackAnalysisDefinitionSvc, CP::SystematicsSvc, PlotsDefinitionSvc, and AthOnnx::OnnxRuntimeSvc.

Definition at line 40 of file AsgService.cxx.

42  {
43  return StatusCode::SUCCESS;
44  }

◆ initialize()

StatusCode asg::AsgService::initialize ( )
virtual

set up/tear down functions

Reimplemented in TrackAnalysisDefinitionSvc, CP::SelectionNameSvc, CP::SystematicsSvc, PlotsDefinitionSvc, asg::UnitTestService1, AthOnnx::OnnxRuntimeSvc, and egammaMVASvc.

Definition at line 32 of file AsgService.cxx.

34  {
35  return StatusCode::SUCCESS;
36  }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Service >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ print()

void asg::AsgService::print ( ) const
virtual

Print the state of the service.

Implements asg::IAsgService.

Definition at line 48 of file AsgService.cxx.

49  {
50  ATH_MSG_INFO( "AsgService " << name() << " @ " << this );
51  return;
52  }

◆ queryInterface()

StatusCode asg::AsgService::queryInterface ( const InterfaceID &  riid,
void **  ppvi 
)
virtual

query interface for gaudi

Definition at line 57 of file AsgService.cxx.

59  {
60  for (const auto& interface : m_interfaces)
61  {
62  if (riid == interface.first())
63  {
64  *ppvi = interface.second (this);
65  addRef();
66  return StatusCode::SUCCESS;
67  }
68  }
69  return AsgServiceBase::queryInterface (riid, ppvi);
70  }

Member Data Documentation

◆ m_interfaces

std::vector<std::pair<const InterfaceID& (*)(),void *(*)(AsgService*)> > asg::AsgService::m_interfaces
private

list of interfaces we have

Definition at line 68 of file AsgService.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
asg::AsgService::m_interfaces
std::vector< std::pair< const InterfaceID &(*)(), void *(*)(AsgService *)> > m_interfaces
list of interfaces we have
Definition: AsgService.h:68
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
asg::AsgService::AsgService
AsgService(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AsgService.cxx:19
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
asg::AsgServiceBase
::AthService AsgServiceBase
Definition: AsgService.h:29