ATLAS Offline Software
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
MetaCont< T > Class Template Reference

#include <MetaCont.h>

Inheritance diagram for MetaCont< T >:
Collaboration diagram for MetaCont< T >:

Public Types

typedef T Payload_t
 
typedef SG::SourceID SourceID
 

Public Member Functions

 MetaCont ()
 
 ~MetaCont ()
 
virtual bool insert (const SourceID &sid, void *obj) override final
 
virtual size_t erase (const SourceID &sid) override final
 
virtual int entries () const override
 
virtual bool valid (const SourceID &sid) const override final
 
virtual std::vector< SourceIDsources () const override final
 
virtual void list (std::ostringstream &stream) const override final
 
bool insert (const SourceID &sid, T *t)
 
bool find (const SourceID &sid, T *&t) const
 various Get methods More...
 
T * get (const SourceID &sid) const
 
void * getAsVoid (const SourceID &sid) const override final
 

Private Types

typedef std::map< SourceID, T * > MetaContSet
 

Private Attributes

std::mutex m_mut
 
MetaContSet m_metaSet
 

Detailed Description

template<typename T>
class MetaCont< T >

Definition at line 48 of file MetaCont.h.

Member Typedef Documentation

◆ MetaContSet

template<typename T >
typedef std::map<SourceID,T*> MetaCont< T >::MetaContSet
private

Definition at line 82 of file MetaCont.h.

◆ Payload_t

template<typename T >
typedef T MetaCont< T >::Payload_t

Definition at line 50 of file MetaCont.h.

◆ SourceID

Definition at line 26 of file MetaCont.h.

Constructor & Destructor Documentation

◆ MetaCont()

template<typename T >
MetaCont< T >::MetaCont ( )
inline

Definition at line 54 of file MetaCont.h.

54 {};

◆ ~MetaCont()

template<typename T >
MetaCont< T >::~MetaCont

Definition at line 108 of file MetaCont.h.

108  {
109  for (auto t : m_metaSet) {
110  delete t.second;
111  }
112  m_metaSet.clear();
113 }

Member Function Documentation

◆ entries()

template<typename T >
int MetaCont< T >::entries
overridevirtual

Reimplemented from MetaContBase.

Definition at line 193 of file MetaCont.h.

193  {
194  std::lock_guard<std::mutex> lock(m_mut);
195  return m_metaSet.size();
196 }

◆ erase()

template<typename T >
size_t MetaCont< T >::erase ( const SourceID sid)
finaloverridevirtual

Implements MetaContBase.

Definition at line 126 of file MetaCont.h.

126  {
127  std::lock_guard<std::mutex> lock(m_mut);
128  return m_metaSet.erase(sid);
129 }

◆ find()

template<typename T >
bool MetaCont< T >::find ( const SourceID sid,
T *&  t 
) const

various Get methods

Definition at line 150 of file MetaCont.h.

150  {
151  std::lock_guard<std::mutex> lock(m_mut);
152 
153  typename MetaContSet::const_iterator itr = m_metaSet.find(sid);
154  if (itr != m_metaSet.end()) {
155  t=itr->second;
156  return true;
157  }
158 
159  return false;
160 }

◆ get()

template<typename T >
T * MetaCont< T >::get ( const SourceID sid) const

Definition at line 166 of file MetaCont.h.

166  {
167  std::lock_guard<std::mutex> lock(m_mut);
168 
169  typename MetaContSet::const_iterator itr = m_metaSet.find(sid);
170  if (itr != m_metaSet.end()) {
171  return itr->second;
172  }
173 
174  return nullptr;
175 }

◆ getAsVoid()

template<typename T >
void* MetaCont< T >::getAsVoid ( const SourceID sid) const
inlinefinaloverridevirtual

Implements MetaContBase.

Definition at line 76 of file MetaCont.h.

76 { return get(sid); }

◆ insert() [1/2]

template<typename T >
bool MetaCont< T >::insert ( const SourceID sid,
T *  t 
)

Definition at line 134 of file MetaCont.h.

134  {
135  std::lock_guard<std::mutex> lock(m_mut);
136  return m_metaSet.insert(std::make_pair(sid,t)).second;
137 }

◆ insert() [2/2]

template<typename T >
bool MetaCont< T >::insert ( const SourceID sid,
void *  obj 
)
finaloverridevirtual

Implements MetaContBase.

Definition at line 118 of file MetaCont.h.

118  {
119  T* t = static_cast<T*>(obj);
120  return insert(sid, t);
121 }

◆ list()

template<typename T >
void MetaCont< T >::list ( std::ostringstream &  stream) const
finaloverridevirtual

Implements MetaContBase.

Definition at line 181 of file MetaCont.h.

181  {
182  std::lock_guard<std::mutex> lock(m_mut);
183  // To Do: perhaps extend this output?
184  stream << "MetaCont with size : [" << m_metaSet.size() << "]" << std::endl;
185  for(const auto& mapel : m_metaSet) {
186  stream << "... Key : " << mapel.first << std::endl;
187  }
188 }

◆ sources()

template<typename T >
std::vector< MetaContBase::SourceID > MetaCont< T >::sources
finaloverridevirtual

Implements MetaContBase.

Definition at line 202 of file MetaCont.h.

202  {
203  std::lock_guard<std::mutex> lock(m_mut);
204 
205  std::vector<MetaContBase::SourceID> r;
206  for (auto ent : m_metaSet) {
207  r.push_back(ent.first);
208  }
209 
210  return r;
211 }

◆ valid()

template<typename T >
bool MetaCont< T >::valid ( const SourceID sid) const
finaloverridevirtual

Implements MetaContBase.

Definition at line 142 of file MetaCont.h.

142  {
143  std::lock_guard<std::mutex> lock(m_mut);
144  return m_metaSet.find(sid)!=m_metaSet.end();
145 }

Member Data Documentation

◆ m_metaSet

template<typename T >
MetaContSet MetaCont< T >::m_metaSet
private

Definition at line 83 of file MetaCont.h.

◆ m_mut

template<typename T >
std::mutex MetaCont< T >::m_mut
mutableprivate

Definition at line 80 of file MetaCont.h.


The documentation for this class was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
MetaCont::get
T * get(const SourceID &sid) const
Definition: MetaCont.h:166
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
MetaCont::insert
virtual bool insert(const SourceID &sid, void *obj) override final
Definition: MetaCont.h:118
MetaCont::m_metaSet
MetaContSet m_metaSet
Definition: MetaCont.h:83
MetaCont::m_mut
std::mutex m_mut
Definition: MetaCont.h:80
python.PyAthena.obj
obj
Definition: PyAthena.py:135
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35