ATLAS Offline Software
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, const 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::set< CLIDm_clids
 set 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...
 
const Tokenm_token
 pointer to transient address More...
 
bool m_ownToken
 
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 36 of file DataHeader.h.

Member Typedef Documentation

◆ sgkey_t

Definition at line 38 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_token(0), m_ownToken(false), 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(0),
26  m_ownToken(false),
27  m_hashes(rhs.m_hashes) {
28  if (rhs.getToken() != 0) {
29  m_token = new Token(rhs.getToken()); m_ownToken = true;
30  }
31 }

◆ 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 33 of file DataHeader.cxx.

35  : DataHeaderElement (sgAddress->clID(),
36  sgAddress->name(),
37  sgAddress->transientID(),
38  SG::DataProxy::AliasCont_t (sgAddress->alias()),
39  sgAddress->address(),
40  tokAddress, pTag)
41 {
42 }

◆ 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 44 of file DataHeader.cxx.

46  : DataHeaderElement (proxy->clID(),
47  proxy->name(),
48  proxy->transientID(),
49  proxy->alias(),
50  proxy->address(),
51  tokAddress, pTag)
52 {
53 }

◆ DataHeaderElement() [5/6]

DataHeaderElement::DataHeaderElement ( const CLID  classID,
const std::string &  key,
const 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 88 of file DataHeader.cxx.

90  : m_pClid(classID), m_clids(), m_key(key), m_alias(), m_token(token), m_ownToken(true), m_hashes() {
91 }

◆ ~DataHeaderElement()

DataHeaderElement::~DataHeaderElement ( )
virtual

Destructor.

Definition at line 93 of file DataHeader.cxx.

93  {
94  if (m_ownToken) { delete m_token; m_token = 0; }
95 }

◆ 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 55 of file DataHeader.cxx.

62  : m_pClid(clid),
63  m_clids(tClids.begin(), tClids.end()),
64  m_key((pTag.empty()) ? name : pTag),
65  m_alias(std::move(alias)),
66  m_token(0), m_ownToken(false), m_hashes()
67 {
68  m_clids.erase(m_pClid);
69  TokenAddress* tokAddr = dynamic_cast<TokenAddress*>(tokAddress);
70  if (tokAddr != 0 && tokAddr->getToken() != 0) {
71  m_token = new Token(tokAddr->getToken()); m_ownToken = true;
72  } else {
73  tokAddr = dynamic_cast<TokenAddress*>(tadAddress);
74  if (tokAddr != 0 && tokAddr->getToken() != 0) {
75  m_token = tokAddr->getToken();
76  } else if (tokAddress != 0) {
77  Token* token = new Token;
78  m_token = token; m_ownToken = true;
79  token->fromString(*(tokAddress->par()));
80  } else if (tadAddress != 0) {
81  Token* token = new Token;
82  m_token = token; m_ownToken = true;
83  token->fromString(*(tadAddress->par()));
84  }
85  }
86 }

Member Function Documentation

◆ addHash()

void DataHeaderElement::addHash ( IStringPool pool)

Add new entry to hash map.

Definition at line 148 of file DataHeader.cxx.

148  {
149  if (!m_hashes.empty()) {
150  return;
151  }
152  std::set<CLID> clids = getClassIDs();
153  for (std::set<CLID>::iterator iter = clids.begin(), last = clids.end(); iter != last; ++iter) {
154  m_hashes.push_back(pool->stringToKey(m_key, *iter));
155  }
156 }

◆ dump()

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

Definition at line 176 of file DataHeader.cxx.

177 {
178  using namespace std;
179  ostr << "SGKey: " << getKey() << endl;
180  ostr << "CLID: " << getPrimaryClassID();
181  if( getClassIDs().size() > 1 ) {
182  ostr << " ||";
183  for( auto& c : getClassIDs() ) ostr << " " << c;
184  }
185  ostr << std::endl;
186  if( getAlias().size() > 0 ) {
187  ostr << "Alias: ";
188  for( auto& a : getAlias() ) ostr << " " << a;
189  ostr << endl;
190  }
191  if( m_token ) {
192  ostr << "Token: " << m_token->toString();
193  if( m_ownToken ) ostr << " owned";
194  ostr << endl;
195  }
196  if( m_hashes.size() ) {
197  ostr << "Hashes:";
198  for( auto h : m_hashes ) ostr << " " << h;
199  ostr << endl;
200  }
201 }

◆ 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 162 of file DataHeader.cxx.

163  {
164  CLID primaryClID = getPrimaryClassID();
165  Token* token = new Token(m_token);
166  TokenAddress* tokAdd = new TokenAddress(this->getStorageType(), primaryClID, "", m_key, contextId , token);
167  SG::TransientAddress* sgAddress = new SG::TransientAddress(primaryClID, key, tokAdd);
168  for (std::set<CLID>::const_iterator iter = m_clids.begin(), last = m_clids.end();
169  iter != last; ++iter) {
170  sgAddress->setTransientID(*iter);
171  }
172  sgAddress->setAlias(m_alias);
173  return(sgAddress);
174 }

◆ getAddress() [2/2]

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

Definition at line 158 of file DataHeader.cxx.

158  {
159  return(getAddress(m_key, contextId));
160 }

◆ getAlias()

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

Definition at line 131 of file DataHeader.cxx.

131  {
132  return(m_alias);
133 }

◆ getClassIDs()

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

Definition at line 121 of file DataHeader.cxx.

121  {
122  std::set<CLID> allClids (m_clids);
123  allClids.insert(m_pClid);
124  return(allClids);
125 }

◆ 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 144 of file DataHeader.cxx.

144  {
145  return(m_hashes);
146 }

◆ getKey()

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

Definition at line 127 of file DataHeader.cxx.

127  {
128  return(m_key);
129 }

◆ getPrimaryClassID()

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

Definition at line 114 of file DataHeader.cxx.

114  {
115  if (m_pClid > 0) {
116  return(m_pClid);
117  }
118  return(*(m_clids.begin()));
119 }

◆ getStorageType()

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

Definition at line 139 of file DataHeader.cxx.

139  {
140  return(POOL_StorageType);
141 }

◆ getToken()

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

Definition at line 135 of file DataHeader.cxx.

135  {
136  return(m_token);
137 }

◆ operator=()

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

Assignment Operator.

Definition at line 97 of file DataHeader.cxx.

97  {
98  if (this != &rhs) {
99  m_pClid = rhs.m_pClid;
100  m_clids = rhs.m_clids;
101  m_key = rhs.m_key;
102  m_alias = rhs.m_alias;
103  if (m_ownToken) { delete m_token; m_token = 0; m_ownToken = false; }
104  if (rhs.getToken() != 0) {
105  Token* newtok = new Token;
106  m_token = newtok; m_ownToken = true;
107  rhs.getToken()->setData(newtok);
108  }
109  m_hashes = rhs.m_hashes;
110  }
111  return(*this);
112 }

Friends And Related Function Documentation

◆ DataHeaderCnv_p6

friend class DataHeaderCnv_p6
friend

Definition at line 96 of file DataHeader.h.

◆ DataHeaderElementCnv_p3

friend class DataHeaderElementCnv_p3
friend

Definition at line 93 of file DataHeader.h.

◆ DataHeaderElementCnv_p4

friend class DataHeaderElementCnv_p4
friend

Definition at line 94 of file DataHeader.h.

◆ DataHeaderElementCnv_p5

friend class DataHeaderElementCnv_p5
friend

Definition at line 95 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 113 of file DataHeader.h.

◆ m_clids

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

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

Definition at line 109 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 111 of file DataHeader.h.

◆ m_ownToken

bool DataHeaderElement::m_ownToken
private

Definition at line 116 of file DataHeader.h.

◆ m_pClid

CLID DataHeaderElement::m_pClid
private

primary ClassID.

Definition at line 107 of file DataHeader.h.

◆ m_token

const Token* DataHeaderElement::m_token
private

pointer to transient address

Definition at line 115 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:111
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
DataHeaderElement::getAlias
const std::set< std::string > & getAlias() const
Definition: DataHeader.cxx:131
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
pool
pool namespace
Definition: libname.h:15
SG::TransientAddress::setAlias
void setAlias(const std::string &key)
set alias'
Definition: TransientAddress.h:251
SG::TransientAddress
Definition: TransientAddress.h:32
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
TokenAddress
This class provides a Generic Transient Address for POOL tokens.
Definition: TokenAddress.h:21
SG::TransientAddress::name
const std::string & name() const
Get the primary (hashed) SG key.
Definition: TransientAddress.h:208
DataHeaderElement::getKey
const std::string & getKey() const
Definition: DataHeader.cxx:127
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:133
DataHeaderElement::m_alias
std::set< std::string > m_alias
set of StoreGate alias string.
Definition: DataHeader.h:113
SG::TransientAddress::alias
const TransientAliasSet & alias() const
set the clearAddress flag: IOA will not be deleted in proxy
Definition: TransientAddress.h:278
h
extractSporadic.h
list h
Definition: extractSporadic.py:97
SG::TransientAddress::clID
CLID clID() const
Retrieve string key:
Definition: TransientAddress.h:201
COOLRates.alias
alias
Definition: COOLRates.py:1172
DataHeaderElement::DataHeaderElement
DataHeaderElement()
Default Constructor.
Definition: DataHeader.cxx:18
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:121
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataHeaderElement::getPrimaryClassID
CLID getPrimaryClassID() const
Definition: DataHeader.cxx:114
Token::toString
virtual const std::string toString() const
Retrieve the string representation of the token.
Definition: Token.cxx:114
SG::TransientAddress::setTransientID
void setTransientID(CLID id)
get transient CLID's
Definition: TransientAddress.cxx:142
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
a
TList * a
Definition: liststreamerinfos.cxx:10
TokenAddress::getToken
Token * getToken()
Definition: TokenAddress.h:48
DataHeaderElement::m_token
const Token * m_token
pointer to transient address
Definition: DataHeader.h:115
Token::setData
const Token & setData(Token *pToken) const
Set all the data part of the token.
Definition: Token.cxx:194
DataHeaderElement::getToken
const Token * getToken() const
Definition: DataHeader.cxx:135
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:236
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37