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

#include <TrigHolderStructure.h>

Inheritance diagram for HLT::TrigHolderStructure:
Collaboration diagram for HLT::TrigHolderStructure:

Public Member Functions

 TrigHolderStructure ()
void reset ()
bool registerHolder (const std::shared_ptr< BaseHolder > &holder)
template<typename HolderType = BaseHolder>
HolderType * getHolder (class_id_type clid, const std::variant< sub_index_type, std::string > &stiOrLabel) const
template<typename HolderType = BaseHolder>
HolderType * getHolderForFeature (const TriggerElement::FeatureAccessHelper &fea) const
template<typename HolderType = BaseHolder>
std::vector< HolderType * > getAllHolders () const
template<typename HolderType = BaseHolder>
std::vector< HolderType * > getHoldersOfClid (class_id_type clid) const
sub_index_type getSubTypeIndex (class_id_type clid, const index_or_label_type &stiOrLabel) const
std::string getLabel (class_id_type clid, const index_or_label_type &stiOrLabel) const
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 Types

typedef std::map< sub_index_type, std::shared_ptr< BaseHolder > > IndexToHolderMap
typedef std::map< std::string, sub_index_typeLabelToSubIndexMap
typedef std::map< sub_index_type, std::string > SubIndexToLabelMap

Private Member Functions

BaseHoldergetBaseHolder (class_id_type clid, sub_index_type sti) const
template<typename T>
T * getCastHolder (BaseHolder *holder) const
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::map< class_id_type, IndexToHolderMapm_holderByClidAndIndex
std::map< class_id_type, SubIndexToLabelMapm_lookupLabels
std::map< class_id_type, LabelToSubIndexMapm_lookupSubIndex
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 21 of file TrigHolderStructure.h.

Member Typedef Documentation

◆ IndexToHolderMap

typedef std::map<sub_index_type, std::shared_ptr<BaseHolder> > HLT::TrigHolderStructure::IndexToHolderMap
private

Definition at line 112 of file TrigHolderStructure.h.

◆ LabelToSubIndexMap

typedef std::map<std::string,sub_index_type> HLT::TrigHolderStructure::LabelToSubIndexMap
private

Definition at line 113 of file TrigHolderStructure.h.

◆ SubIndexToLabelMap

typedef std::map<sub_index_type,std::string> HLT::TrigHolderStructure::SubIndexToLabelMap
private

Definition at line 114 of file TrigHolderStructure.h.

Constructor & Destructor Documentation

◆ TrigHolderStructure()

HLT::TrigHolderStructure::TrigHolderStructure ( )

Definition at line 7 of file TrigHolderStructure.cxx.

7 : asg::AsgMessaging("TrigHolderStructure"){
8}

Member Function Documentation

◆ getAllHolders()

template<typename HolderType = BaseHolder>
std::vector< HolderType * > HLT::TrigHolderStructure::getAllHolders ( ) const
inline

Definition at line 40 of file TrigHolderStructure.h.

40 {
41 std::vector<HolderType*> result;
42 for(auto& clid_indexmap : m_holderByClidAndIndex){
43 for(auto& index_holder : clid_indexmap.second){
44 result.push_back(getCastHolder<HolderType>(index_holder.second.get()));
45 }
46 }
47 return result;
48 }
T * getCastHolder(BaseHolder *holder) const
std::map< class_id_type, IndexToHolderMap > m_holderByClidAndIndex

◆ getBaseHolder()

HLT::BaseHolder * HLT::TrigHolderStructure::getBaseHolder ( class_id_type clid,
sub_index_type sti ) const
private

Definition at line 16 of file TrigHolderStructure.cxx.

16 {
17 if( sti == HLT::invalid_sub_index){
18 ATH_MSG_DEBUG("requested holder with invalid sub_type_index");
19 return 0;
20 }
21 auto allsti_it = m_holderByClidAndIndex.find(clid);
22 if(allsti_it == m_holderByClidAndIndex.end()){
23 return 0;
24 }
25 auto sti_holder_map = allsti_it->second;
26 auto holder_it = sti_holder_map.find(sti);
27 if(holder_it == sti_holder_map.end()){
28 return 0;
29 }
30 return holder_it->second.get();
31}
#define ATH_MSG_DEBUG(x)
static const index_type invalid_sub_index

◆ getCastHolder()

template<typename T>
T * HLT::TrigHolderStructure::getCastHolder ( BaseHolder * holder) const
inlineprivate

Definition at line 101 of file TrigHolderStructure.h.

101 {
102 if(!holder){
103 return 0;
104 }
105 auto cast_holder = dynamic_cast<T*>(holder);
106 if(!cast_holder){
107 ATH_MSG_ERROR("cast failed");
108 }
109 return cast_holder;
110 }
#define ATH_MSG_ERROR(x)
unsigned long long T

◆ getHolder()

template<typename HolderType = BaseHolder>
HolderType * HLT::TrigHolderStructure::getHolder ( class_id_type clid,
const std::variant< sub_index_type, std::string > & stiOrLabel ) const
inline

Definition at line 30 of file TrigHolderStructure.h.

30 {
31 return getCastHolder<HolderType>(getBaseHolder(clid,getSubTypeIndex(clid,stiOrLabel)));
32 }
BaseHolder * getBaseHolder(class_id_type clid, sub_index_type sti) const
sub_index_type getSubTypeIndex(class_id_type clid, const index_or_label_type &stiOrLabel) const

◆ getHolderForFeature()

template<typename HolderType = BaseHolder>
HolderType * HLT::TrigHolderStructure::getHolderForFeature ( const TriggerElement::FeatureAccessHelper & fea) const
inline

Definition at line 35 of file TrigHolderStructure.h.

35 {
36 return getCastHolder<HolderType>(getBaseHolder(fea.getCLID(),fea.getIndex().subTypeIndex()));
37 }

◆ getHoldersOfClid()

template<typename HolderType = BaseHolder>
std::vector< HolderType * > HLT::TrigHolderStructure::getHoldersOfClid ( class_id_type clid) const
inline

Definition at line 51 of file TrigHolderStructure.h.

51 {
52 std::vector<HolderType*> result;
53 auto lookup_it = m_holderByClidAndIndex.find(clid);
54 if(lookup_it == m_holderByClidAndIndex.end()) return result;
55
56 for(auto& index_holder : lookup_it->second){
57 result.push_back(getCastHolder<HolderType>(index_holder.second.get()));
58 }
59 return result;
60 }

◆ getLabel()

std::string HLT::TrigHolderStructure::getLabel ( class_id_type clid,
const index_or_label_type & stiOrLabel ) const
inline

Definition at line 78 of file TrigHolderStructure.h.

78 {
79 //short circuit for sub_index_type because that case is valid whether we have a map or not. (visitor only works with map)
80 if (stiOrLabel.index() == 1){
81 return std::get<std::string>(stiOrLabel);
82 }
83
84 std::string invalid_label = "inavalid_label";
85
86 auto lookup_it = m_lookupLabels.find(clid);
87 if(lookup_it == m_lookupLabels.end()) return invalid_label;
88
89 auto it = lookup_it->second.find(std::get<sub_index_type>(stiOrLabel));
90 if(it==lookup_it->second.end()) return invalid_label;
91
92 return it->second;
93 }
std::map< class_id_type, SubIndexToLabelMap > m_lookupLabels

◆ getSubTypeIndex()

sub_index_type HLT::TrigHolderStructure::getSubTypeIndex ( class_id_type clid,
const index_or_label_type & stiOrLabel ) const
inline

Definition at line 63 of file TrigHolderStructure.h.

63 {
64 //short circuit for sub_index_type because that case is valid whether we have a map or not. (visitor only works with map)
65 if (stiOrLabel.index() == 0){
66 return std::get<sub_index_type>(stiOrLabel);
67 }
68
69 auto lookup_it = m_lookupSubIndex.find(clid);
70 if(lookup_it == m_lookupSubIndex.end()) return invalid_sub_index;
71
72 auto it = lookup_it->second.find(std::get<std::string>(stiOrLabel));
73 if(it==lookup_it->second.end()) return invalid_sub_index;
74
75 return it->second;
76 }
std::map< class_id_type, LabelToSubIndexMap > m_lookupSubIndex

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

◆ registerHolder()

bool HLT::TrigHolderStructure::registerHolder ( const std::shared_ptr< BaseHolder > & holder)

Definition at line 34 of file TrigHolderStructure.cxx.

34 {
35 auto clid = holder->typeClid();
36 auto subtypeindex = holder->subTypeIndex();
37 const auto & label = holder->label();
38
39 if(getHolder(clid,subtypeindex)){
40 ATH_MSG_WARNING("we already have a holder like this! clid:" << clid << " subtypeIndex: " << subtypeindex << " label: " << label);
41 return false;
42 }
43
44 m_holderByClidAndIndex[clid][subtypeindex] = holder;
45 m_lookupLabels[clid][subtypeindex] = label;
46 m_lookupSubIndex[clid][label] = subtypeindex;
47
48 return true;
49}
#define ATH_MSG_WARNING(x)
HolderType * getHolder(class_id_type clid, const std::variant< sub_index_type, std::string > &stiOrLabel) const
std::string label(const std::string &format, int i)
Definition label.h:19

◆ reset()

void HLT::TrigHolderStructure::reset ( )

Definition at line 10 of file TrigHolderStructure.cxx.

10 {
12 m_lookupLabels.clear();
13 m_lookupSubIndex.clear();
14}

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

std::map<class_id_type, IndexToHolderMap> HLT::TrigHolderStructure::m_holderByClidAndIndex
private

Definition at line 116 of file TrigHolderStructure.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lookupLabels

std::map<class_id_type, SubIndexToLabelMap > HLT::TrigHolderStructure::m_lookupLabels
private

Definition at line 118 of file TrigHolderStructure.h.

◆ m_lookupSubIndex

std::map<class_id_type, LabelToSubIndexMap > HLT::TrigHolderStructure::m_lookupSubIndex
private

Definition at line 119 of file TrigHolderStructure.h.

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


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