ATLAS Offline Software
DataHeader_p5.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "CxxUtils/MD5.h"
8 
9 #include <uuid/uuid.h>
10 #include <sstream>
11 
12 DataHeaderElement_p5::DataHeaderElement_p5() : m_token(), m_oid2(0U) {}
14  m_oid2(rhs.m_oid2) {}
16 
18  if (this != &rhs) {
19  m_token = rhs.m_token;
20  m_oid2 = rhs.m_oid2;
21  }
22  return(*this);
23 }
24 
25 const std::string& DataHeaderElement_p5::token() const {
26  return(m_token);
27 }
28 
29 long long int DataHeaderElement_p5::oid2() const {
30  return(m_oid2);
31 }
32 
33 
34 DataHeaderForm_p5::DataHeaderForm_p5() : m_map(), m_uints() {}
35 DataHeaderForm_p5::DataHeaderForm_p5(const DataHeaderForm_p5& rhs) : m_map(rhs.m_map), m_uints(rhs.m_uints) {}
38  if (&rhs != this) {
39  m_map = rhs.m_map;
40  m_uints = rhs.m_uints;
41  }
42  return(*this);
43 }
44 
45 const std::vector<std::string>& DataHeaderForm_p5::map() const {
46  return(m_map);
47 }
48 
49 void DataHeaderForm_p5::insertMap(const std::string& element) {
50  m_map.push_back(element);
51 }
52 
53 const std::vector<unsigned int>& DataHeaderForm_p5::params(unsigned int entry) const {
54  return(m_uints[entry - 1]);
55 }
56 
57 void DataHeaderForm_p5::insertParam(unsigned int param, unsigned int entry) {
58  m_uints[entry - 1].push_back(param);
59 }
60 
61 unsigned int DataHeaderForm_p5::size() const {
62  return(m_uints.size());
63 }
64 
65 void DataHeaderForm_p5::resize(unsigned int size) {
66  m_uints.resize(size);
67 }
68 
69 
70 DataHeader_p5::DataHeader_p5() : m_dataHeader(), m_dhFormToken(), m_dhFormMdx() {}
71 DataHeader_p5::DataHeader_p5(const DataHeader_p5& rhs) : m_dataHeader(rhs.m_dataHeader),
72  m_dhFormToken(rhs.m_dhFormToken),
73  m_dhFormMdx(rhs.m_dhFormMdx) {}
75 }
76 
78  if (this != &rhs) {
82  }
83  return(*this);
84 }
85 
86 const std::vector<DataHeaderElement_p5>& DataHeader_p5::elements() const {
87  return(m_dataHeader);
88 }
89 
90 const std::string& DataHeader_p5::dhFormToken() const {
91  return(m_dhFormToken);
92 }
93 
94 void DataHeader_p5::setDhFormToken(const std::string& formToken,
95  const DataHeaderForm_p5& dhForm)
96 {
97  m_dhFormToken = formToken;
98  std::ostringstream stream;
99  for (const std::string& s : dhForm.map()) {
100  stream << s << "\n";
101  }
102  for (unsigned int entry = 1; entry <= dhForm.size(); ++entry) {
103  for (unsigned int x : dhForm.params(entry)) {
104  stream << x << ",";
105  }
106  stream << "\n";
107  }
108  MD5 checkSum((unsigned char*)stream.str().c_str(), stream.str().size());
109  uuid_t checkSumUuid;
110  checkSum.raw_digest((unsigned char*)(&checkSumUuid));
111  char text[37];
112  uuid_unparse_upper(checkSumUuid, text);
113  m_dhFormMdx = text;
114 }
115 const std::string& DataHeader_p5::dhFormMdx() const {
116  return(m_dhFormMdx);
117 }
DataHeaderForm_p5::m_uints
std::vector< std::vector< unsigned int > > m_uints
Definition: DataHeader_p5.h:61
DataHeaderElement_p5::token
const std::string & token() const
Definition: DataHeader_p5.cxx:25
DataHeaderElement_p5::m_token
std::string m_token
Definition: DataHeader_p5.h:35
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
DataHeaderElement_p5::~DataHeaderElement_p5
~DataHeaderElement_p5()
Definition: DataHeader_p5.cxx:15
DataHeader_p5::m_dhFormToken
std::string m_dhFormToken
Definition: DataHeader_p5.h:85
DataHeader_p5::dhFormMdx
const std::string & dhFormMdx() const
Definition: DataHeader_p5.cxx:115
DataHeaderForm_p5
This class provides storage for the constant fields of the persistent DataHeader class.
Definition: DataHeader_p5.h:42
DataHeaderForm_p5::m_map
std::vector< std::string > m_map
Definition: DataHeader_p5.h:60
DataHeaderForm_p5::map
const std::vector< std::string > & map() const
Definition: DataHeader_p5.cxx:45
DataHeaderForm_p5::resize
void resize(unsigned int size)
Definition: DataHeader_p5.cxx:65
DataHeaderForm_p5::operator=
DataHeaderForm_p5 & operator=(const DataHeaderForm_p5 &rhs)
Definition: DataHeader_p5.cxx:37
x
#define x
DataHeaderElement_p5::operator=
DataHeaderElement_p5 & operator=(const DataHeaderElement_p5 &rhs)
Definition: DataHeader_p5.cxx:17
MD5::raw_digest
void raw_digest(unsigned char *s) const
Definition: MD5.cxx:82
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
MD5.h
solar's public-domain MD5, wrapped for C++.
DataHeaderElement_p5::oid2
long long int oid2() const
Definition: DataHeader_p5.cxx:29
DataHeader_p5::dhFormToken
const std::string & dhFormToken() const
Definition: DataHeader_p5.cxx:90
DataHeaderForm_p5::params
const std::vector< unsigned int > & params(unsigned int entry) const
Definition: DataHeader_p5.cxx:53
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
DataHeader_p5::elements
const std::vector< DataHeaderElement_p5 > & elements() const
Definition: DataHeader_p5.cxx:86
DataHeader_p5::m_dataHeader
std::vector< DataHeaderElement_p5 > m_dataHeader
Definition: DataHeader_p5.h:84
DataHeaderForm_p5::size
unsigned int size() const
Definition: DataHeader_p5.cxx:61
DataHeader_p5::setDhFormToken
void setDhFormToken(const std::string &formToken, const DataHeaderForm_p5 &dhForm)
Definition: DataHeader_p5.cxx:94
DataHeader_p5.h
This file contains the class definition for the DataHeader_p5, DataHeaderForm_p5 and DataHeaderElemen...
DataHeaderElement_p5::m_oid2
long long int m_oid2
Definition: DataHeader_p5.h:36
MD5
Definition: MD5.h:20
DataHeaderForm_p5::insertMap
void insertMap(const std::string &element)
Definition: DataHeader_p5.cxx:49
DataHeader_p5::~DataHeader_p5
~DataHeader_p5()
Definition: DataHeader_p5.cxx:74
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
DataHeader_p5::operator=
DataHeader_p5 & operator=(const DataHeader_p5 &rhs)
Definition: DataHeader_p5.cxx:77
DataHeaderElement_p5
This class provides a persistent representation for the DataHeaderElement class.
Definition: DataHeader_p5.h:21
DataHeaderForm_p5::DataHeaderForm_p5
DataHeaderForm_p5()
Definition: DataHeader_p5.cxx:34
DataHeaderForm_p5::insertParam
void insertParam(unsigned int param, unsigned int entry)
Definition: DataHeader_p5.cxx:57
DataHeader_p5
This class provides a persistent representation for the DataHeader class.
Definition: DataHeader_p5.h:67
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
DataHeader_p5::DataHeader_p5
DataHeader_p5()
Definition: DataHeader_p5.cxx:70
DataHeader_p5::m_dhFormMdx
std::string m_dhFormMdx
Definition: DataHeader_p5.h:86
DataHeaderForm_p5::~DataHeaderForm_p5
~DataHeaderForm_p5()
Definition: DataHeader_p5.cxx:36
DataHeaderElement_p5::DataHeaderElement_p5
DataHeaderElement_p5()
Definition: DataHeader_p5.cxx:12