ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
ByteStreamAddressProviderSvc Class Reference

An concrete IAddressProvider. More...

#include <ByteStreamAddressProviderSvc.h>

Inheritance diagram for ByteStreamAddressProviderSvc:
Collaboration diagram for ByteStreamAddressProviderSvc:

Public Types

typedef std::list< SG::TransientAddress * > tadList
 
typedef tadList::iterator tadListIterator
 

Public Member Functions

 ByteStreamAddressProviderSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor. More...
 
virtual StatusCode initialize () override
 
virtual StatusCode preLoadAddresses (StoreID::type id, tadList &tlist) override
 get all addresses from Provider : Called before Begin Event More...
 
virtual StatusCode updateAddress (StoreID::type id, SG::TransientAddress *tad, const EventContext &ctx) override
 update an existing transient Address More...
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 
 DeclareInterfaceID (IAddressProvider, 1, 0)
 
virtual StatusCode loadAddresses (StoreID::type, tadList &)
 get all new addresses from Provider for this Event. More...
 

Private Attributes

Gaudi::Property< std::vector< std::string > > m_typeNames
 
ServiceHandle< IClassIDSvc > m_clidSvc
 
std::map< unsigned int, std::set< std::string > > m_clidKey
 
int m_storeID
 

Friends

class SvcFactory< ByteStreamAddressProviderSvc >
 Allow the factory class access to the constructor. More...
 

Detailed Description

An concrete IAddressProvider.

Definition at line 24 of file ByteStreamAddressProviderSvc.h.

Member Typedef Documentation

◆ tadList

typedef std::list<SG::TransientAddress*> IAddressProvider::tadList
inherited

Definition at line 32 of file IAddressProvider.h.

◆ tadListIterator

typedef tadList::iterator IAddressProvider::tadListIterator
inherited

Definition at line 33 of file IAddressProvider.h.

Constructor & Destructor Documentation

◆ ByteStreamAddressProviderSvc()

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

Standard constructor.

Definition at line 17 of file ByteStreamAddressProviderSvc.cxx.

17  :
18  ::AthService(name, pSvcLocator),
19  m_clidSvc("ClassIDSvc", name),
21  declareProperty("StoreID", m_storeID);
22 }

Member Function Documentation

◆ DeclareInterfaceID()

IAddressProvider::DeclareInterfaceID ( IAddressProvider  ,
,
 
)
inherited

◆ initialize()

StatusCode ByteStreamAddressProviderSvc::initialize ( )
overridevirtual

Definition at line 24 of file ByteStreamAddressProviderSvc.cxx.

24  {
25  ATH_MSG_INFO("Initializing");
26 
27  // Retrieve ClassIDSvc
28  ATH_CHECK( m_clidSvc.retrieve() );
29 
30  if (m_storeID < 0 || m_storeID > StoreID::UNKNOWN) {
31  ATH_MSG_FATAL("Invalid StoreID " << m_storeID);
32  return(StatusCode::FAILURE);
33  }
34  ATH_MSG_INFO("-- Will fill Store with id = " << m_storeID);
35  return(StatusCode::SUCCESS);
36 }

◆ loadAddresses()

virtual StatusCode IAddressProvider::loadAddresses ( StoreID::type  ,
tadList  
)
inlinevirtualinherited

get all new addresses from Provider for this Event.

Reimplemented in LArFlatConditionSvc, Athena::xAODEventSelector, IOVDbSvc, MixingEventSelector, AddressRemappingSvc, AthenaPoolAddressProviderSvc, and CondProxyProvider.

Definition at line 42 of file IAddressProvider.h.

43  {
44  return StatusCode::SUCCESS;
45  }

◆ 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  }

◆ preLoadAddresses()

StatusCode ByteStreamAddressProviderSvc::preLoadAddresses ( StoreID::type  ,
tadList  
)
overridevirtual

get all addresses from Provider : Called before Begin Event

Reimplemented from IAddressProvider.

Definition at line 38 of file ByteStreamAddressProviderSvc.cxx.

38  {
39  ATH_MSG_DEBUG("in preLoadAddress");
40  if (id != m_storeID) {
41  ATH_MSG_DEBUG("StoreID = " << id << " does not match required id (" << m_storeID << ") skip");
42  return(StatusCode::SUCCESS);
43  }
44 
45  for (const std::string& typeName : m_typeNames) {
46  ListItem item(typeName);
47  const std::string& t = item.type();
48  const std::string& nm = item.name();
49  CLID classid;
50  if (!m_clidSvc->getIDOfTypeName(t, classid).isSuccess()) {
51  ATH_MSG_WARNING("Cannot create TAD for (type, name)" << " no CLID for " << t << " " << nm);
52  } else {
54  tlist.push_back(tad);
55  ATH_MSG_DEBUG("Created TAD for (type, clid, name)" << t << " " << classid << " " << nm);
56  // save the clid and key.
57  m_clidKey[classid].insert(nm);
58  }
59  }
60  return(StatusCode::SUCCESS);
61 }

◆ updateAddress()

StatusCode ByteStreamAddressProviderSvc::updateAddress ( StoreID::type  id,
SG::TransientAddress tad,
const EventContext &  ctx 
)
overridevirtual

update an existing transient Address

Implements IAddressProvider.

Definition at line 63 of file ByteStreamAddressProviderSvc.cxx.

65  {
66  if (id != m_storeID) {
67  return(StatusCode::FAILURE);
68  }
69  CLID clid = tad->clID();
70  std::string nm = tad->name();
71  std::map<CLID, std::set<std::string> >::const_iterator it = m_clidKey.find(clid);
72  if (it == m_clidKey.end() || (*it).second.count(nm) == 0) {
73  return(StatusCode::FAILURE);
74  }
75  ATH_MSG_DEBUG("Creating address for " << clid << " " << nm);
76  ByteStreamAddress* add = new ByteStreamAddress(clid, nm, "");
77  add->setEventContext(ctx);
78  tad->setAddress(add);
79  return(StatusCode::SUCCESS);
80 }

Friends And Related Function Documentation

◆ SvcFactory< ByteStreamAddressProviderSvc >

friend class SvcFactory< ByteStreamAddressProviderSvc >
friend

Allow the factory class access to the constructor.

Definition at line 1 of file ByteStreamAddressProviderSvc.h.

Member Data Documentation

◆ m_clidKey

std::map<unsigned int, std::set<std::string> > ByteStreamAddressProviderSvc::m_clidKey
private

Definition at line 51 of file ByteStreamAddressProviderSvc.h.

◆ m_clidSvc

ServiceHandle<IClassIDSvc> ByteStreamAddressProviderSvc::m_clidSvc
private

Definition at line 49 of file ByteStreamAddressProviderSvc.h.

◆ m_storeID

int ByteStreamAddressProviderSvc::m_storeID
private

Definition at line 53 of file ByteStreamAddressProviderSvc.h.

◆ m_typeNames

Gaudi::Property<std::vector<std::string> > ByteStreamAddressProviderSvc::m_typeNames
private
Initial value:
{this,"TypeNames",{},
"Type and Name of objects to create the address for","OrderedSet<std::string>"}

Definition at line 45 of file ByteStreamAddressProviderSvc.h.


The documentation for this class was generated from the following files:
AthService::AthService
AthService()
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
query_example.tlist
tlist
Definition: query_example.py:25
skel.it
it
Definition: skel.GENtoEVGEN.py:423
SG::TransientAddress
Definition: TransientAddress.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.DetectStreamerInfoChanges.classid
classid
Definition: DetectStreamerInfoChanges.py:54
SG::TransientAddress::name
const std::string & name() const
Get the primary (hashed) SG key.
Definition: TransientAddress.h:208
PyPoolBrowser.item
item
Definition: PyPoolBrowser.py:129
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::TransientAddress::clID
CLID clID() const
Retrieve string key:
Definition: TransientAddress.h:201
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
item
Definition: ItemListSvc.h:43
SG::TransientAddress::setAddress
void setAddress(IOpaqueAddress *pAddress)
Retrieve primary clid.
Definition: TransientAddress.cxx:172
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
StoreID::UNKNOWN
@ UNKNOWN
Definition: StoreID.h:32
ByteStreamAddressProviderSvc::m_typeNames
Gaudi::Property< std::vector< std::string > > m_typeNames
Definition: ByteStreamAddressProviderSvc.h:45
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
ByteStreamAddressProviderSvc::m_storeID
int m_storeID
Definition: ByteStreamAddressProviderSvc.h:53
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
ByteStreamAddressProviderSvc::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition: ByteStreamAddressProviderSvc.h:49
ByteStreamAddressProviderSvc::m_clidKey
std::map< unsigned int, std::set< std::string > > m_clidKey
Definition: ByteStreamAddressProviderSvc.h:51