ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
ByteStreamCnvSvcBase
src
ByteStreamAddressProviderSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Include files
6
#include "
ByteStreamCnvSvcBase/ByteStreamAddressProviderSvc.h
"
7
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
8
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
9
10
#include "
SGTools/TransientAddress.h
"
11
#include "GaudiKernel/TypeNameString.h"
12
#include "GaudiKernel/IClassIDSvc.h"
13
14
#include "eformat/SourceIdentifier.h"
15
17
ByteStreamAddressProviderSvc::ByteStreamAddressProviderSvc
(
const
std::string& name, ISvcLocator* pSvcLocator)
18
: base_class(name, pSvcLocator),
m_clidSvc
(
"ClassIDSvc"
, name) {}
19
//________________________________________________________________________________
20
StatusCode
ByteStreamAddressProviderSvc::initialize
() {
21
ATH_MSG_INFO
(
"Initializing"
);
22
23
// Retrieve ClassIDSvc
24
ATH_CHECK
(
m_clidSvc
.retrieve() );
25
26
if
(
m_storeID < 0 || m_storeID >
StoreID::UNKNOWN
) {
27
ATH_MSG_FATAL
(
"Invalid StoreID "
<<
m_storeID
);
28
return
StatusCode::FAILURE;
29
}
30
ATH_MSG_INFO
(
"-- Will fill Store with id = "
<<
m_storeID
.value());
31
return
StatusCode::SUCCESS;
32
}
33
//________________________________________________________________________________
34
StatusCode
ByteStreamAddressProviderSvc::preLoadAddresses
(
StoreID::type
id
, tadList& tlist) {
35
ATH_MSG_DEBUG
(
"in preLoadAddress"
);
36
if
(
id
!=
m_storeID
) {
37
ATH_MSG_DEBUG
(
"StoreID = "
<<
id
<<
" does not match required id ("
<<
m_storeID
<<
") skip"
);
38
return
StatusCode::SUCCESS;
39
}
40
41
for
(
const
std::string& typeName :
m_typeNames
) {
42
Gaudi::Utils::TypeNameString item(typeName);
43
const
std::string& t = item.type();
44
const
std::string& nm = item.name();
45
CLID
classid;
46
if
(!
m_clidSvc
->getIDOfTypeName(t, classid).isSuccess()) {
47
ATH_MSG_WARNING
(
"Cannot create TAD for (type, name)"
<<
" no CLID for "
<< t <<
" "
<< nm);
48
}
else
{
49
SG::TransientAddress
* tad =
new
SG::TransientAddress
(classid, nm);
50
tlist.push_back(tad);
51
ATH_MSG_DEBUG
(
"Created TAD for (type, clid, name)"
<< t <<
" "
<< classid <<
" "
<< nm);
52
// save the clid and key.
53
m_clidKey
[classid].insert(nm);
54
}
55
}
56
return
StatusCode::SUCCESS;
57
}
58
//________________________________________________________________________________
59
StatusCode
ByteStreamAddressProviderSvc::updateAddress
(
StoreID::type
id
,
60
SG::TransientAddress
* tad,
61
const
EventContext& ctx) {
62
if
(
id
!=
m_storeID
) {
63
return
StatusCode::FAILURE;
64
}
65
CLID
clid = tad->
clID
();
66
std::string nm = tad->
name
();
67
auto
it =
m_clidKey
.find(clid);
68
if
(it ==
m_clidKey
.end() || it->second.count(nm) == 0) {
69
return
StatusCode::FAILURE;
70
}
71
ATH_MSG_DEBUG
(
"Creating address for "
<< clid <<
" "
<< nm);
72
ByteStreamAddress
*
add
=
new
ByteStreamAddress
(clid, nm,
""
);
73
add
->setEventContext(ctx);
74
tad->
setAddress
(
add
);
75
return
StatusCode::SUCCESS;
76
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
ByteStreamAddressProviderSvc.h
ByteStreamAddress.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IROBDataProviderSvc.h
TransientAddress.h
ByteStreamAddressProviderSvc::preLoadAddresses
virtual StatusCode preLoadAddresses(StoreID::type id, tadList &tlist) override
Definition
ByteStreamAddressProviderSvc.cxx:34
ByteStreamAddressProviderSvc::m_typeNames
Gaudi::Property< std::vector< std::string > > m_typeNames
Definition
ByteStreamAddressProviderSvc.h:41
ByteStreamAddressProviderSvc::updateAddress
virtual StatusCode updateAddress(StoreID::type id, SG::TransientAddress *tad, const EventContext &ctx) override
update an existing transient Address
Definition
ByteStreamAddressProviderSvc.cxx:59
ByteStreamAddressProviderSvc::initialize
virtual StatusCode initialize() override
Definition
ByteStreamAddressProviderSvc.cxx:20
ByteStreamAddressProviderSvc::ByteStreamAddressProviderSvc
ByteStreamAddressProviderSvc(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
Definition
ByteStreamAddressProviderSvc.cxx:17
ByteStreamAddressProviderSvc::m_clidSvc
ServiceHandle< IClassIDSvc > m_clidSvc
Definition
ByteStreamAddressProviderSvc.h:44
ByteStreamAddressProviderSvc::m_clidKey
std::map< unsigned int, std::set< std::string > > m_clidKey
Definition
ByteStreamAddressProviderSvc.h:46
ByteStreamAddressProviderSvc::m_storeID
Gaudi::Property< int > m_storeID
Definition
ByteStreamAddressProviderSvc.h:48
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition
ByteStreamAddress.h:28
SG::TransientAddress
Definition
TransientAddress.h:34
SG::TransientAddress::clID
CLID clID() const
Retrieve string key:
Definition
TransientAddress.h:207
SG::TransientAddress::name
const std::string & name() const
Get the primary (hashed) SG key.
Definition
TransientAddress.h:214
SG::TransientAddress::setAddress
void setAddress(CxxUtils::RefCountedPtr< IOpaqueAddress > pAddress)
Retrieve primary clid.
Definition
TransientAddress.cxx:189
StoreID::type
type
Definition
StoreID.h:24
StoreID::UNKNOWN
@ UNKNOWN
Definition
StoreID.h:32
add
bool add(const std::string &hname, TKey *tobj)
Definition
fastadd.cxx:55
Generated on
for ATLAS Offline Software by
1.17.0