Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
DataHeaderElement Class Reference

This class provides a persistent form for the TransientAddress. More...

#include <DataHeader.h>

Collaboration diagram for DataHeaderElement:

Public Types

using sgkey_t = SG::sgkey_t
 

Public Member Functions

 DataHeaderElement ()
 Default Constructor. More...
 
 DataHeaderElement (const DataHeaderElement &rhs)
 Copy Constructor. More...
 
 DataHeaderElement (const SG::TransientAddress *sgAddress, IOpaqueAddress *tokAddress, const std::string &pTag)
 Constructor. More...
 
 DataHeaderElement (const SG::DataProxy *proxy, IOpaqueAddress *tokAddress, const std::string &pTag)
 Constructor. More...
 
 DataHeaderElement (const CLID classID, const std::string &key, Token &&token)
 Constructor. More...
 
virtual ~DataHeaderElement ()
 Destructor. More...
 
DataHeaderElementoperator= (const DataHeaderElement &rhs)
 Assignment Operator. More...
 
CLID getPrimaryClassID () const
 
const std::set< CLIDgetClassIDs () const
 
const std::string & getKey () const
 
const std::set< std::string > & getAlias () const
 
const TokengetToken () const
 
long getStorageType () const
 
const std::vector< sgkey_t > & getHashes () const
 
SG::TransientAddressgetAddress (unsigned long contextId=0) const
 
SG::TransientAddressgetAddress (const std::string &key, unsigned long contextId=0) const
 
void addHash (IStringPool *pool)
 Add new entry to hash map. More...
 
void dump (std::ostream &ostr) const
 

Private Member Functions

 DataHeaderElement (CLID clid, const std::string &name, const std::vector< CLID > &tClids, std::set< std::string > &&alias, IOpaqueAddress *tadAddress, IOpaqueAddress *tokAddress, const std::string &pTag)
 Internal constructor. More...
 

Private Attributes

CLID m_pClid
 primary ClassID. More...
 
std::vector< CLIDm_clids
 vector of unsigned long to store ClassID's for symlinked container. More...
 
std::string m_key
 string with StoreGate key. More...
 
std::set< std::string > m_alias
 set of StoreGate alias string. More...
 
Token m_token
 Transient address token. More...
 
std::vector< sgkey_tm_hashes
 hash table for ElementLink host container keys. More...
 

Friends

class DataHeaderElementCnv_p3
 
class DataHeaderElementCnv_p4
 
class DataHeaderElementCnv_p5
 
class DataHeaderCnv_p6
 

Detailed Description

This class provides a persistent form for the TransientAddress.

Definition at line 37 of file DataHeader.h.

Member Typedef Documentation

◆ sgkey_t

Definition at line 39 of file DataHeader.h.

Constructor & Destructor Documentation

◆ DataHeaderElement() [1/6]

DataHeaderElement::DataHeaderElement ( )

Default Constructor.

Definition at line 18 of file DataHeader.cxx.

18  : m_pClid(0), m_clids(), m_key(), m_alias(), m_hashes() {
19 }

◆ DataHeaderElement() [2/6]

DataHeaderElement::DataHeaderElement ( const DataHeaderElement rhs)

Copy Constructor.

Definition at line 21 of file DataHeader.cxx.

21  : m_pClid(rhs.m_pClid),
22  m_clids(rhs.m_clids),
23  m_key(rhs.m_key),
24  m_alias(rhs.m_alias),
25  m_token(rhs.getToken()),
26  m_hashes(rhs.m_hashes) {
27 }

◆ DataHeaderElement() [3/6]

DataHeaderElement::DataHeaderElement ( const SG::TransientAddress sgAddress,
IOpaqueAddress *  tokAddress,
const std::string &  pTag 
)

Constructor.

Parameters
sgAddress[IN] pointer to TransientAddress for which a DataHeaderElement is created.
pTag[IN] string used as key element in DataHeader (SG key for DataObjects).

Definition at line 29 of file DataHeader.cxx.

31  : DataHeaderElement (sgAddress->clID(),
32  sgAddress->name(),
33  sgAddress->transientID(),
34  SG::DataProxy::AliasCont_t (sgAddress->alias()),
35  sgAddress->address(),
36  tokAddress, pTag)
37 {
38 }

◆ DataHeaderElement() [4/6]

DataHeaderElement::DataHeaderElement ( const SG::DataProxy proxy,
IOpaqueAddress *  tokAddress,
const std::string &  pTag 
)

Constructor.

Parameters
proxy[IN] pointer to DataProxy for which a DataHeaderElement is created.
pTag[IN] string used as key element in DataHeader (SG key for DataObjects).

Definition at line 40 of file DataHeader.cxx.

42  : DataHeaderElement (proxy->clID(),
43  proxy->name(),
44  proxy->transientID(),
45  proxy->alias(),
46  proxy->address(),
47  tokAddress, pTag)
48 {
49 }

◆ DataHeaderElement() [5/6]

DataHeaderElement::DataHeaderElement ( const CLID  classID,
const std::string &  key,
Token &&  token 
)

Constructor.

Parameters
classID[IN] Primary ClassID of the DataObject for which a DataHeaderElement is created.
key[IN] SG Key of the DataObject for which a DataHeaderElement is created.
token[IN] Token of the DataObject for which a DataHeaderElement is created.

Definition at line 83 of file DataHeader.cxx.

85  : m_pClid(classID), m_clids(), m_key(key), m_alias(), m_token(std::move(token)), m_hashes() {
86 }

◆ ~DataHeaderElement()

DataHeaderElement::~DataHeaderElement ( )
virtual

Destructor.

Definition at line 88 of file DataHeader.cxx.

88  {
89 }

◆ DataHeaderElement() [6/6]

DataHeaderElement::DataHeaderElement ( CLID  clid,
const std::string &  name,
const std::vector< CLID > &  tClids,
std::set< std::string > &&  alias,
IOpaqueAddress *  tadAddress,
IOpaqueAddress *  tokAddress,
const std::string &  pTag 
)
private

Internal constructor.

Definition at line 51 of file DataHeader.cxx.

58  : m_pClid(clid),
59  m_clids(tClids),
60  m_key((pTag.empty()) ? name : pTag),
61  m_alias(std::move(alias)),
62  m_hashes()
63 {
64  std::ranges::sort (m_clids);
65  const auto ret = std::ranges::unique (m_clids);
66  m_clids.erase (ret.begin(), ret.end());
67  std::erase (m_clids, m_pClid);
68  TokenAddress* tokAddr = dynamic_cast<TokenAddress*>(tokAddress);
69  if (tokAddr != 0 && tokAddr->getToken() != 0) {
70  tokAddr->getToken()->setData (&m_token);
71  } else {
72  tokAddr = dynamic_cast<TokenAddress*>(tadAddress);
73  if (tokAddr != 0 && tokAddr->getToken() != 0) {
74  tokAddr->getToken()->setData (&m_token);
75  } else if (tokAddress != 0) {
76  m_token.fromString(*(tokAddress->par()));
77  } else if (tadAddress != 0) {
78  m_token.fromString(*(tadAddress->par()));
79  }
80  }
81 }

Member Function Documentation

◆ addHash()

void DataHeaderElement::addHash ( IStringPool pool)

Add new entry to hash map.

Definition at line 137 of file DataHeader.cxx.

137  {
138  if (!m_hashes.empty()) {
139  return;
140  }
141  std::set<CLID> clids = getClassIDs();
142  for (std::set<CLID>::iterator iter = clids.begin(), last = clids.end(); iter != last; ++iter) {
143  m_hashes.push_back(pool->stringToKey(m_key, *iter));
144  }
145 }

◆ dump()

void DataHeaderElement::dump ( std::ostream &  ostr) const

Definition at line 160 of file DataHeader.cxx.

161 {
162  using namespace std;
163  ostr << "SGKey: " << getKey() << endl;
164  ostr << "CLID: " << getPrimaryClassID();
165  if( getClassIDs().size() > 1 ) {
166  ostr << " ||";
167  for( auto& c : getClassIDs() ) ostr << " " << c;
168  }
169  ostr << std::endl;
170  if( getAlias().size() > 0 ) {
171  ostr << "Alias: ";
172  for( auto& a : getAlias() ) ostr << " " << a;
173  ostr << endl;
174  }
175  ostr << "Token: " << m_token.toString() << endl;
176  if( m_hashes.size() ) {
177  ostr << "Hashes:";
178  for( auto h : m_hashes ) ostr << " " << h;
179  ostr << endl;
180  }
181 }

◆ getAddress() [1/2]

SG::TransientAddress * DataHeaderElement::getAddress ( const std::string &  key,
unsigned long  contextId = 0 
) const
Returns
a pointer to the TransientAddress of the DataObject, with new transient key.

Definition at line 151 of file DataHeader.cxx.

152  {
153  CLID primaryClID = getPrimaryClassID();
154  TokenAddress* tokAdd = new TokenAddress(this->getStorageType(), primaryClID, "", m_key, contextId , &m_token);
155  SG::TransientAddress* sgAddress = new SG::TransientAddress(primaryClID, key, tokAdd, m_clids);
156  sgAddress->setAlias(m_alias);
157  return(sgAddress);
158 }

◆ getAddress() [2/2]

SG::TransientAddress * DataHeaderElement::getAddress ( unsigned long  contextId = 0) const
Returns
a pointer to the TransientAddress of the DataObject.

Definition at line 147 of file DataHeader.cxx.

147  {
148  return(getAddress(m_key, contextId));
149 }

◆ getAlias()

const std::set< std::string > & DataHeaderElement::getAlias ( ) const
Returns
StoreGate alias string set.

Definition at line 120 of file DataHeader.cxx.

120  {
121  return(m_alias);
122 }

◆ getClassIDs()

const std::set< CLID > DataHeaderElement::getClassIDs ( ) const
Returns
a set of all ClassIDs (primary and symlinked).

Definition at line 110 of file DataHeader.cxx.

110  {
111  std::set<CLID> allClids (m_clids.begin(), m_clids.end());
112  allClids.insert(m_pClid);
113  return(allClids);
114 }

◆ getHashes()

const std::vector< DataHeaderElement::sgkey_t > & DataHeaderElement::getHashes ( ) const
Returns
the list of hash codes. In 1-1 correspondence with the CLID set.

Definition at line 133 of file DataHeader.cxx.

133  {
134  return(m_hashes);
135 }

◆ getKey()

const std::string & DataHeaderElement::getKey ( ) const
Returns
StoreGate key string.

Definition at line 116 of file DataHeader.cxx.

116  {
117  return(m_key);
118 }

◆ getPrimaryClassID()

CLID DataHeaderElement::getPrimaryClassID ( ) const
Returns
primary ClassID.

Definition at line 103 of file DataHeader.cxx.

103  {
104  if (m_pClid > 0) {
105  return(m_pClid);
106  }
107  return(m_clids.front());
108 }

◆ getStorageType()

long DataHeaderElement::getStorageType ( ) const
Returns
StorageType needed to read the DataObject (depends on technology).

Definition at line 128 of file DataHeader.cxx.

128  {
129  return(POOL_StorageType);
130 }

◆ getToken()

const Token * DataHeaderElement::getToken ( ) const
Returns
token by pointer (and give away ownership).

Definition at line 124 of file DataHeader.cxx.

124  {
125  return(&m_token);
126 }

◆ operator=()

DataHeaderElement & DataHeaderElement::operator= ( const DataHeaderElement rhs)

Assignment Operator.

Definition at line 91 of file DataHeader.cxx.

91  {
92  if (this != &rhs) {
93  m_pClid = rhs.m_pClid;
94  m_clids = rhs.m_clids;
95  m_key = rhs.m_key;
96  m_alias = rhs.m_alias;
97  rhs.getToken()->setData(&m_token);
98  m_hashes = rhs.m_hashes;
99  }
100  return(*this);
101 }

Friends And Related Function Documentation

◆ DataHeaderCnv_p6

friend class DataHeaderCnv_p6
friend

Definition at line 97 of file DataHeader.h.

◆ DataHeaderElementCnv_p3

friend class DataHeaderElementCnv_p3
friend

Definition at line 94 of file DataHeader.h.

◆ DataHeaderElementCnv_p4

friend class DataHeaderElementCnv_p4
friend

Definition at line 95 of file DataHeader.h.

◆ DataHeaderElementCnv_p5

friend class DataHeaderElementCnv_p5
friend

Definition at line 96 of file DataHeader.h.

Member Data Documentation

◆ m_alias

std::set<std::string> DataHeaderElement::m_alias
private

set of StoreGate alias string.

Definition at line 114 of file DataHeader.h.

◆ m_clids

std::vector<CLID> DataHeaderElement::m_clids
private

vector of unsigned long to store ClassID's for symlinked container.

Definition at line 110 of file DataHeader.h.

◆ m_hashes

std::vector<sgkey_t> DataHeaderElement::m_hashes
private

hash table for ElementLink host container keys.

Definition at line 118 of file DataHeader.h.

◆ m_key

std::string DataHeaderElement::m_key
private

string with StoreGate key.

Definition at line 112 of file DataHeader.h.

◆ m_pClid

CLID DataHeaderElement::m_pClid
private

primary ClassID.

Definition at line 108 of file DataHeader.h.

◆ m_token

Token DataHeaderElement::m_token
private

Transient address token.

Definition at line 116 of file DataHeader.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataHeaderElement::m_key
std::string m_key
string with StoreGate key.
Definition: DataHeader.h:112
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:395
DataHeaderElement::getAlias
const std::set< std::string > & getAlias() const
Definition: DataHeader.cxx:120
DataHeaderElement::m_token
Token m_token
Transient address token.
Definition: DataHeader.h:116
DataHeaderElement::m_pClid
CLID m_pClid
primary ClassID.
Definition: DataHeader.h:108
pool
pool namespace
Definition: libname.h:15
SG::TransientAddress::setAlias
void setAlias(const std::string &key)
set alias'
Definition: TransientAddress.h:257
SG::TransientAddress
Definition: TransientAddress.h:32
TokenAddress
This class provides a Generic Transient Address for POOL tokens.
Definition: TokenAddress.h:23
SG::TransientAddress::name
const std::string & name() const
Get the primary (hashed) SG key.
Definition: TransientAddress.h:214
DataHeaderElement::getKey
const std::string & getKey() const
Definition: DataHeader.cxx:116
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Token::fromString
Token & fromString(const std::string &from)
Build from the string representation of a token.
Definition: Token.cxx:148
DataHeaderElement::m_alias
std::set< std::string > m_alias
set of StoreGate alias string.
Definition: DataHeader.h:114
SG::TransientAddress::alias
const TransientAliasSet & alias() const
set the clearAddress flag: IOA will not be deleted in proxy
Definition: TransientAddress.h:284
h
extractSporadic.h
list h
Definition: extractSporadic.py:97
SG::TransientAddress::clID
CLID clID() const
Retrieve string key:
Definition: TransientAddress.h:207
COOLRates.alias
alias
Definition: COOLRates.py:1172
DataHeaderElement::DataHeaderElement
DataHeaderElement()
Default Constructor.
Definition: DataHeader.cxx:18
TokenAddress::getToken
Token * getToken()
Definition: TokenAddress.cxx:15
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::getClassIDs
const std::set< CLID > getClassIDs() const
Definition: DataHeader.cxx:110
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DataHeaderElement::getPrimaryClassID
CLID getPrimaryClassID() const
Definition: DataHeader.cxx:103
Token::toString
virtual const std::string toString() const
Retrieve the string representation of the token.
Definition: Token.cxx:129
DataHeaderElement::getStorageType
long getStorageType() const
Definition: DataHeader.cxx:128
DataHeaderElement::m_hashes
std::vector< sgkey_t > m_hashes
hash table for ElementLink host container keys.
Definition: DataHeader.h:118
DataHeaderElement::m_clids
std::vector< CLID > m_clids
vector of unsigned long to store ClassID's for symlinked container.
Definition: DataHeader.h:110
DataHeaderElement::getAddress
SG::TransientAddress * getAddress(unsigned long contextId=0) const
Definition: DataHeader.cxx:147
a
TList * a
Definition: liststreamerinfos.cxx:10
Token::setData
const Token & setData(Token *pToken) const
Set all the data part of the token.
Definition: Token.cxx:209
DataHeaderElement::getToken
const Token * getToken() const
Definition: DataHeader.cxx:124
python.compressB64.c
def c
Definition: compressB64.py:93
SG::DataProxy::AliasCont_t
TransientAddress::TransientAliasSet AliasCont_t
Definition: DataProxy.h:55
SG::TransientAddress::transientID
bool transientID(CLID id) const
set transient CLID's
Definition: TransientAddress.h:242
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37