ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigEvent
TrigNavigation
src
FullHolderFactory.cxx
Go to the documentation of this file.
1
// Emacs -*- c++ -*-
2
3
/*
4
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
8
#include "
TrigNavigation/FullHolderFactory.h
"
9
#include "
TrigNavStructure/BaseHolder.h
"
10
#include "
TrigNavigation/Holder.h
"
11
#include "GaudiKernel/IConversionSvc.h"
12
#include "
TrigNavigation/TypeMaps.h
"
13
14
15
HLT::FullHolderFactory::FullHolderFactory
(
const
std::string& prefix)
16
:
asg
::
AsgMessaging
(
"HolderFactory"
),
17
m_serializerSvc
(0),
18
m_storeGate
(0),
19
m_prefix
(prefix),
20
m_readonly
(false)
21
{
22
}
23
24
HLT::BaseHolder
*
HLT::FullHolderFactory::fromSerialized
(
int
version,
const
std::vector<uint32_t>::const_iterator& start,
const
std::vector<uint32_t>::const_iterator& end){
25
class_id_type
clid{0};
26
sub_index_type
idx{0};
27
std::string
label
;
28
29
std::vector<uint32_t>::const_iterator blobIt = start;
30
31
auto
blobsize = std::distance(blobIt,end);
32
33
if
(!blobsize){
34
ATH_MSG_WARNING
(
"trying to deserialize empty blob, returning nullptr"
);
35
return
nullptr
;
36
}
37
38
BaseHolder::enquireSerialized
(blobIt,end, clid,
label
, idx);
39
40
auto
itr =
m_ignore
.find(clid);
41
if
( itr!=
m_ignore
.end() && (itr->second.empty() || itr->second.find(
label
)!=itr->second.end()) ) {
42
ATH_MSG_DEBUG
(
"deserialize: skipping "
<< clid <<
"#"
<<
label
);
43
return
nullptr
;
44
}
45
46
ATH_MSG_VERBOSE
(
"deserialize: extracted blob CLID: "
<< clid <<
" of size: "
<< blobsize <<
" SubTypeIndex: "
<< idx <<
" Label: "
<<
label
);
47
48
BaseHolder
* baseholder =
createHolder
(clid,
label
, idx);
49
if
(! baseholder) {
50
ATH_MSG_ERROR
(
"deserialize: Could not create holder for CLID "
<< clid
51
<<
" this probably means that the package holding the class for this CLID was not compiled against the TrigNavigation package in use!"
);
52
return
nullptr
;
53
}
54
55
// now we have the blobIt pointing to the place where objects may start
56
// if so we ought to do deserialization
57
if
( blobIt != end ) {
58
//copy the blob
59
std::vector<uint32_t>::const_iterator constEnd = end;
60
std::vector<uint32_t> blobpart2(blobIt, constEnd);
61
62
auto
iholder =
static_cast<
HLTNavDetails::IHolder
*
>
(baseholder);
63
64
iholder->
deserializePayload
(blobpart2,version);
65
66
if
( !iholder->syncWithSG() ) {
67
ATH_MSG_WARNING
(
"deserialize: after deserialization obejct not accessible though SG"
);
68
}
69
}
70
return
baseholder;
71
}
72
73
HLT::BaseHolder
*
HLT::FullHolderFactory::createHolder
(
CLID
clid,
const
std::string&
label
,
sub_index_type
index
)
const
{
74
ATH_MSG_DEBUG
(
"createHolder: creating holder for CLID: "
<< clid <<
" label: "
<<
label
<<
" and index: "
<<
index
<<
" readonly: "
<<
m_readonly
);
75
76
const
auto
itr =
HLT::TypeMaps::holders
().find(clid);
77
if
( itr ==
HLT::TypeMaps::holders
().end() ) {
78
ATH_MSG_ERROR
(
"createHolder: holder can't be done, no predefined storage found for CLID: "
<< clid);
79
return
nullptr
;
80
}
81
82
auto
holder = itr->second->clone(
m_prefix
,
label
,
index
);
83
if
(!holder){
84
ATH_MSG_ERROR
(
"createHolder: clone of holder failed clid: "
<< clid);
85
return
nullptr
;
86
}
87
88
ATH_MSG_DEBUG
(
"preparing holder with msg: "
<< &
msg
() <<
" storegate: "
<<
m_storeGate
<<
" and prefix "
<<
m_prefix
);
89
90
holder->prepare(*
this
,
m_storeGate
,
m_serializerSvc
,
m_readonly
);
91
92
ATH_MSG_DEBUG
(
"createHolder: holder prepared "
<< *holder);
93
94
return
holder;
95
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
BaseHolder.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
FullHolderFactory.h
Holder.h
TypeMaps.h
HLTNavDetails::IHolder
Definition
Holder.h:59
HLTNavDetails::IHolder::deserializePayload
bool deserializePayload(const std::vector< uint32_t > &dataBlob, int version)
deserialization of holder payload
Definition
Holder.cxx:147
HLT::BaseHolder
Definition
BaseHolder.h:14
HLT::BaseHolder::enquireSerialized
static bool enquireSerialized(std::vector< uint32_t >::const_iterator &fromHere, const std::vector< uint32_t >::const_iterator &end, class_id_type &c, std::string &label, sub_index_type &subtypeIndex)
Definition
BaseHolder.cxx:12
HLT::FullHolderFactory::createHolder
HLT::BaseHolder * createHolder(class_id_type clid, const std::string &label, uint16_t index) const override
Definition
FullHolderFactory.cxx:73
HLT::FullHolderFactory::m_prefix
std::string m_prefix
Definition
FullHolderFactory.h:47
HLT::FullHolderFactory::m_storeGate
StoreGateSvc * m_storeGate
Definition
FullHolderFactory.h:46
HLT::FullHolderFactory::fromSerialized
HLT::BaseHolder * fromSerialized(int version, const std::vector< uint32_t >::const_iterator &start, const std::vector< uint32_t >::const_iterator &end) override
Definition
FullHolderFactory.cxx:24
HLT::FullHolderFactory::m_ignore
std::unordered_map< class_id_type, std::set< std::string > > m_ignore
Definition
FullHolderFactory.h:49
HLT::FullHolderFactory::m_serializerSvc
IConversionSvc * m_serializerSvc
Definition
FullHolderFactory.h:45
HLT::FullHolderFactory::m_readonly
bool m_readonly
Definition
FullHolderFactory.h:48
HLT::FullHolderFactory::FullHolderFactory
FullHolderFactory(const std::string &prefix)
Definition
FullHolderFactory.cxx:15
HLT::TypeMaps::holders
static const CLIDtoHolderMap & holders()
Definition
TypeMaps.h:30
asg::AsgMessaging::AsgMessaging
AsgMessaging(const std::string &name)
Constructor with a name.
Definition
AsgMessaging.cxx:17
label
std::string label(const std::string &format, int i)
Definition
label.h:19
HLT::sub_index_type
uint16_t sub_index_type
Definition
Trigger/TrigEvent/TrigNavStructure/Root/Types.h:9
HLT::class_id_type
uint32_t class_id_type
Definition
Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
asg
Definition
DataHandleTestTool.h:28
index
Definition
index.py:1
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0