ATLAS Offline Software
HLTExtraData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 
15 using namespace HLT;
16 
18  statusCode(0)
19 {
20 }
21 
22 HLTExtraData::HLTExtraData(const std::vector<uint32_t>& storage) :
23  statusCode(0)
24 {
25  deserialize(storage);
26 }
27 
29  : appName{rhs.appName}
30  , statusCode{rhs.statusCode}
31  , anonymous{rhs.anonymous}
32  , m_stringSerializer{} // not copied (default always good)
33 {}
34 
36  : HLTExtraData{}
37 {
38  swap(*this, rhs);
39 }
40 
42 {
43  swap(*this, rhs);
44  return *this;
45 }
46 
47 void HLTExtraData::serialize(std::vector<uint32_t>& storage)
48 {
49  if (empty()) return;
50 
51  // add the application name and the host name
53 
54  // one word for update status
55  storage.push_back( statusCode );
56 
57  // Anonymous words
58  storage.insert(storage.end(), anonymous.begin(), anonymous.end());
59 }
60 
61 
62 void HLTExtraData::deserialize(const std::vector<uint32_t>& storage)
63 {
64  if (storage.empty()) return;
65 
66  // StringSerializer knows how long the string is
67  std::size_t offset = m_stringSerializer.deserialize(storage, appName);
68 
69  if (offset < storage.size()) {
70  statusCode = storage[offset++];
71  anonymous.clear();
72  anonymous.insert(anonymous.begin(), storage.begin()+offset, storage.end());
73  }
74 }
75 
77 {
78  using std::swap;
79 
80  swap(lhs.appName, rhs.appName);
81  swap(lhs.statusCode, rhs.statusCode);
82  swap(lhs.anonymous, rhs.anonymous);
83  // default m_stringSerializer is good for every object
84 }
HLT::HLTExtraData::m_stringSerializer
TrigSteeringEvent::StringSerializer m_stringSerializer
Definition: HLTExtraData.h:75
HLT::HLTExtraData::HLTExtraData
HLTExtraData()
Construct empty object.
Definition: HLTExtraData.cxx:17
dumpTruth.statusCode
statusCode
Definition: dumpTruth.py:85
HLT::swap
void swap(HLTExtraData &, HLTExtraData &)
Definition: HLTExtraData.cxx:76
HLT::HLTExtraData::serialize
void serialize(std::vector< uint32_t > &storage)
Serialize the data and append it to the vector.
Definition: HLTExtraData.cxx:47
HLT::HLTExtraData::empty
bool empty()
Return true if all members have default values (no serialization needed)
Definition: HLTExtraData.h:71
HLT::HLTExtraData::operator=
HLTExtraData & operator=(HLTExtraData)
unified assignement op
Definition: HLTExtraData.cxx:41
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
HLT::HLTExtraData::statusCode
uint32_t statusCode
various status codes (for prescale/COOL updates)
Definition: HLTExtraData.h:65
TrigSteeringEvent::StringSerializer::serialize
void serialize(const std::vector< std::string > &strings, std::vector< uint32_t > &storage)
Serializes vector of strings into vector of integers.
Definition: TrigEvent/TrigSteeringEvent/src/StringSerializer.cxx:15
HLT::HLTExtraData::anonymous
std::vector< uint32_t > anonymous
For future use-cases (only use as last resort)
Definition: HLTExtraData.h:66
WriteCalibToCool.swap
swap
Definition: WriteCalibToCool.py:94
HLT::HLTExtraData::swap
friend void swap(HLTExtraData &, HLTExtraData &)
HLTExtraData.h
Definition of the HLT extra data in the HLTResult payload.
HLT::HLTExtraData::appName
std::string appName
application name
Definition: HLTExtraData.h:64
HLT::HLTExtraData::deserialize
void deserialize(const std::vector< uint32_t > &storage)
Deserialize storage into members.
Definition: HLTExtraData.cxx:62
TrigSteeringEvent::StringSerializer::deserialize
std::size_t deserialize(std::vector< uint32_t >::const_iterator first, std::vector< uint32_t >::const_iterator last, std::vector< std::string > &strings)
Deserialize vector into strings.
Definition: TrigEvent/TrigSteeringEvent/src/StringSerializer.cxx:67
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
HLT::HLTExtraData
Class representing the HLT extra payload stored in HLT::HLTResult::getExtras()
Definition: HLTExtraData.h:36