ATLAS Offline Software
Loading...
Searching...
No Matches
CondAttrListVec Class Reference

#include <CondAttrListVec.h>

Inheritance diagram for CondAttrListVec:
Collaboration diagram for CondAttrListVec:

Classes

struct  Index

Public Types

typedef std::pair< unsigned int, coral::AttributeList > AttrListPair
typedef std::vector< AttrListPairAttrListVec
typedef std::vector< coral::AttributeList >::const_iterator AttrListDataIter
typedef AttrListVec::const_iterator const_iterator
typedef AttrListVec::size_type size_type
typedef std::map< unsigned int, IOVRangeAttrListIOVMap
typedef AttrListIOVMap::const_iterator iov_const_iterator
typedef AttrListIOVMap::size_type iov_size_type
typedef std::map< unsigned int, std::vector< const coral::AttributeList * > > AttrListCVMap

Public Member Functions

 CondAttrListVec (bool runevent)
 CondAttrListVec (bool runevent, size_type nelm)
 ~CondAttrListVec ()
 CondAttrListVec (const CondAttrListVec &rhs)
CondAttrListVecoperator= (const CondAttrListVec &rhs)=delete
const_iterator begin () const
const_iterator end () const
size_type size () const
iov_const_iterator iov_begin () const
iov_const_iterator iov_end () const
iov_const_iterator iovRange (const unsigned int channel) const
size_type iov_size () const
const IOVRangeminRange () const
bool hasUniqueIOV () const
void add (const IOVRange &range, const unsigned int chan, AttrListDataIter data_begin, AttrListDataIter data_end)
void addSlice (const IOVRange &range, const unsigned int chan, const std::vector< coral::AttributeList > &data, const unsigned int datastart, const unsigned int dataend)
void addNewStop (const IOVTime &stop)
const std::vector< unsigned int > & channelIDs () const
bool hasChannel (const int chan) const
const std::vector< const coral::AttributeList * > & attrListVec (const int chan) const

Private Member Functions

 CondAttrListVec ()
const Indexindex () const

Private Attributes

AttrListVec m_data
AttrListIOVMap m_iovmap
IOVRange m_minrange
bool m_uniqueiov
bool m_runevent
coral::AttributeListSpecification * m_spec
CxxUtils::CachedValue< Indexm_index

Detailed Description

Definition at line 30 of file CondAttrListVec.h.

Member Typedef Documentation

◆ AttrListCVMap

typedef std::map<unsigned int, std::vector<const coral::AttributeList*> > CondAttrListVec::AttrListCVMap

Definition at line 42 of file CondAttrListVec.h.

◆ AttrListDataIter

typedef std::vector<coral::AttributeList>::const_iterator CondAttrListVec::AttrListDataIter

Definition at line 35 of file CondAttrListVec.h.

◆ AttrListIOVMap

typedef std::map<unsigned int,IOVRange> CondAttrListVec::AttrListIOVMap

Definition at line 38 of file CondAttrListVec.h.

◆ AttrListPair

typedef std::pair<unsigned int,coral::AttributeList> CondAttrListVec::AttrListPair

Definition at line 33 of file CondAttrListVec.h.

◆ AttrListVec

Definition at line 34 of file CondAttrListVec.h.

◆ const_iterator

typedef AttrListVec::const_iterator CondAttrListVec::const_iterator

Definition at line 36 of file CondAttrListVec.h.

◆ iov_const_iterator

typedef AttrListIOVMap::const_iterator CondAttrListVec::iov_const_iterator

Definition at line 39 of file CondAttrListVec.h.

◆ iov_size_type

typedef AttrListIOVMap::size_type CondAttrListVec::iov_size_type

Definition at line 40 of file CondAttrListVec.h.

◆ size_type

typedef AttrListVec::size_type CondAttrListVec::size_type

Definition at line 37 of file CondAttrListVec.h.

Constructor & Destructor Documentation

◆ CondAttrListVec() [1/4]

CondAttrListVec::CondAttrListVec ( bool runevent)
inlineexplicit

Definition at line 127 of file CondAttrListVec.h.

127 :
130 m_uniqueiov(true),m_runevent(runevent),m_spec(nullptr) {
131 if (!runevent) m_minrange=IOVRange(IOVTime(IOVTime::MINTIMESTAMP),
132 IOVTime(IOVTime::MAXTIMESTAMP));
133}
coral::AttributeListSpecification * m_spec
static constexpr uint64_t MAXTIMESTAMP
Definition IOVTime.h:58
static constexpr uint32_t MAXRUN
Definition IOVTime.h:48
static constexpr uint32_t MINEVENT
Definition IOVTime.h:50
static constexpr uint64_t MINTIMESTAMP
Definition IOVTime.h:56
static constexpr uint32_t MAXEVENT
Definition IOVTime.h:51
static constexpr uint32_t MINRUN
Definition IOVTime.h:44

◆ CondAttrListVec() [2/4]

CondAttrListVec::CondAttrListVec ( bool runevent,
size_type nelm )
inline

Definition at line 135 of file CondAttrListVec.h.

135 :
138 m_uniqueiov(true),m_runevent(runevent),m_spec(nullptr) {
139 if (!runevent) m_minrange=IOVRange(IOVTime(IOVTime::MINTIMESTAMP),
140 IOVTime(IOVTime::MAXTIMESTAMP));
141 m_data.reserve(nelm);
142}

◆ ~CondAttrListVec()

CondAttrListVec::~CondAttrListVec ( )
inline

Definition at line 145 of file CondAttrListVec.h.

145 {
146 if (m_spec) m_spec->release();
147}

◆ CondAttrListVec() [3/4]

CondAttrListVec::CondAttrListVec ( const CondAttrListVec & rhs)
inline

Definition at line 149 of file CondAttrListVec.h.

149 :
150 DataObject::DataObject(rhs),
151 m_iovmap(rhs.m_iovmap),
155 m_spec(nullptr)
156{
157 // members with normal semantics setup in initialisation list
158 // make a new cached AttributeListSpecification and make the payload use it
159 if (!rhs.m_data.empty()) {
160 m_spec=new coral::AttributeListSpecification();
161 const coral::AttributeList& atr1=rhs.m_data.begin()->second;
162 for (const auto& attr : atr1) {
163 const coral::AttributeSpecification& aspec=attr.specification();
164 m_spec->extend(aspec.name(),aspec.typeName());
165 }
166 for (const auto& [chan, attrList] : rhs.m_data) {
167 m_data.push_back(AttrListPair(chan,
168 coral::AttributeList(*m_spec,true)));
169 (m_data.back().second).fastCopyData(attrList);
170 }
171 }
172}
AttrListIOVMap m_iovmap
std::pair< unsigned int, coral::AttributeList > AttrListPair

◆ CondAttrListVec() [4/4]

CondAttrListVec::CondAttrListVec ( )
private

Member Function Documentation

◆ add()

void CondAttrListVec::add ( const IOVRange & range,
const unsigned int chan,
AttrListDataIter data_begin,
AttrListDataIter data_end )
inline

Definition at line 238 of file CondAttrListVec.h.

240 {
241 //invalidate index
242 m_index.reset();
243 // set minimum range correctly
244 IOVTime start=m_minrange.start();
245 if (m_minrange.start()<range.start()) start=range.start();
246 IOVTime stop = m_minrange.stop();
247 if (range.stop()<m_minrange.stop()) stop=range.stop();
248 m_minrange=IOVRange(start,stop);
249 if (m_uniqueiov && range!=m_minrange) m_uniqueiov=false;
250 // store attributeList if needed
251 if (!m_spec && data_begin!=data_end) {
252 m_spec=new coral::AttributeListSpecification();
253 for (const auto& attr : *data_begin) {
254 const coral::AttributeSpecification& aspec=attr.specification();
255 m_spec->extend(aspec.name(),aspec.typeName());
256 }
257 }
258 // copy in data
259 for (AttrListDataIter itr=data_begin;itr!=data_end;++itr) {
260 m_data.push_back(AttrListPair(chan,coral::AttributeList(*m_spec,true)));
261 (m_data.back().second).fastCopyData(*itr);
262 }
264}
std::vector< coral::AttributeList >::const_iterator AttrListDataIter
CxxUtils::CachedValue< Index > m_index

◆ addNewStop()

void CondAttrListVec::addNewStop ( const IOVTime & stop)
inline

Definition at line 298 of file CondAttrListVec.h.

298 {
299 if (stop<m_minrange.stop()) m_minrange=IOVRange(m_minrange.start(),stop);
300}

◆ addSlice()

void CondAttrListVec::addSlice ( const IOVRange & range,
const unsigned int chan,
const std::vector< coral::AttributeList > & data,
const unsigned int datastart,
const unsigned int dataend )
inline

Definition at line 266 of file CondAttrListVec.h.

271{
272 // invalidate index
273 m_index.reset();
274 // set minimum range correctly
275 IOVTime start=m_minrange.start();
276 if (m_minrange.start()<range.start()) start=range.start();
277 IOVTime stop = m_minrange.stop();
278 if (range.stop()<m_minrange.stop()) stop=range.stop();
279 m_minrange=IOVRange(start,stop);
280 if (m_uniqueiov && range!=m_minrange) m_uniqueiov=false;
281 // store attributeList if needed
282 if (!m_spec && datastart!=dataend) {
283 m_spec=new coral::AttributeListSpecification();
284 const coral::AttributeList& atr0=data[datastart];
285 for (const auto& attr : atr0) {
286 const coral::AttributeSpecification& aspec=attr.specification();
287 m_spec->extend(aspec.name(),aspec.typeName());
288 }
289 }
290 // copy in data
291 for (unsigned int i=datastart;i<dataend;++i) {
292 m_data.push_back(AttrListPair(chan,coral::AttributeList(*m_spec,true)));
293 (m_data.back().second).merge(data[i]);
294 }
296}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11

◆ attrListVec()

const std::vector< const coral::AttributeList * > & CondAttrListVec::attrListVec ( const int chan) const
inline

Definition at line 312 of file CondAttrListVec.h.

313{
315 AttrListCVMap::const_iterator it = m.find (chan);
316 if (it != m.end()) {
317 return it->second;
318 }
319 static const std::vector<const coral::AttributeList*> dum;
320 return dum;
321}
std::map< unsigned int, std::vector< const coral::AttributeList * > > AttrListCVMap
const Index & index() const
AttrListCVMap m_indexchanvec

◆ begin()

CondAttrListVec::const_iterator CondAttrListVec::begin ( ) const
inline

Definition at line 209 of file CondAttrListVec.h.

210{ return m_data.begin(); }

◆ channelIDs()

const std::vector< unsigned int > & CondAttrListVec::channelIDs ( ) const
inline

Definition at line 302 of file CondAttrListVec.h.

302 {
303 return index().m_indexchan;
304}
std::vector< unsigned int > m_indexchan

◆ end()

CondAttrListVec::const_iterator CondAttrListVec::end ( ) const
inline

Definition at line 212 of file CondAttrListVec.h.

213{ return m_data.end(); }

◆ hasChannel()

bool CondAttrListVec::hasChannel ( const int chan) const
inline

Definition at line 306 of file CondAttrListVec.h.

306 {
308 return (m.find(chan)!=m.end());
309}

◆ hasUniqueIOV()

bool CondAttrListVec::hasUniqueIOV ( ) const
inline

Definition at line 234 of file CondAttrListVec.h.

235{return m_uniqueiov; }

◆ index()

const CondAttrListVec::Index & CondAttrListVec::index ( ) const
inlineprivate

Definition at line 324 of file CondAttrListVec.h.

325{
326 if (!m_index.isValid()) {
327 Index index;
328
329 // loop over all the elements, build vector of AttributeList for each channel
330 // and a vector of all the channels
331 for (const AttrListPair& p : m_data) {
332 unsigned int chan=p.first;
333 AttrListCVMap::iterator clist=index.m_indexchanvec.find(chan);
334 if (clist==index.m_indexchanvec.end()) {
335 // channel not seen before, create a new entry in map and vector
336 std::pair<AttrListCVMap::iterator,bool> res=
337 index.m_indexchanvec.insert(AttrListCVMap::value_type(chan,
338 std::vector<const coral::AttributeList*>()));
339 clist=res.first;
340 index.m_indexchan.push_back(chan);
341 }
342 clist->second.push_back(&(p.second));
343 }
344
345 m_index.set (std::move (index));
346 }
347 return *m_index.ptr();
348}
std::pair< std::vector< unsigned int >, bool > res

◆ iov_begin()

CondAttrListVec::iov_const_iterator CondAttrListVec::iov_begin ( ) const
inline

Definition at line 218 of file CondAttrListVec.h.

219{ return m_iovmap.begin(); }

◆ iov_end()

CondAttrListVec::iov_const_iterator CondAttrListVec::iov_end ( ) const
inline

Definition at line 221 of file CondAttrListVec.h.

222{ return m_iovmap.end(); }

◆ iov_size()

CondAttrListVec::size_type CondAttrListVec::iov_size ( ) const
inline

Definition at line 228 of file CondAttrListVec.h.

229{ return m_iovmap.size(); }

◆ iovRange()

CondAttrListVec::iov_const_iterator CondAttrListVec::iovRange ( const unsigned int channel) const
inline

Definition at line 225 of file CondAttrListVec.h.

226{ return m_iovmap.find(channel); }

◆ minRange()

const IOVRange & CondAttrListVec::minRange ( ) const
inline

Definition at line 231 of file CondAttrListVec.h.

232{ return m_minrange; }

◆ operator=()

CondAttrListVec & CondAttrListVec::operator= ( const CondAttrListVec & rhs)
delete

◆ size()

CondAttrListVec::size_type CondAttrListVec::size ( ) const
inline

Definition at line 215 of file CondAttrListVec.h.

216{ return m_data.size(); }

Member Data Documentation

◆ m_data

AttrListVec CondAttrListVec::m_data
private

Definition at line 110 of file CondAttrListVec.h.

◆ m_index

CxxUtils::CachedValue<Index> CondAttrListVec::m_index
private

Definition at line 117 of file CondAttrListVec.h.

◆ m_iovmap

AttrListIOVMap CondAttrListVec::m_iovmap
private

Definition at line 111 of file CondAttrListVec.h.

◆ m_minrange

IOVRange CondAttrListVec::m_minrange
private

Definition at line 112 of file CondAttrListVec.h.

◆ m_runevent

bool CondAttrListVec::m_runevent
private

Definition at line 114 of file CondAttrListVec.h.

◆ m_spec

coral::AttributeListSpecification* CondAttrListVec::m_spec
private

Definition at line 115 of file CondAttrListVec.h.

◆ m_uniqueiov

bool CondAttrListVec::m_uniqueiov
private

Definition at line 113 of file CondAttrListVec.h.


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