ATLAS Offline Software
Loading...
Searching...
No Matches
HLT::FullHolderFactory Class Reference

#include <FullHolderFactory.h>

Inheritance diagram for HLT::FullHolderFactory:
Collaboration diagram for HLT::FullHolderFactory:

Public Member Functions

 FullHolderFactory (const std::string &prefix)
HLT::BaseHolderfromSerialized (int version, const std::vector< uint32_t >::const_iterator &start, const std::vector< uint32_t >::const_iterator &end) override
HLT::BaseHoldercreateHolder (class_id_type clid, const std::string &label, uint16_t index) const override
void prepare (StoreGateSvc *store, IConversionSvc *serializer, bool readonly=true)
void addClassToIgnore (class_id_type clid, const std::string &label="")
 Ignore class with clid (and optional label) during deserialization.
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

IConversionSvc * m_serializerSvc
StoreGateSvcm_storeGate
std::string m_prefix
bool m_readonly
std::unordered_map< class_id_type, std::set< std::string > > m_ignore
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 24 of file FullHolderFactory.h.

Constructor & Destructor Documentation

◆ FullHolderFactory()

HLT::FullHolderFactory::FullHolderFactory ( const std::string & prefix)

Definition at line 15 of file FullHolderFactory.cxx.

16 : asg::AsgMessaging("HolderFactory"),
18 m_storeGate(0),
19 m_prefix(prefix),
20 m_readonly(false)
21{
22}
IConversionSvc * m_serializerSvc

Member Function Documentation

◆ addClassToIgnore()

void HLT::FullHolderFactory::addClassToIgnore ( class_id_type clid,
const std::string & label = "" )
inline

Ignore class with clid (and optional label) during deserialization.

Definition at line 39 of file FullHolderFactory.h.

39 {
40 if (label.empty()) m_ignore[clid] = {};
41 else m_ignore[clid].insert(label);
42 }
std::unordered_map< class_id_type, std::set< std::string > > m_ignore
std::string label(const std::string &format, int i)
Definition label.h:19

◆ createHolder()

HLT::BaseHolder * HLT::FullHolderFactory::createHolder ( class_id_type clid,
const std::string & label,
uint16_t index ) const
overridevirtual

Implements HLT::ITrigHolderFactory.

Definition at line 73 of file FullHolderFactory.cxx.

73 {
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_DEBUG(x)
static const CLIDtoHolderMap & holders()
Definition TypeMaps.h:30
MsgStream & msg() const
The standard message stream.

◆ fromSerialized()

HLT::BaseHolder * HLT::FullHolderFactory::fromSerialized ( int version,
const std::vector< uint32_t >::const_iterator & start,
const std::vector< uint32_t >::const_iterator & end )
overridevirtual

Implements HLT::ITrigHolderFactory.

Definition at line 24 of file FullHolderFactory.cxx.

24 {
25 class_id_type clid{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}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
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

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ prepare()

void HLT::FullHolderFactory::prepare ( StoreGateSvc * store,
IConversionSvc * serializer,
bool readonly = true )
inline

Definition at line 32 of file FullHolderFactory.h.

32 {
34 m_serializerSvc = serializer;
35 m_readonly = readonly;
36 }
TestStore store
Definition TestStore.cxx:23

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_ignore

std::unordered_map<class_id_type, std::set<std::string> > HLT::FullHolderFactory::m_ignore
private

Definition at line 49 of file FullHolderFactory.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_prefix

std::string HLT::FullHolderFactory::m_prefix
private

Definition at line 47 of file FullHolderFactory.h.

◆ m_readonly

bool HLT::FullHolderFactory::m_readonly
private

Definition at line 48 of file FullHolderFactory.h.

◆ m_serializerSvc

IConversionSvc* HLT::FullHolderFactory::m_serializerSvc
private

Definition at line 45 of file FullHolderFactory.h.

◆ m_storeGate

StoreGateSvc* HLT::FullHolderFactory::m_storeGate
private

Definition at line 46 of file FullHolderFactory.h.


The documentation for this class was generated from the following files: