16#ifndef DBDATAOBJECTS_CONDATTRLISTCOLLECTION_H
17#define DBDATAOBJECTS_CONDATTRLISTCOLLECTION_H
20#include "CoralBase/Attribute.h"
21#include "CoralBase/AttributeList.h"
22#include "CoralBase/AttributeListSpecification.h"
26#include "GaudiKernel/DataObject.h"
162 void dump(std::ostringstream& stream)
const;
179 bool ignoreIOVs =
false)
const;
196 coral::AttributeListSpecification*
m_spec;
201#include "AthenaKernel/CondCont.h"
238 DataObject::DataObject(rhs),
249 m_spec=new coral::AttributeListSpecification();
250 const coral::AttributeList& atr1=rhs.m_attrMap.begin()->second;
251 for (const auto& attr : atr1) {
252 const coral::AttributeSpecification& aspec=attr.specification();
253 m_spec->extend(aspec.name(),aspec.typeName());
256 auto newit = m_attrMap.try_emplace(chanNum, *m_spec, true).first;
257 newit->second.fastCopyData(attrList);
395 else return (0xFFFF);
430 static const std::string name;
454 m_spec=
new coral::AttributeListSpecification();
456 const coral::AttributeSpecification& aspec=attr.specification();
457 m_spec->extend(aspec.name(),aspec.typeName());
471 m_spec=
new coral::AttributeListSpecification();
473 const coral::AttributeSpecification& aspec=attr.specification();
474 m_spec->extend(aspec.name(),aspec.typeName());
489 if (
m_minRange.start() < range.start()) start = range.start();
491 if (range.stop() <
m_minRange.stop()) stop = range.stop();
540 for (; it1 != last1; ++it1) {
541 const IOVTime& start = (*it1).second.start();
542 const IOVTime& stop = (*it1).second.stop();
559 std::cout <<
"min range: " <<
m_minRange << std::endl;
563 std::cout <<
"chan, attr: " <<
chanNum << std::endl;
564 attrList.toOutputStream(std::cout) << std::endl;
568 std::cout <<
"chan, iov: " <<
chanNum << std::endl;
569 std::cout << iov << std::endl;
573 std::cout <<
"chan, name: " <<
chanNum << std::endl;
574 std::cout << name << std::endl;
585 stream <<
"chan, iov: " <<
chanNum <<
" " << iov << std::endl;
589 stream <<
"chan, attr: " <<
chanNum << std::endl;
590 attrList.toOutputStream(stream) << std::endl;
594 stream <<
"chan, name: " <<
chanNum <<
" " << name << std::endl;
616 return (!((*
this) == rhs));
622 bool ignoreIOVs )
const
638 for (; it1 != end1; ++it1, ++it2) {
639 if (it1->first != it2->first)
return false;
640 if (it1->second != it2->second)
return false;
648 for (; it3 != end3; ++it3, ++it4) {
649 if (it3->first != it4->first)
return false;
650 if (it3->second != it4->second)
return false;
657 for (; it5 != end5; ++it5, ++it6) {
658 if (it5->first != it6->first)
return false;
659 if (it5->second != it6->second)
return false;
671 if (attrRet.second)
m_attrMap.erase(oldChan);
675 if (iovRet.second)
m_iovMap.erase(oldChan);
679 if (nameRet.second)
m_nameMap.erase(oldChan);
681 return attrRet.first->first == newChan
682 && iovRet.first->first == newChan
683 && nameRet.first->first == newChan;
#define CONDCONT_DEF(...)
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
This class is a collection of AttributeLists where each one is associated with a channel number.
const AttributeList & attributeList(ChanNum chanNum) const
attribute list for a given channel number
ChanNum chanNum(unsigned int index) const
channel number for index: (index = 0 to size-1)
const_iterator end() const
void addNewStart(const IOVTime &start)
Add new start time to minRange - make sure that start is >= to new start.
ChanNameMap::size_type name_size_type
name_const_iterator name_begin() const
Access to Chan/Name pairs via iterators.
name_size_type name_size() const
number of Chan/Name pairs
bool operator!=(const CondAttrListCollection &rhs) const
Comparison operator.
std::map< ChanNum, std::string > ChanNameMap
ChanIOVMap::value_type ChanIOVPair
ChanIOVMap::iterator iov_iterator
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
bool hasUniqueIOV() const
Check whether there is a unique IOV for all channels.
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
bool isSameButMinRange(const CondAttrListCollection &rhs, bool ignoreIOVs=false) const
Equal operator which ignores minRange.
iov_const_iterator iov_end() const
coral::AttributeListSpecification * m_spec
ChanNameMap::value_type ChanNamePair
iov_const_iterator iov_begin() const
Access to Chan/IOV pairs via iterators.
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop.
void dump() const
Dump our contents to std::cout.
ChanAttrListMap::size_type size_type
std::map< ChanNum, IOVRange > ChanIOVMap
CondAttrListCollection & operator=(const CondAttrListCollection &rhs)=delete
ChanIOVMap::size_type iov_size_type
bool m_hasRunLumiBlockTime
CondAttrListCollection(bool hasRunLumiBlockTime)
Constructor with specification for type of time: run/lumiBlock or timestamp.
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
bool fixChanNum(ChanNum oldChan, ChanNum newChan)
void resetMinRange()
Reset minRange according to the IOVs of the contained channels.
const IOVRange & minRange() const
Current minimal IOVRange.
name_const_iterator name_end() const
name_const_iterator chanNamePair(ChanNum chanNum) const
Access to Chan/Name pairs via channel number: returns map iterator.
size_type size() const
number of Chan/AttributeList pairs
ChanAttrListMap::iterator iterator
ChanNameMap::iterator name_iterator
iov_const_iterator chanIOVPair(ChanNum chanNum) const
Access to Chan/IOV pairs via channel number: returns map iterator.
ChanAttrListMap m_attrMap
ChanAttrListMap::value_type ChanAttrListPair
ChanAttrListMap::const_iterator const_iterator
void addShared(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs with shared data.
ChanNameMap::const_iterator name_const_iterator
iov_size_type iov_size() const
number of Chan/IOV pairs
~CondAttrListCollection()
bool operator==(const CondAttrListCollection &rhs) const
Equal operator.
ChanIOVMap::const_iterator iov_const_iterator
const_iterator chanAttrListPair(ChanNum chanNum) const
Access to Chan/AttributeList pairs via channel number: returns map iterator.
std::map< ChanNum, coral::AttributeList > ChanAttrListMap
coral::AttributeList AttributeList
const IOVRange & iovRange(ChanNum chanNum) const
IOVRange list for a given channel number.
CondAttrListCollection()
Default constructor - we hide it to prevent clients from using it - forcing them to specify the type ...
Basic time unit for IOVSvc.
static constexpr uint64_t MAXTIMESTAMP
static constexpr uint32_t MAXRUN
static constexpr uint32_t MINEVENT
static constexpr uint64_t MINTIMESTAMP
static constexpr uint32_t MAXEVENT
static constexpr uint32_t MINRUN
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string