ATLAS Offline Software
DataHeaderCnv_p3.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 
14 #include <cstdio>
15 #include <sstream>
16 
19 
20 //______________________________________________________________________________
22  DataHeaderElement* trans,
23  const std::vector<std::string>& map) {
24  trans->m_pClid = *pers->m_clids.begin();
25  trans->m_clids.clear();
26  std::set<CLID>::iterator lastClid = trans->m_clids.begin();
27  for (std::vector<unsigned int>::const_iterator iter = pers->m_clids.begin() + 1,
28  last = pers->m_clids.end(); iter != last; ++iter) {
29  lastClid = trans->m_clids.insert(lastClid, *iter);
30  }
31  trans->m_key = *pers->m_alias.begin();
32  trans->m_alias.clear();
33  std::set<std::string>::iterator lastAlias = trans->m_alias.begin();
34  for (std::vector<std::string>::const_iterator iter = pers->m_alias.begin() + 1,
35  last = pers->m_alias.end(); iter != last; ++iter) {
36  lastAlias = trans->m_alias.insert(lastAlias, *iter);
37  }
38  trans->m_hashes.clear();
39  trans->m_hashes.reserve(pers->m_hashes.size());
40  for (std::vector<uint64_t>::const_iterator iter = pers->m_hashes.begin(),
41  last = pers->m_hashes.end(); iter != last; ++iter) {
42  trans->m_hashes.push_back((unsigned int)(*iter));
43  }
44 // Translate PoolToken
45  std::string tokenStr;
46  if (map.empty()) {
47  tokenStr = pers->m_token;
48  } else {
49  unsigned int tokenSize = 129 + pers->m_token.size();
50  if (pers->m_prefixIdx > 0) {
51  tokenSize += map[pers->m_prefixIdx].size();
52  }
53  if (pers->m_keyPos > 0) {
54  tokenSize += trans->m_key.size();
55  }
56  tokenStr.reserve(tokenSize);
57 // Append DbGuid
58  tokenStr = "[DB=";
59  tokenStr.append(map[pers->m_dbGuidIdx]);
60 // Still optimize
61  tokenStr.append("][CNT=");
62  if (pers->m_prefixIdx > 0) {
63  tokenStr.append(map[pers->m_prefixIdx]);
64  }
65 // insert key
66  if (pers->m_keyPos > 0) {
67  tokenStr.append(pers->m_token.substr(0, pers->m_keyPos - 1));
68  tokenStr.append(trans->m_key);
69  tokenStr.append(pers->m_token.substr(pers->m_keyPos - 1));
70  } else {
71  tokenStr.append(pers->m_token);
72  }
73 // Append ClassId
74  tokenStr.append("][CLID=");
75  tokenStr.append(map[pers->m_classIdIdx]);
76  const unsigned int length = 40;
77  char text[length];
78  snprintf(text, length, "][TECH=%08X][OID=%08X-%08X]", pers->m_technology, pers->m_oid1, pers->m_oid2);
79  tokenStr.append(text);
80  }
81  Token* token = new Token;
82  token->fromString(tokenStr);
83  delete trans->m_token; trans->m_token = token;
84 }
85 //______________________________________________________________________________
87  DataHeaderElement_p3* /*pers*/,
88  std::vector<std::string>& /*map*/) {
89 // Moved to next _p version
90 }
91 //______________________________________________________________________________
92 //______________________________________________________________________________
95 //______________________________________________________________________________
97  trans->m_dataHeader.resize(pers->m_DataHeader.size());
99  for (std::vector<DataHeaderElement_p3>::const_iterator pit = pers->m_DataHeader.begin(),
100  last = pers->m_DataHeader.end(); pit != last; ++it, ++pit) {
101  m_elemCnv.persToTrans(&(*pit), &(*it), pers->m_GuidMap);
102  }
103  trans->m_inputDataHeader.resize(pers->m_InputDataHeader.size());
104  it = trans->m_inputDataHeader.begin();
105  for (std::vector<DataHeaderElement_p3>::const_iterator pit = pers->m_InputDataHeader.begin(),
106  last = pers->m_InputDataHeader.end(); pit != last; ++it, ++pit) {
107  m_elemCnv.persToTrans(&(*pit), &(*it), pers->m_GuidMap);
108  }
109 }
110 //______________________________________________________________________________
111 void DataHeaderCnv_p3::transToPers(const DataHeader* /*trans*/, DataHeader_p3* /*pers*/) {
112 // Moved to next _p version
113 }
114 //______________________________________________________________________________
116  const std::string& /*key*/,
117  const std::string& /*token*/) {
118 // Moved to next _p version
119 }
DataHeader_p3::m_InputDataHeader
std::vector< DataHeaderElement_p3 > m_InputDataHeader
Definition: DataHeader_p3.h:69
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataHeaderElementCnv_p3::persToTrans
void persToTrans(const DataHeaderElement_p3 *pers, DataHeaderElement *trans, const std::vector< std::string > &map)
Definition: DataHeaderCnv_p3.cxx:21
DataHeaderElement::m_key
std::string m_key
string with StoreGate key.
Definition: DataHeader.h:111
DataHeaderElement_p3
This class provides a persistent representation for the DataHeaderElement class.
Definition: DataHeader_p3.h:21
DataHeaderElement::m_clids
std::set< CLID > m_clids
set of unsigned long to store ClassID's for symlinked container.
Definition: DataHeader.h:109
DataHeaderElement_p3::m_classIdIdx
unsigned short m_classIdIdx
Definition: DataHeader_p3.h:45
DataHeaderElement_p3::m_dbGuidIdx
unsigned short m_dbGuidIdx
Definition: DataHeader_p3.h:45
DataHeaderElement::m_pClid
CLID m_pClid
primary ClassID.
Definition: DataHeader.h:107
DataHeaderElement_p3::m_hashes
std::vector< uint64_t > m_hashes
Definition: DataHeader_p3.h:47
skel.it
it
Definition: skel.GENtoEVGEN.py:396
DataHeaderElement_p3::m_oid2
unsigned int m_oid2
Definition: DataHeader_p3.h:44
DataHeader_p3
This class provides a persistent representation for the DataHeader class.
Definition: DataHeader_p3.h:53
DataHeaderCnv_p3::m_elemCnv
DataHeaderElementCnv_p3 m_elemCnv
Definition: DataHeaderCnv_p3.h:48
DataHeaderCnv_p3::~DataHeaderCnv_p3
virtual ~DataHeaderCnv_p3()
Definition: DataHeaderCnv_p3.cxx:94
DataHeaderElement_p3::m_prefixIdx
unsigned short m_prefixIdx
Definition: DataHeader_p3.h:45
DataHeaderElement_p3::m_token
std::string m_token
Definition: DataHeader_p3.h:42
DataHeader_p3::m_DataHeader
std::vector< DataHeaderElement_p3 > m_DataHeader
Definition: DataHeader_p3.h:68
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
DataHeaderElement_p3::m_oid1
unsigned int m_oid1
Definition: DataHeader_p3.h:44
Token::fromString
Token & fromString(const std::string &from)
Build from the string representation of a token.
Definition: Token.cxx:133
DataHeaderElement
This class provides a persistent form for the TransientAddress.
Definition: DataHeader.h:36
DataHeaderElement::m_alias
std::set< std::string > m_alias
set of StoreGate alias string.
Definition: DataHeader.h:113
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
DataHeaderElementCnv_p3::transToPers
void transToPers(const DataHeaderElement *trans, DataHeaderElement_p3 *pers, std::vector< std::string > &map)
Definition: DataHeaderCnv_p3.cxx:86
DataHeaderCnv_p3::insertDHRef
void insertDHRef(DataHeader_p3 *pers, const std::string &key, const std::string &token)
Definition: DataHeaderCnv_p3.cxx:115
DataHeaderCnv_p3.h
This file contains the class definition for the DataHeaderCnv_p3 and DataHeaderElementCnv_p3 classes.
DataHeaderCnv_p3::persToTrans
void persToTrans(const DataHeader_p3 *pers, DataHeader *trans)
Definition: DataHeaderCnv_p3.cxx:96
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
DataHeader::m_dataHeader
std::vector< DataHeaderElement > m_dataHeader
vector with DataHeaderElement to "DataObject".
Definition: DataHeader.h:201
DataHeaderElementCnv_p3::DataHeaderElementCnv_p3
DataHeaderElementCnv_p3()
Definition: DataHeaderCnv_p3.cxx:17
DataHeaderElement::m_hashes
std::vector< sgkey_t > m_hashes
hash table for ElementLink host container keys.
Definition: DataHeader.h:118
DataHeaderElement_p3::m_technology
unsigned int m_technology
Definition: DataHeader_p3.h:44
DataHeaderElementCnv_p3::~DataHeaderElementCnv_p3
virtual ~DataHeaderElementCnv_p3()
Definition: DataHeaderCnv_p3.cxx:18
DataHeaderElement_p3::m_clids
std::vector< unsigned int > m_clids
Definition: DataHeader_p3.h:41
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
DataHeader_p3::m_GuidMap
std::vector< std::string > m_GuidMap
Definition: DataHeader_p3.h:70
DataHeaderElement::m_token
const Token * m_token
pointer to transient address
Definition: DataHeader.h:115
DataHeaderElement_p3::m_keyPos
unsigned short m_keyPos
Definition: DataHeader_p3.h:46
DataHeaderCnv_p3::DataHeaderCnv_p3
DataHeaderCnv_p3()
Definition: DataHeaderCnv_p3.cxx:93
DataHeaderCnv_p3::transToPers
void transToPers(const DataHeader *trans, DataHeader_p3 *pers)
Definition: DataHeaderCnv_p3.cxx:111
DataHeaderElement_p3::m_alias
std::vector< std::string > m_alias
Definition: DataHeader_p3.h:43
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
DataHeader::m_inputDataHeader
std::vector< DataHeaderElement > m_inputDataHeader
vector with DataHeaderElement to upstream DataHeader ("Provenance").
Definition: DataHeader.h:203