ATLAS Offline Software
Loading...
Searching...
No Matches
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
11#include "GaudiKernel/IConversionSvc.h"
13
14
16 : asg::AsgMessaging("HolderFactory"),
18 m_storeGate(0),
19 m_prefix(prefix),
20 m_readonly(false)
21{
22}
23
24HLT::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
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
uint32_t CLID
The Class ID type.
bool deserializePayload(const std::vector< uint32_t > &dataBlob, int version)
deserialization of holder payload
Definition Holder.cxx:148
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)
HLT::BaseHolder * createHolder(class_id_type clid, const std::string &label, uint16_t index) const override
HLT::BaseHolder * fromSerialized(int version, const std::vector< uint32_t >::const_iterator &start, const std::vector< uint32_t >::const_iterator &end) override
std::unordered_map< class_id_type, std::set< std::string > > m_ignore
IConversionSvc * m_serializerSvc
FullHolderFactory(const std::string &prefix)
static const CLIDtoHolderMap & holders()
Definition TypeMaps.h:30
AsgMessaging(const std::string &name)
Constructor with a name.
std::string label(const std::string &format, int i)
Definition label.h:19
Definition index.py:1
MsgStream & msg
Definition testRead.cxx:32