ATLAS Offline Software
Loading...
Searching...
No Matches
DataProxyHolder.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef ATHLINKS_DATAPROXYHOLDER_H
14#define ATHLINKS_DATAPROXYHOLDER_H
15
16
17#include "SGCore/sgkey_t.h"
18#include "GaudiKernel/ClassID.h"
19#include <string>
20#include <unordered_map>
21#include <cassert>
22
23
24class IProxyDict;
25
26
27namespace SG {
28
29
30class ThinningCache;
31class DataProxy;
32
33
61{
62public:
65
67 using ID_type = std::string;
68
70 using pointer_t = void*;
71 using const_pointer_t = const void*;
72
74 typedef void* castfn_t (SG::DataProxy*);
75
76
83
84
95 template <class FROM_STORABLE, class TO_STORABLE>
96 DataProxyHolder (const DataProxyHolder& other, FROM_STORABLE*, TO_STORABLE*);
97
98
99 DataProxyHolder (const DataProxyHolder&) = default;
101
102
106 void clear();
107
108
128 CLID link_clid,
129 IProxyDict* sg);
130
131
149 CLID link_clid,
150 IProxyDict* sg);
151
152
169 void toIdentifiedObject (sgkey_t key,
170 CLID link_clid,
171 IProxyDict* sg);
172
173
177 bool isDefault() const;
178
179
185 const ID_type& dataID() const;
186
187
199 void* storableBase (castfn_t* castfn, CLID clid, bool isConst) const;
200
201
202
215 SG::DataProxy* proxy (bool nothrow = false) const;
216
217
225 IProxyDict* source() const;
226
227
241 void toTransient (sgkey_t sgkey,
242 IProxyDict* sg = nullptr,
243 bool noDummy = false);
244
245
260 CLID link_clid,
261 IProxyDict* sg = 0);
262
263
279 void toPersistentNoRemap (sgkey_t& sgkey);
280
281
302 bool toPersistent (sgkey_t& sgkey, uint64_t& index);
303
304
325 bool toPersistent (sgkey_t& sgkey, uint32_t& index);
326
327
346 template <class T>
347 bool toPersistent (sgkey_t& sgkey, const T& /*index*/);
348
349
362 static
363 bool thin (sgkey_t& sgkey, size_t& index,
364 const SG::ThinningCache* thinningCache);
365
366
370 bool operator== (const DataProxyHolder& other) const;
371
372
379 void throwInvalidLink (sgkey_t sgkey) const;
380
381
382private:
388 bool isObjpointer() const;
389
390
397
398
406
407
419 SG::DataProxy* proxy1 (bool nothrow) const;
420
421
429
430
441 bool tryRemap (sgkey_t& sgkey, size_t& index);
442
443
447};
448
449
450} // namespace SG
451
452
454
455
456#endif // not ATHLINKS_DATAPROXYHOLDER_H
uint32_t CLID
The Class ID type.
bool toPersistent(sgkey_t &sgkey, uint64_t &index)
Prepare this link for writing.
SG::DataProxy * m_proxy
The DataProxy referring to our object, if the LSB is clear; pointer to the object which we're referen...
DataProxyHolder(const DataProxyHolder &other, FROM_STORABLE *, TO_STORABLE *)
Constructor from a holder referencing a different type.
bool isObjpointer() const
Test to see if we're pointing directly at an object.
SG::DataProxy * proxy1(bool nothrow) const
Helper for proxy(), for the case of a direct object pointer.
sgkey_t toIdentifiedObject(const ID_type &dataID, CLID link_clid, IProxyDict *sg)
Set the link to an object given by a string key.
bool operator==(const DataProxyHolder &other) const
Compare for equality.
SG::sgkey_t sgkey_t
Type of hashed keys.
sgkey_t toStorableObject(const_pointer_t obj, CLID link_clid, IProxyDict *sg)
Set the link to an object given by a pointer.
void toPersistentNoRemap(sgkey_t &sgkey)
Prepare this link for writing.
void toTransient(sgkey_t sgkey, IProxyDict *sg=nullptr, bool noDummy=false)
Finish initialization after link has been read.
IProxyDict * source1()
Return the data source for this reference.
pointer_t objpointer() const
Return a pointer to the object we're pointing at directly.
static bool thin(sgkey_t &sgkey, size_t &index, const SG::ThinningCache *thinningCache)
Adjust for thinning, with explicitly provided thinning cache.
void throwInvalidLink(sgkey_t sgkey) const
Throw a ExcInvalidLink exception for this link.
void storeObjpointer(const_pointer_t p)
Store a direct pointer to an object.
void * castfn_t(SG::DataProxy *)
Function casting from a SG::DataProxy to a pointer.
void * pointer_t
Generic pointer type.
bool tryRemap(sgkey_t &sgkey, size_t &index)
Test to see if the link has been remapped.
bool isDefault() const
Test to see if this is a null link.
bool toPersistent(sgkey_t &sgkey, const T &)
Prepare this link for writing.
DataProxyHolder(const DataProxyHolder &)=default
void * storableBase(castfn_t *castfn, CLID clid, bool isConst) const
Return a pointer to the currently-referenced object.
SG::DataProxy * proxy(bool nothrow=false) const
Return the DataProxy for this link.
DataProxyHolder & operator=(const DataProxyHolder &)=default
std::string ID_type
Type of string keys.
DataProxyHolder()
Default constructor.
IProxyDict * source() const
Return the data source for this reference.
const ID_type & dataID() const
Return the SG key that we reference, as a string.
void clear()
Reset the link to null.
const void * const_pointer_t
Cache thinning decisions for converters.
Forward declaration.
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32
Definition index.py:1