9#include "CoralBase/Date.h"
10#include "CoralBase/TimeStamp.h"
21 if (log.level() <= MSG::DEBUG) {
22 log << MSG::DEBUG <<
"IOVPayloadContainerCnv_p1::persToTrans - entering "
43 bool isEarlyVersion = persObj->
m_attrType.size() > 0;
53 payloadVec.push_back(transColl);
56 typedef std::vector<IOVPayloadContainer_p1::CondAttrListEntry_p1>::const_iterator attrListIt_t;
58 attrListIt_t itattrList = persColl.
m_attrLists.begin();
59 attrListIt_t lastAttrList = persColl.
m_attrLists.end();
60 for (; itattrList != lastAttrList; ++itattrList) {
64 coral::AttributeList attrList;
67 unsigned int inameOld = 0;
68 for (
unsigned int iattr = entry.m_firstIndex;
69 iattr < entry.m_lastIndex; ++iattr, ++inameOld) {
74 <<
"IOVPayloadContainerCnv_p1::persToTrans attribute index bigger than array size "
75 << iattr <<
" " << persObj->
m_attrIndexes.size() <<
" last index "
81 if (!isEarlyVersion) {
89 const std::string& name = persObj->
m_attrName[iname];
92 attrList.extend(name, typeName);
99 bool indexesOK =
true;
102 log << MSG::WARNING <<
"IOVPayloadContainerCnv_p1::persToTrans name index bigger than name/type size. index "
103 << inameOld <<
" name size " << persObj->
m_attrName.size()
104 <<
" attr size " << persObj->
m_attrType.size()
105 <<
" last index " << entry.m_lastIndex
106 <<
" Most likely unfilled attribute list. Skipping to the next attrlist entry."
116 const std::string& name = persObj->
m_attrName[inameOld];
117 unsigned int itype = persObj->
m_attrType[inameOld];
120 attrList.extend(name, typeName);
125 std::string typeName;
126 unsigned int itype = indexes.
typeIndex();
127 typedef std::map<std::string, unsigned int>::const_iterator it_type;
130 for (; typeIt != endType; ++typeIt) {
131 if (itype == typeIt->second) {
132 typeName = typeIt->first;
136 std::string name =
"unknown";
137 attrList.extend(name, typeName);
161 transColl->
add(entry.m_channelNumber, attrList);
163 bool hasIOV = !(entry.m_range.m_start == 0 && entry.m_range.m_stop == 0);
171 start.setRETime(entry.m_range.m_start);
172 stop.setRETime(entry.m_range.m_stop);
173 transColl->
add(entry.m_channelNumber,
IOVRange(start, stop));
179 start.setTimestamp(entry.m_range.m_start);
180 stop.setTimestamp(entry.m_range.m_stop);
181 transColl->
add(entry.m_channelNumber,
IOVRange(start, stop));
186 if (entry.m_name.size()) {
187 transColl->
add(entry.m_channelNumber, entry.m_name);
196 bool setStart = (persColl.
m_start !=
static_cast<uint64_t
>(-1));
199 if (setStart) start.setRETime ( persColl.
m_start );
200 stop.setRETime ( persColl.
m_stop );
204 if (setStart) start.setTimestamp( persColl.
m_start );
205 stop.setTimestamp( persColl.
m_stop );
217 if (log.level() <= MSG::DEBUG) {
218 log << MSG::DEBUG <<
"IOVPayloadContainerCnv_p1::transToPers "
231 if (log.level() <= MSG::DEBUG) {
232 log << MSG::DEBUG <<
"IOVPayloadContainerCnv_p1::transToPers - empty attr list spec "
242 unsigned int ipcoll = 0;
245 for (; it != last; ++it, ++ipcoll) {
253 if (isRunLumiBlock) {
271 unsigned int ientry = 0;
272 for (; itAttr != lastAttr; ++itAttr, ++ientry) {
275 unsigned int chan = (*itAttr).first;
276 entry.m_channelNumber = chan;
280 entry.m_range.m_start = 0;
281 entry.m_range.m_stop = 0;
285 if (iovIt != tColl->
iov_end()) {
287 if (isRunLumiBlock) {
288 entry.m_range.m_start = iovIt->second.start().re_time();
289 entry.m_range.m_stop = iovIt->second.stop().re_time();
292 entry.m_range.m_start = iovIt->second.start().timestamp();
293 entry.m_range.m_stop = iovIt->second.stop().timestamp();
298 std::string name = tColl->
chanName(chan);
300 entry.m_name = std::move(name);
305 const coral::AttributeList& attrList = (*itAttr).second;
307 coral::AttributeList::const_iterator itAttr = attrList.begin();
308 coral::AttributeList::const_iterator itLast = attrList.end();
309 for (; itAttr != itLast; ++itAttr) {
311 std::string typeName = itAttr->specification().typeName();
312 std::map<std::string, unsigned int>::const_iterator attIt =
315 log << MSG::ERROR <<
"IOVPayloadContainerCnv_p1::transToPers - cannot find attibute type in map - name "
319 unsigned int itype = attIt->second;
321 std::string name = itAttr->specification().name();
324 log << MSG::ERROR <<
"IOVPayloadContainerCnv_p1::transToPers - cannot find attibute name in map - name "
328 unsigned int iname = attIt->second;
347 if (log.level() <= MSG::DEBUG) {
348 log << MSG::DEBUG <<
"IOVPayloadContainerCnv_p1::fillPersAttrSpec IOVPayloadContainer size "
359 std::set<std::string> names;
363 for (; itPayload != itPayloadEnd; ++itPayload) {
368 for (; itColl != itCollEnd; ++itColl) {
369 const coral::AttributeList& attrList = itColl->second;
371 coral::AttributeList::const_iterator it = attrList.begin();
372 coral::AttributeList::const_iterator last = attrList.end();
373 for (; it != last; ++it) {
374 const coral::Attribute& attr = *it;
375 std::string name = attr.specification().name();
376 std::string typeName = attr.specification().typeName();
379 names.insert(std::move(name));
387 unsigned int iname = 0;
389 std::set<std::string>::iterator itName = names.begin();
390 std::set<std::string>::iterator itNameEnd = names.end();
391 for (; itName != itNameEnd; ++itName) {
398 if (log.level() <= MSG::DEBUG) {
399 log << MSG::DEBUG <<
"IOVPayloadContainerCnv_p1::fillPersAttrSpec number of attribute names "
400 << names.size() <<
endmsg;
452 unsigned int attrType,
453 const coral::Attribute& attr,
463 persObj->
m_bool.push_back(attr.data<
bool>());
468 persObj->
m_char.push_back(attr.data<
char>());
479 persObj->
m_short.push_back(attr.data<
short>());
490 persObj->
m_int.push_back(attr.data<
int>());
501 persObj->
m_long.push_back(attr.data<
long>());
512 persObj->
m_longLong.push_back(attr.data<
long long>());
523 persObj->
m_float.push_back(attr.data<
float>());
528 persObj->
m_double.push_back(attr.data<
double>());
538 persObj->
m_string.push_back(attr.data<std::string>());
542 <<
"IOVPayloadContainerCnv_p1::fillAttributeData - cannot currently treat BLOB type "
548 persObj->
m_date.push_back(coral::TimeStamp(attr.data<coral::Date>().time()).total_nanoseconds() );
554 persObj->
m_timeStamp.push_back( attr.data<coral::TimeStamp>().total_nanoseconds() );
563 const std::string& name,
564 coral::AttributeList& attrList,
589 unsigned int objIndex =
index.objIndex();
590 unsigned int itype =
index.typeIndex();
605 switch (
index.typeIndex()) {
607 attrList[name].setValue(persObj->
m_bool[objIndex + offset]);
610 attrList[name].setValue(persObj->
m_char[objIndex + offset]);
613 attrList[name].setValue(persObj->
m_unsignedChar[objIndex + offset]);
616 attrList[name].setValue(persObj->
m_short[objIndex + offset]);
622 attrList[name].setValue(persObj->
m_int[objIndex + offset]);
625 attrList[name].setValue(persObj->
m_unsignedInt[objIndex + offset]);
628 attrList[name].setValue(persObj->
m_long[objIndex + offset]);
631 attrList[name].setValue(persObj->
m_unsignedLong[objIndex + offset]);
634 attrList[name].setValue(persObj->
m_longLong[objIndex + offset]);
640 attrList[name].setValue(persObj->
m_float[objIndex + offset]);
643 attrList[name].setValue(persObj->
m_double[objIndex + offset]);
649 attrList[name].setValue(persObj->
m_string[objIndex + offset]);
653 <<
"IOVPayloadContainerCnv_p1::fillAttributeData - cannot currently treat BLOB type "
658 coral::TimeStamp::ValueType ns( persObj->
m_date[objIndex + offset] );
659 attrList[name].setValue( coral::Date(coral::TimeStamp(ns).time()) );
664 coral::TimeStamp::ValueType ns =
665 coral::TimeStamp::ValueType( persObj->
m_timeStamp[objIndex + offset] );
666 attrList[name].setValue( coral::TimeStamp(ns) );
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
This class is a container for the payload of conditions data.
This class is the persistent version of a container for the payload of conditions data.
Indexes to attribute name, type name and object value for the persistent storage of an attribute list...
unsigned short nameIndex() const
Index into attribute name vector.
unsigned short typeIndex() const
Index into the type name vector.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
void addNewStart(const IOVTime &start)
Add new start time to minRange - make sure that start is >= to new start.
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
iov_const_iterator iov_end() const
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop.
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
const IOVRange & minRange() const
Current minimal IOVRange.
size_type size() const
number of Chan/AttributeList pairs
iov_const_iterator chanIOVPair(ChanNum chanNum) const
Access to Chan/IOV pairs via channel number: returns map iterator.
ChanAttrListMap::const_iterator const_iterator
ChanIOVMap::const_iterator iov_const_iterator
std::vector< std::string > m_attributeTypes
void fillAttributeTypeMap()
std::map< std::string, unsignedint >::value_type attrNameMapValue_t
virtual void persToTrans(const IOVPayloadContainer_p1 *persObj, IOVPayloadContainer *transObj, MsgStream &log)
std::map< std::string, unsigned int > m_attrNameMap
void fillAttributeData(unsigned int attrName, unsigned int attrType, const coral::Attribute &attr, IOVPayloadContainer_p1 *persObj, MsgStream &log)
unsigned int m_objIndexOffset[IOVPayloadContainer_p1::ATTR_TIME_STAMP+1]
void fillPersAttrSpec(const IOVPayloadContainer *transObj, IOVPayloadContainer_p1 *persObj, MsgStream &log)
IOVPayloadContainerCnv_p1()
std::map< std::string, unsigned int > m_attributeTypeMap
virtual void transToPers(const IOVPayloadContainer *transObj, IOVPayloadContainer_p1 *persObj, MsgStream &log)
std::vector< CondAttrListEntry_p1 > m_attrLists
unsigned long long m_start
unsigned long long m_stop
bool m_hasRunLumiBlockTime
std::vector< CondAttrListCollection_p1 > m_payloadVec
std::vector< unsigned char > m_unsignedChar
std::vector< double > m_double
std::vector< unsigned short > m_unsignedShort
std::vector< long long > m_longLong
std::vector< unsigned int > m_unsignedInt
std::vector< bool > m_bool
std::vector< std::string > m_attrName
std::vector< unsigned long long > m_unsignedLongLong
std::vector< short > m_short
std::vector< unsigned int > m_attrType
@ ATTR_UNSIGNED_LONG_LONG
std::vector< std::string > m_string
std::vector< unsigned long long > m_date
std::vector< unsigned long > m_unsignedLong
std::vector< float > m_float
std::vector< AttrListIndexes > m_attrIndexes
std::vector< long > m_long
std::vector< char > m_char
std::vector< unsigned long long > m_timeStamp
This class is a container for the payload of conditions data.
size_type size() const
size of payload vector
payloadVec::const_iterator const_iterator
const_iterator begin() const
Begin of payload vector.
const_iterator end() const
End of payload vector.
std::vector< CondAttrListCollection * > payloadVec
const IOVTime & stop() const
const IOVTime & start() const
Basic time unit for IOVSvc.
uint64_t timestamp() const noexcept
uint64_t re_time() const noexcept
bool isRunEvent() const noexcept