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

A concrete IAddressProvider. More...

#include <ByteStreamAddressProviderSvc.h>

Inheritance diagram for ByteStreamAddressProviderSvc:
Collaboration diagram for ByteStreamAddressProviderSvc:

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
 
virtual StatusCode updateAddress (StoreID::type id, SG::TransientAddress *tad, const EventContext &ctx) override
 update an existing transient Address 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
 

Detailed Description

A concrete IAddressProvider.

Definition at line 22 of file ByteStreamAddressProviderSvc.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  base_class(name, pSvcLocator),
19  m_clidSvc("ClassIDSvc", name),
21  declareProperty("StoreID", m_storeID);
22 }

Member Function Documentation

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

◆ preLoadAddresses()

StatusCode ByteStreamAddressProviderSvc::preLoadAddresses ( StoreID::type  id,
tadList &  tlist 
)
overridevirtual

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  Gaudi::Utils::TypeNameString 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

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 }

Member Data Documentation

◆ m_clidKey

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

Definition at line 47 of file ByteStreamAddressProviderSvc.h.

◆ m_clidSvc

ServiceHandle<IClassIDSvc> ByteStreamAddressProviderSvc::m_clidSvc
private

Definition at line 45 of file ByteStreamAddressProviderSvc.h.

◆ m_storeID

int ByteStreamAddressProviderSvc::m_storeID
private

Definition at line 49 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 41 of file ByteStreamAddressProviderSvc.h.


The documentation for this class was generated from the following files:
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:396
SG::TransientAddress
Definition: TransientAddress.h:32
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.DetectStreamerInfoChanges.classid
classid
Definition: DetectStreamerInfoChanges.py:57
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:228
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:41
ReadCalibFromCool.typeName
typeName
Definition: ReadCalibFromCool.py:477
ByteStreamAddressProviderSvc::m_storeID
int m_storeID
Definition: ByteStreamAddressProviderSvc.h:49
StoreID::EVENT_STORE
@ EVENT_STORE
Definition: StoreID.h:26
ByteStreamAddressProviderSvc::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition: ByteStreamAddressProviderSvc.h:45
ByteStreamAddressProviderSvc::m_clidKey
std::map< unsigned int, std::set< std::string > > m_clidKey
Definition: ByteStreamAddressProviderSvc.h:47