ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

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

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. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

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"),
17  m_serializerSvc(0),
18  m_storeGate(0),
20  m_readonly(false)
21 {
22 }

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  }

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

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

◆ 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  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

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

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

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ 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:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:71
index
Definition: index.py:1
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
HLT::FullHolderFactory::createHolder
HLT::BaseHolder * createHolder(class_id_type clid, const std::string &label, uint16_t index) const override
Definition: FullHolderFactory.cxx:73
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
HLT::FullHolderFactory::m_storeGate
StoreGateSvc * m_storeGate
Definition: FullHolderFactory.h:46
HLT::TypeMaps::holders
static const CLIDtoHolderMap & holders()
Definition: TypeMaps.h:30
HLT::FullHolderFactory::m_readonly
bool m_readonly
Definition: FullHolderFactory.h:48
HLT::FullHolderFactory::m_ignore
std::unordered_map< class_id_type, std::set< std::string > > m_ignore
Definition: FullHolderFactory.h:49
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
HLT::FullHolderFactory::m_serializerSvc
IConversionSvc * m_serializerSvc
Definition: FullHolderFactory.h:45
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HLTNavDetails::IHolder::deserializePayload
bool deserializePayload(const std::vector< uint32_t > &dataBlob, int version)
deserialization of holder payload
Definition: Holder.cxx:148
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
HLT::class_id_type
uint32_t class_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
HLT::sub_index_type
uint16_t sub_index_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:9
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
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
get_generator_info.version
version
Definition: get_generator_info.py:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
HLTNavDetails::IHolder
Definition: Holder.h:58
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
HLT::FullHolderFactory::m_prefix
std::string m_prefix
Definition: FullHolderFactory.h:47
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7