ATLAS Offline Software
Public Member Functions | List of all members
DataHeaderElementCnv_p5 Class Reference

This class provides the converter to customize the saving of DataHeaderElement_p5. More...

#include <DataHeaderCnv_p5.h>

Collaboration diagram for DataHeaderElementCnv_p5:

Public Member Functions

 DataHeaderElementCnv_p5 ()
 
 ~DataHeaderElementCnv_p5 ()
 
void persToTrans (const DataHeaderElement_p5 &pers, DataHeaderElement &trans, const DataHeaderForm_p5 &form, unsigned int entry) const
 
void transToPers (const DataHeaderElement &trans, DataHeaderElement_p5 &pers, DataHeaderForm_p5 &form, unsigned int entry) const
 

Detailed Description

This class provides the converter to customize the saving of DataHeaderElement_p5.

Definition at line 24 of file DataHeaderCnv_p5.h.

Constructor & Destructor Documentation

◆ DataHeaderElementCnv_p5()

DataHeaderElementCnv_p5::DataHeaderElementCnv_p5 ( )

Definition at line 15 of file DataHeaderCnv_p5.cxx.

15 {}

◆ ~DataHeaderElementCnv_p5()

DataHeaderElementCnv_p5::~DataHeaderElementCnv_p5 ( )

Definition at line 16 of file DataHeaderCnv_p5.cxx.

16 {}

Member Function Documentation

◆ persToTrans()

void DataHeaderElementCnv_p5::persToTrans ( const DataHeaderElement_p5 pers,
DataHeaderElement trans,
const DataHeaderForm_p5 form,
unsigned int  entry 
) const

Definition at line 19 of file DataHeaderCnv_p5.cxx.

23 {
24  delete trans.m_token; trans.m_token = new Token; trans.m_ownToken = true;
25  Token* token = const_cast<Token*>(trans.m_token);
26  std::vector<unsigned int>::const_iterator intIter = form.params(entry).begin();
27  unsigned int keyIdx = 0U, aliasNum = 0U, clidNum = 0U;
28 // Translate PoolToken
29  if ((*intIter&0x0000FFFF) == 0) {
30  ++intIter;
31  keyIdx = *intIter; ++intIter;
32  aliasNum = *intIter; ++intIter;
33  clidNum = *intIter; ++intIter;
34  token->fromString(pers.m_token);
35  } else {
36  const unsigned int keyPos = (unsigned short)(*intIter>>16),
37  version = (unsigned short)(*intIter&0x0000FFFF); ++intIter;
38  const unsigned int guidIdx = (unsigned short)(*intIter>>16),
39  classIdx = (unsigned short)(*intIter&0x0000FFFF); ++intIter;
40  const unsigned int prefixIdx = (unsigned short)(*intIter>>16),
41  typeIdx = (unsigned short)(*intIter&0x0000FFFF); ++intIter;
42 // Add Technology and Offsets
43  unsigned int tech = 514;
44  if (version&0x00000001U) {
45  tech = *intIter; ++intIter;
46  }
47  unsigned int oid1 = *intIter; ++intIter;
48  if (version&0x00000010U) {
49  keyIdx = *intIter; ++intIter;
50  aliasNum = *intIter; ++intIter;
51  clidNum = *intIter; ++intIter;
52  } else {
53  keyIdx = (*intIter>>16), aliasNum = ((*intIter&0x0000FFFF)>>8), clidNum = (*intIter&0x000000FF); ++intIter;
54  }
55 // Append DbGuid
56  Guid guid(form.map()[guidIdx]);
57  token->setDb(guid);
58 // Container name, may be optimized
59  std::string cntName;
60  if (prefixIdx > 0) {
61  cntName += form.map()[prefixIdx];
62  if (typeIdx > 0) {
63  cntName += form.map()[typeIdx];
64  }
65  }
66 // Insert key
67  if (keyPos > 0) {
68  cntName += pers.m_token.substr(0, keyPos - 1) + form.map()[keyIdx] + pers.m_token.substr(keyPos - 1);
69  } else {
70  cntName += pers.m_token;
71  }
72  //token->setCont(cntName);
73 // Append ClassId
74  Guid clid(form.map()[classIdx]);
75  token->setClassID(clid);
76  token->setTechnology(tech);
77  token->setOid(Token::OID_t(oid1, pers.m_oid2));
78  }
79  unsigned int aliasCur = 0U, clidCur = 0U;
80  trans.m_key = form.map()[keyIdx];
81  trans.m_alias.clear();
82  for (std::set<std::string>::const_iterator lastAlias = trans.m_alias.begin();
83  aliasCur < aliasNum; ++aliasCur) {
84  lastAlias = trans.m_alias.insert(lastAlias, form.map()[keyIdx + aliasCur + 1]);
85  }
86  trans.m_pClid = *intIter; ++intIter;
87  trans.m_clids.clear();
88  const std::vector<unsigned int>::const_iterator intLast = form.params(entry).end();
89  for (std::set<CLID>::const_iterator lastClid = trans.m_clids.begin();
90  intIter != intLast && clidCur < clidNum; ++intIter, ++clidCur) {
91  lastClid = trans.m_clids.insert(lastClid, *intIter);
92  }
93  trans.m_hashes.clear();
94  for (; intIter != intLast; ++intIter) {
95  trans.m_hashes.push_back(*intIter);
96  }
97 }

◆ transToPers()

void DataHeaderElementCnv_p5::transToPers ( const DataHeaderElement trans,
DataHeaderElement_p5 pers,
DataHeaderForm_p5 form,
unsigned int  entry 
) const

Definition at line 99 of file DataHeaderCnv_p5.cxx.

102  {
103  unsigned int tech = 0U, oid1 = 0U;
104  unsigned short guidIdx = 0U, classIdx = 0U, prefixIdx = 0U, typeIdx = 0U, keyPos = 0U;
105 // Translate PoolToken
106  if (trans.getToken() != 0) {
107 // Database GUID
108  const std::string guid = trans.getToken()->dbID().toString();
109  for (std::vector<std::string>::const_iterator iter = form.map().begin(), last = form.map().end();
110  iter != last; ++iter, ++guidIdx) {
111  if (*iter == guid) break;
112  }
113  if (guidIdx == form.map().size()) {
114  form.insertMap(guid);
115  }
116 // Class GUID
117  const std::string clid = trans.getToken()->classID().toString();
118  for (std::vector<std::string>::const_iterator iter = form.map().begin(), last = form.map().end();
119  iter != last; ++iter, ++classIdx) {
120  if (*iter == clid) break;
121  }
122  if (classIdx == form.map().size()) {
123  form.insertMap(clid);
124  }
125 // Container name, can be optimized
126  pers.m_token = trans.getToken()->contID();
127 // Get Prefix
128  std::string::size_type delim = pers.m_token.find_first_of("_/(");
129  if (delim != std::string::npos) {
130  const std::string persComp1 = pers.m_token.substr(0, delim + 1);
131  for (std::vector<std::string>::const_iterator iter = form.map().begin(), last = form.map().end();
132  iter != last; ++iter, ++prefixIdx) {
133  if (*iter == persComp1) break;
134  }
135  if (prefixIdx == form.map().size()) {
136  form.insertMap(persComp1);
137  }
138  pers.m_token = pers.m_token.substr(delim + 1);
139 // Get TypeName
140 // Check whether Key only is used for placement
141  if (!pers.m_token.starts_with( trans.m_key)) {
142  std::string::size_type delim = pers.m_token.find_first_of("/()");
143  if (delim != std::string::npos) {
144  const std::string persComp2 = pers.m_token.substr(0, delim + 1);
145  for (std::vector<std::string>::const_iterator iter = form.map().begin(), last = form.map().end();
146  iter != last; ++iter, ++typeIdx) {
147  if (*iter == persComp2) break;
148  }
149  if (typeIdx == form.map().size()) {
150  form.insertMap(persComp2);
151  }
152  pers.m_token = pers.m_token.substr(delim + 1);
153  } else if (pers.m_token == "DataHeader") {
154  for (std::vector<std::string>::const_iterator iter = form.map().begin(), last = form.map().end();
155  iter != last; ++iter, ++typeIdx) {
156  if (*iter == "DataHeader") break;
157  }
158  if (typeIdx == form.map().size()) {
159  form.insertMap("DataHeader");
160  }
161  pers.m_token.clear();
162  }
163  }
164  }
165  delim = pers.m_token.rfind(trans.m_key);
166  if (delim != std::string::npos) {
167  keyPos = delim + 1;
168  pers.m_token = pers.m_token.substr(0, delim) + pers.m_token.substr(delim + trans.m_key.size());
169  }
170  tech = trans.getToken()->technology();
171  oid1 = trans.getToken()->oid().first;
172  pers.m_oid2 = trans.getToken()->oid().second;
173  }
174  unsigned int version = 0x0000FFFFU;
175  if (tech == 514) {
176  version = version&0x0000FFFEU;
177  }
178  unsigned int keyIdx = form.map().size(), aliasNum = trans.m_alias.size(), clidNum = trans.m_clids.size();
179  if (keyIdx < 0x00010000U && aliasNum < 0x00000100U && clidNum < 0x00000100U) {
180  version = version&0x0000FFEFU;
181  }
182  form.insertParam((unsigned int)(keyPos) * 0x00010000U + version, entry);
183  form.insertParam((unsigned int)(guidIdx) * 0x00010000U + (unsigned int)(classIdx), entry);
184  form.insertParam((unsigned int)(prefixIdx) * 0x00010000U + (unsigned int)(typeIdx), entry);
185  if (version&0x00000001U) {
186  form.insertParam(tech, entry);
187  }
188  form.insertParam(oid1, entry);
189  if (version&0x00000010U) {
190  form.insertParam(keyIdx, entry);
191  form.insertParam(aliasNum, entry);
192  form.insertParam(clidNum, entry);
193  } else {
194  form.insertParam(keyIdx * 0x00010000U + aliasNum * 0x00000100U + clidNum, entry);
195  }
196  form.insertMap(trans.m_key);
197  for (std::set<std::string>::const_iterator iter = trans.m_alias.begin(),
198  last = trans.m_alias.end(); iter != last; ++iter) {
199  form.insertMap(*iter);
200  }
201  form.insertParam(trans.m_pClid, entry);
202  for (std::set<CLID>::const_iterator iter = trans.m_clids.begin(),
203  last = trans.m_clids.end(); iter != last; ++iter) {
204  form.insertParam(*iter, entry);
205  }
206  for (std::vector<SG::sgkey_t>::const_iterator iter = trans.m_hashes.begin(),
207  last = trans.m_hashes.end(); iter != last; ++iter) {
208  form.insertParam(SG::sgkeyShort (*iter), entry);
209  }
210 }

The documentation for this class was generated from the following files:
DataHeaderElement_p5::m_token
std::string m_token
Definition: DataHeader_p5.h:35
DataHeaderElement::m_key
std::string m_key
string with StoreGate key.
Definition: DataHeader.h:111
xAOD::short
short
Definition: Vertex_v1.cxx:165
Token::contID
const std::string & contID() const
Access container identifier.
Definition: Token.h:67
DataHeaderElement::m_clids
std::set< CLID > m_clids
set of unsigned long to store ClassID's for symlinked container.
Definition: DataHeader.h:109
DataHeaderElement::m_pClid
CLID m_pClid
primary ClassID.
Definition: DataHeader.h:107
Token::dbID
const Guid & dbID() const
Access database identifier.
Definition: Token.h:62
Guid::toString
const std::string toString() const
Automatic conversion to string representation.
Definition: Guid.cxx:58
DataHeaderForm_p5::map
const std::vector< std::string > & map() const
Definition: DataHeader_p5.cxx:45
Token::classID
const Guid & classID() const
Access database identifier.
Definition: Token.h:71
DataHeaderElement::m_ownToken
bool m_ownToken
Definition: DataHeader.h:116
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
DataHeaderForm_p5::params
const std::vector< unsigned int > & params(unsigned int entry) const
Definition: DataHeader_p5.cxx:53
Token::OID_t
Definition: Token.h:24
Token::fromString
Token & fromString(const std::string &from)
Build from the string representation of a token.
Definition: Token.cxx:133
Token::setClassID
Token & setClassID(const Guid &cl_id)
Access database identifier.
Definition: Token.h:73
Token::technology
int technology() const
Access technology type.
Definition: Token.h:75
DataHeaderElement::m_alias
std::set< std::string > m_alias
set of StoreGate alias string.
Definition: DataHeader.h:113
SG::sgkeyShort
constexpr uint32_t sgkeyShort(const sgkey_t k)
Convert a sgkey to the 32-bit form used for older data.
Definition: CxxUtils/CxxUtils/sgkey_t.h:85
Token::setDb
Token & setDb(const Guid &db)
Set database name.
Definition: Token.h:64
DataHeaderElement_p5::m_oid2
long long int m_oid2
Definition: DataHeader_p5.h:36
Token::setTechnology
Token & setTechnology(int t)
Set technology type.
Definition: Token.h:77
DataHeaderForm_p5::insertMap
void insertMap(const std::string &element)
Definition: DataHeader_p5.cxx:49
pool_uuid.guid
guid
Definition: pool_uuid.py:112
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
Token::setOid
Token & setOid(const OID_t &oid)
Set object identifier.
Definition: Token.h:83
DataHeaderElement::m_hashes
std::vector< sgkey_t > m_hashes
hash table for ElementLink host container keys.
Definition: DataHeader.h:118
get_generator_info.version
version
Definition: get_generator_info.py:33
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
DataHeaderForm_p5::insertParam
void insertParam(unsigned int param, unsigned int entry)
Definition: DataHeader_p5.cxx:57
Token::oid
const OID_t & oid() const
Access object identifier.
Definition: Token.h:79
DataHeaderElement::m_token
const Token * m_token
pointer to transient address
Definition: DataHeader.h:115
DataHeaderElement::getToken
const Token * getToken() const
Definition: DataHeader.cxx:135