ATLAS Offline Software
DataHeader.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PERSISTENTDATAMODEL_DATAHEADER_H
6 #define PERSISTENTDATAMODEL_DATAHEADER_H
7 
13 #include "GaudiKernel/ClassID.h"
14 
16 #include "CxxUtils/sgkey_t.h"
17 
18 #include <string>
19 #include <set>
20 #include <vector>
21 
22 // Forward declarations
23 class IOpaqueAddress;
24 namespace SG {
25  class TransientAddress;
26  class DataProxy;
27 }
28 namespace coral {
29  class AttributeList;
30 }
31 class IStringPool;
32 
37 public: // Constructor and Destructor
39 
44 
48  DataHeaderElement(const SG::TransientAddress* sgAddress, IOpaqueAddress* tokAddress, const std::string& pTag);
49 
53  DataHeaderElement(const SG::DataProxy* proxy, IOpaqueAddress* tokAddress, const std::string& pTag);
54 
59  DataHeaderElement(const CLID classID, const std::string& key, const Token* token);
61  virtual ~DataHeaderElement();
62 
63 public: // Non-static members
66 
68  CLID getPrimaryClassID() const;
70  const std::set<CLID> getClassIDs() const;
72  const std::string& getKey() const;
74  const std::set<std::string>& getAlias() const;
76  const Token* getToken() const;
78  long getStorageType() const;
81  const std::vector<sgkey_t>& getHashes() const;
83  SG::TransientAddress* getAddress(unsigned long contextId = 0) const;
85  SG::TransientAddress* getAddress(const std::string& key,
86  unsigned long contextId = 0) const;
88  void addHash(IStringPool* pool);
89 
90  void dump(std::ostream& ostr) const;
91 
92 private:
96  friend class DataHeaderCnv_p6;
97 
100  const std::string& name,
101  const std::vector<CLID>& tClids,
102  std::set<std::string>&& alias,
103  IOpaqueAddress* tadAddress,
104  IOpaqueAddress* tokAddress, const std::string& pTag);
105 
109  std::set<CLID> m_clids;
111  std::string m_key;
113  std::set<std::string> m_alias;
115  const Token* m_token;
118  std::vector<sgkey_t> m_hashes;
119 };
120 
124 class DataHeader {
125 public:
127 
128 public: // Constructor and Destructor
130  DataHeader();
132  DataHeader(const DataHeader& rhs);
134  virtual ~DataHeader();
135 
136 public: // Non-static members
138  DataHeader& operator=(const DataHeader& rhs);
139 
143  bool isInput() const;
144 
147  void setProcessTag(const std::string& processTag);
149  const std::string& getProcessTag() const;
150 
152  int size() const;
154  std::vector<DataHeaderElement>::const_iterator begin() const;
156  std::vector<DataHeaderElement>::const_iterator end() const;
158  const std::vector<DataHeaderElement>& elements() const;
159 
163  void insert(const SG::TransientAddress* sgAddress, IOpaqueAddress* tokAddress = 0, const std::string& pTag = "");
167  void insert(const SG::DataProxy* proxy, IOpaqueAddress* tokAddress = 0, const std::string& pTag = "");
170  void insert(const DataHeaderElement& dhe);
171 
173  int sizeProvenance() const;
175  std::vector<DataHeaderElement>::const_iterator beginProvenance() const;
177  std::vector<DataHeaderElement>::const_iterator endProvenance() const;
178 
181  void insertProvenance(const DataHeaderElement& dhe);
182 
184  void addHash(IStringPool* pool);
185 
186  void setAttributeList(const coral::AttributeList* attrList);
188  void setEvtRefTokenStr(const std::string& tokenStr);
189  const std::string& getEvtRefTokenStr();
190 
191  void dump(std::ostream& ostr) const;
192 
193 private:
194  friend class DataHeaderCnv_p3;
195  friend class DataHeaderCnv_p4;
196  friend class DataHeaderCnv_p5;
197  friend class DataHeaderCnv_p6;
198  friend class DataHeaderCnv;
199 
201  std::vector<DataHeaderElement> m_dataHeader;
203  std::vector<DataHeaderElement> m_inputDataHeader;
207  std::string m_processTag;
211  std::string m_evtRefTokenStr;
212 };
213 
214 #include "AthenaKernel/CLASS_DEF.h"
215 CLASS_DEF(DataHeader, 222376821, 1)
216 #endif
DataHeader::isInput
bool isInput() const
Check whether StatusFlag is "Input".
Definition: DataHeader.cxx:239
DataHeader::setProcessTag
void setProcessTag(const std::string &processTag)
Set ProcessTag for DataHeader.
Definition: DataHeader.cxx:243
IStringPool
Abstract interface for looking up strings/CLIDs in a pool.
Definition: IStringPool.h:28
DataHeaderElementCnv_p3
This class provides the converter to customize the saving of DataHeaderElement_p3.
Definition: DataHeaderCnv_p3.h:21
DataHeader::endProvenance
std::vector< DataHeaderElement >::const_iterator endProvenance() const
Definition: DataHeader.cxx:289
DataHeaderElement::m_key
std::string m_key
string with StoreGate key.
Definition: DataHeader.h:111
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
DataHeaderElement::getAlias
const std::set< std::string > & getAlias() const
Definition: DataHeader.cxx:131
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
DataHeader::m_attrList
const coral::AttributeList * m_attrList
Optional pointer to AttributeList to enable writing of TAG Attributes to Payload files.
Definition: DataHeader.h:209
DataHeaderCnv_p6
This class provides the converter to customize the saving of DataHeader_p6.
Definition: DataHeaderCnv_p6.h:22
DataHeader::DataHeader
DataHeader()
Default Constructor.
Definition: DataHeader.cxx:205
DataHeader::Input
@ Input
Definition: DataHeader.h:126
DataHeaderElement::m_clids
std::set< CLID > m_clids
set of unsigned long to store ClassID's for symlinked container.
Definition: DataHeader.h:109
DataHeader::operator=
DataHeader & operator=(const DataHeader &rhs)
Assignment Operator.
Definition: DataHeader.cxx:224
DataHeader::dump
void dump(std::ostream &ostr) const
Definition: DataHeader.cxx:327
DataHeader::setAttributeList
void setAttributeList(const coral::AttributeList *attrList)
Definition: DataHeader.cxx:308
DataHeaderElement::m_pClid
CLID m_pClid
primary ClassID.
Definition: DataHeader.h:107
DataHeader::addHash
void addHash(IStringPool *pool)
Add new entry to hash map.
Definition: DataHeader.cxx:297
pool
pool namespace
Definition: libname.h:15
DataHeader::elements
const std::vector< DataHeaderElement > & elements() const
Definition: DataHeader.cxx:263
SG::TransientAddress
Definition: TransientAddress.h:32
DataHeader::begin
std::vector< DataHeaderElement >::const_iterator begin() const
Definition: DataHeader.cxx:255
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
DataHeaderElement::m_ownToken
bool m_ownToken
Definition: DataHeader.h:116
DataHeader::statusFlag
statusFlag
Definition: DataHeader.h:126
DataHeader::insertProvenance
void insertProvenance(const DataHeaderElement &dhe)
Insert a new element into the "Provenance" vector.
Definition: DataHeader.cxx:293
DataHeaderCnv_p5
This class provides the converter to customize the saving of DataHeader_p5.
Definition: DataHeaderCnv_p5.h:42
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
DataHeaderElement::operator=
DataHeaderElement & operator=(const DataHeaderElement &rhs)
Assignment Operator.
Definition: DataHeader.cxx:97
coral
Definition: ISecondaryEventSelector.h:19
DataHeaderElement::getKey
const std::string & getKey() const
Definition: DataHeader.cxx:127
DataHeaderElement
This class provides a persistent form for the TransientAddress.
Definition: DataHeader.h:36
DataHeader::beginProvenance
std::vector< DataHeaderElement >::const_iterator beginProvenance() const
Definition: DataHeader.cxx:285
DataHeaderElement::m_alias
std::set< std::string > m_alias
set of StoreGate alias string.
Definition: DataHeader.h:113
DataHeaderElement::~DataHeaderElement
virtual ~DataHeaderElement()
Destructor.
Definition: DataHeader.cxx:93
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
DataHeader::size
int size() const
Definition: DataHeader.cxx:251
DataHeader::Output
@ Output
Definition: DataHeader.h:126
DataHeaderElementCnv_p5
This class provides the converter to customize the saving of DataHeaderElement_p5.
Definition: DataHeaderCnv_p5.h:24
COOLRates.alias
alias
Definition: COOLRates.py:1172
DataHeader::sizeProvenance
int sizeProvenance() const
Definition: DataHeader.cxx:281
DataHeaderCnv
This class provides the converter to customize the saving of DataHeader.
Definition: DataHeaderCnv.h:32
DataHeaderElement::DataHeaderElement
DataHeaderElement()
Default Constructor.
Definition: DataHeader.cxx:18
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
DataHeaderElement::dump
void dump(std::ostream &ostr) const
Definition: DataHeader.cxx:176
jobOptions.pTag
string pTag
Definition: jobOptions.py:28
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
DataHeaderElement::getHashes
const std::vector< sgkey_t > & getHashes() const
Definition: DataHeader.cxx:144
DataHeader::insert
void insert(const SG::TransientAddress *sgAddress, IOpaqueAddress *tokAddress=0, const std::string &pTag="")
Insert a new element into the "DataObject" vector.
Definition: DataHeader.cxx:267
DataHeader::setStatus
void setStatus(statusFlag status)
Set StatusFlag enum for DataHeader.
Definition: DataHeader.cxx:235
DataHeaderElement::getClassIDs
const std::set< CLID > getClassIDs() const
Definition: DataHeader.cxx:121
DataHeader::m_status
statusFlag m_status
StatusFlag (i.e.: Output, Primary, Input, Manual, Other).
Definition: DataHeader.h:205
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataHeader::end
std::vector< DataHeaderElement >::const_iterator end() const
Definition: DataHeader.cxx:259
DataHeaderElement::addHash
void addHash(IStringPool *pool)
Add new entry to hash map.
Definition: DataHeader.cxx:148
DataHeaderCnv_p4
This class provides the converter to customize the saving of DataHeader_p4.
Definition: DataHeaderCnv_p4.h:35
DataHeaderElement::getPrimaryClassID
CLID getPrimaryClassID() const
Definition: DataHeader.cxx:114
DataHeader::m_dataHeader
std::vector< DataHeaderElement > m_dataHeader
vector with DataHeaderElement to "DataObject".
Definition: DataHeader.h:201
DataHeaderElement::sgkey_t
SG::sgkey_t sgkey_t
Definition: DataHeader.h:38
DataHeader::getEvtRefTokenStr
const std::string & getEvtRefTokenStr()
Definition: DataHeader.cxx:320
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
DataHeaderElement::getStorageType
long getStorageType() const
Definition: DataHeader.cxx:139
DataHeaderElement::m_hashes
std::vector< sgkey_t > m_hashes
hash table for ElementLink host container keys.
Definition: DataHeader.h:118
DataHeaderElement::getAddress
SG::TransientAddress * getAddress(unsigned long contextId=0) const
Definition: DataHeader.cxx:158
DataHeader::~DataHeader
virtual ~DataHeader()
Destructor.
Definition: DataHeader.cxx:221
DataHeader::Other
@ Other
Definition: DataHeader.h:126
sgkey_t.h
Define the type used for hashed StoreGate key+CLID pairs.
DataHeader::getAttributeList
const coral::AttributeList * getAttributeList()
Definition: DataHeader.cxx:312
DataHeader::getProcessTag
const std::string & getProcessTag() const
Definition: DataHeader.cxx:247
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
DataHeader::setEvtRefTokenStr
void setEvtRefTokenStr(const std::string &tokenStr)
Definition: DataHeader.cxx:316
DataHeader::m_processTag
std::string m_processTag
ProcessTag (e.g.: "StreamESD", "StreamAOD" ...).
Definition: DataHeader.h:207
DataHeaderElementCnv_p4
This class provides the converter to customize the saving of DataHeaderElement_p4.
Definition: DataHeaderCnv_p4.h:21
merge.status
status
Definition: merge.py:17
DataHeaderElement::m_token
const Token * m_token
pointer to transient address
Definition: DataHeader.h:115
DataHeaderCnv_p3
This class provides the converter to customize the saving of DataHeader_p3.
Definition: DataHeaderCnv_p3.h:35
DataHeaderElement::getToken
const Token * getToken() const
Definition: DataHeader.cxx:135
SG::DataProxy
Definition: DataProxy.h:45
Token.h
This file contains the class definition for the Token class (migrated from POOL).
DataHeader::m_inputDataHeader
std::vector< DataHeaderElement > m_inputDataHeader
vector with DataHeaderElement to upstream DataHeader ("Provenance").
Definition: DataHeader.h:203
CLASS_DEF.h
macros to associate a CLID to a type
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
DataHeader::m_evtRefTokenStr
std::string m_evtRefTokenStr
Optional Token String for Event Reference to enable writing of TAG to Payload files.
Definition: DataHeader.h:211