ATLAS Offline Software
|
#include <ReadHandle.h>
Public Types | |
typedef T * | pointer_type |
typedef const T * | const_pointer_type |
typedef T & | reference_type |
typedef const T & | const_reference_type |
Public Member Functions | |
ReadHandle () | |
Default constructor. More... | |
ReadHandle (const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE)) | |
Constructor with full arguments. More... | |
ReadHandle (const ReadHandleKey< T > &key) | |
Constructor from a ReadHandleKey. More... | |
ReadHandle (const ReadHandleKey< T > &key, const EventContext &ctx) | |
Constructor from a ReadHandleKey and an explicit event context. More... | |
ReadHandle (SG::DataProxy *proxy) | |
Constructor from a DataProxy. More... | |
ReadHandle (const ReadHandle &rhs) | |
Copy constructor. More... | |
ReadHandle (ReadHandle &&rhs) | |
Move constructor. More... | |
ReadHandle & | operator= (const ReadHandle &rhs) |
Assignment operator. More... | |
ReadHandle & | operator= (ReadHandle &&rhs) |
Move operator. More... | |
const_pointer_type | operator-> () |
Dereference the pointer. More... | |
const_reference_type | operator* () |
Dereference the pointer. More... | |
const_pointer_type | cptr () |
Dereference the pointer. More... | |
const_pointer_type | ptr () |
Dereference the pointer. More... | |
const_pointer_type | cachedPtr () const |
Return the cached pointer directly; no lookup. More... | |
virtual bool | isValid () override final |
Can the handle be successfully dereferenced? More... | |
const_pointer_type | get () const |
Dereference the pointer, but don't cache anything. More... | |
const_pointer_type | get (const EventContext &ctx) const |
Dereference the pointer, but don't cache anything. More... | |
StatusCode | alias (const WriteHandleKey< T > &key) |
Make an alias. More... | |
virtual const std::string & | key () const override final |
Return the StoreGate ID for the referenced object. More... | |
const std::string & | name () const |
Return the StoreGate ID for the referenced object. More... | |
std::string | store () const |
Return the name of the store holding the object we are proxying. More... | |
bool | isPresent () const |
Is the referenced object present in SG? More... | |
bool | isInitialized () const |
Has a proxy been retrieved from SG? More... | |
virtual bool | isSet () const override final |
Has a proxy been retrieved from SG? More... | |
bool | isConst () const |
True if this handle has a proxy, and the proxy is const. More... | |
StatusCode | initialize (bool used=true) |
Verify that the handle has been configured properly. More... | |
StatusCode | setState () |
Retrieve and cache all information managed by a handle. More... | |
virtual StatusCode | setProxyDict (IProxyDict *store) |
Explicitly set the event store. More... | |
virtual void | reset (bool hard) override |
Reset this handle. More... | |
virtual void | finalReset () override final |
Reset this handle at the end of processing. More... | |
StatusCode | setConst () |
Set the 'const' bit for the bound proxy in the store. More... | |
CLID | clid () const |
Return the class ID for the referenced object. More... | |
const ServiceHandle< IProxyDict > & | storeHandle () const |
Return handle to the referenced store. More... | |
Gaudi::DataHandle::Mode | mode () const |
Return the mode (read/write/update) for this handle. More... | |
const std::string & | objKey () const |
Return the key string of the underlying DataObjID . More... | |
const DataObjID & | fullKey () const |
Return the key as a DataObjID . More... | |
SG::VarHandleKey & | vhKey () |
Return a non-const reference to the HandleKey. More... | |
StatusCode | assign (const std::string &sgkey) |
Update the underlying key from a string. More... | |
Protected Member Functions | |
ReadHandle (const VarHandleKey &key, const EventContext *ctx) | |
Protected constructor used by WriteDecorHandle. More... | |
StatusCode | setState (SG::DataProxy *proxy) |
Set the state of the handle to a given proxy. More... | |
StatusCode | setState (IProxyDict *store, const std::string &name) |
Set the state of a handle from a store and a key name. More... | |
StatusCode | record_impl (std::unique_ptr< DataObject > dobj, void *dataPtr, bool allowMods, bool returnExisting) |
Helper to record an object in the event store. More... | |
const void * | put_impl (const EventContext *ctx, std::unique_ptr< DataObject > dobj, const void *dataPtr, bool allowMods, bool returnExisting, IProxyDict *&store) const |
Helper to record an object in the event store. More... | |
void * | typeless_dataPointer_impl (bool quiet) |
Retrieve an object from StoreGate. More... | |
void * | typeless_dataPointer (bool quiet=defaultQuiet) |
Retrieve an object from StoreGate. More... | |
const void * | typeless_cptr () |
Retrieve an object from StoreGate as a const pointer. More... | |
void * | typeless_ptr (bool quiet=defaultQuiet) |
Retrieve an object from StoreGate as non-const pointer. More... | |
const void * | get_impl (const EventContext *ctx, bool quiet=defaultQuiet) const |
StatusCode | symLink_impl (CLID newClid, const std::string &newKey) |
Make a symlink or alias to the object currently referenced by this handle. More... | |
bool | isPresent_impl (const std::string &key) const |
Is the referenced object present in SG? More... | |
Protected Attributes | |
void * | m_ptr |
The object to which we are bound. More... | |
SG::DataProxy * | m_proxy |
Proxy holding the object to which we are bound. More... | |
IProxyDict * | m_store |
Pointer to the store that owns the object. More... | |
bool | m_storeWasSet |
True if the store was set explicitly via setProxyDict. More... | |
Private Member Functions | |
const_pointer_type | checkedCPtr () |
Helper: dereference the pointer. More... | |
IProxyDict * | storeFromHandle (const EventContext *ctx) const |
Return the store instance to use. More... | |
bool | setStoreFromHandle (const EventContext *ctx) |
Initialize the store pointer from the store handle. More... | |
void | resetProxy () |
Clear the m_proxy field and release the old proxy. More... | |
void | setProxy (SG::DataProxy *proxy) |
Set a new proxy. More... | |
void * | typeless_dataPointer_fromProxy (SG::DataProxy *proxy, bool quiet) const |
Retrieve a pointer from a proxy. More... | |
Private Attributes | |
std::unique_ptr< VarHandleKey > | m_ownedKey |
An owned VarHandleKey . More... | |
const VarHandleKey * | m_key |
The associated key object. More... | |
Definition at line 68 of file StoreGate/StoreGate/ReadHandle.h.
typedef const T* SG::ReadHandle< T >::const_pointer_type |
Definition at line 73 of file StoreGate/StoreGate/ReadHandle.h.
typedef const T& SG::ReadHandle< T >::const_reference_type |
Definition at line 75 of file StoreGate/StoreGate/ReadHandle.h.
typedef T* SG::ReadHandle< T >::pointer_type |
Definition at line 72 of file StoreGate/StoreGate/ReadHandle.h.
typedef T& SG::ReadHandle< T >::reference_type |
Definition at line 74 of file StoreGate/StoreGate/ReadHandle.h.
SG::ReadHandle< T >::ReadHandle | ( | ) |
Default constructor.
The handle will not be usable until a non-blank key is assigned.
|
explicit |
Constructor with full arguments.
sgkey | StoreGate key of the referenced object. |
storename | Name of the referenced event store. |
|
explicit |
Constructor from a ReadHandleKey.
key | The key object holding the clid/key/store. |
This will raise an exception if the StoreGate key is blank, or if the event store cannot be found.
|
explicit |
Constructor from a ReadHandleKey and an explicit event context.
key | The key object holding the clid/key. |
ctx | The event context. |
This will raise an exception if the StoreGate key is blank, or if the event store cannot be found.
If the default event store has been requested, then the thread-specific store from the event context will be used.
|
explicit |
Constructor from a DataProxy.
proxy | The proxy to which to bind. |
mode | Mode of this handle (read/write/update). |
This handle will be bound to the given proxy.
SG::ReadHandle< T >::ReadHandle | ( | const ReadHandle< T > & | rhs | ) |
Copy constructor.
SG::ReadHandle< T >::ReadHandle | ( | ReadHandle< T > && | rhs | ) |
Move constructor.
|
explicitprotected |
Protected constructor used by WriteDecorHandle.
key | The key object holding the clid/key. |
ctx | The event context, or nullptr to use the global default. |
StatusCode SG::ReadHandle< T >::alias | ( | const WriteHandleKey< T > & | key | ) |
Make an alias.
key | Alternate key by which the referenced object should be known. |
The current handle should be valid and referencing an object.
The object will also be known by the name given in key
.
|
inherited |
Update the underlying key from a string.
If this handle was initialized from a HandleKey, then this doesn't work (since the HandleKey is const). ExcNonConstHandleKey will be thrown in that case.
See VarHandleKey::assign.
Definition at line 642 of file StoreGate/src/VarHandleBase.cxx.
const_pointer_type SG::ReadHandle< T >::cachedPtr | ( | ) | const |
Return the cached pointer directly; no lookup.
|
private |
Helper: dereference the pointer.
Throws ExcNullReadHandle on failure.
|
inherited |
Return the class ID for the referenced object.
const_pointer_type SG::ReadHandle< T >::cptr | ( | ) |
Dereference the pointer.
Returns nullptr on failure.
|
finaloverridevirtualinherited |
Reset this handle at the end of processing.
hard If true, anything depending on the event store is cleared.
Same as reset(true);
Reimplemented from IResetable.
Definition at line 595 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return the key as a DataObjID
.
const_pointer_type SG::ReadHandle< T >::get | ( | ) | const |
Dereference the pointer, but don't cache anything.
const_pointer_type SG::ReadHandle< T >::get | ( | const EventContext & | ctx | ) | const |
Dereference the pointer, but don't cache anything.
ctx | The event context to use. |
|
protectedinherited |
Definition at line 876 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Verify that the handle has been configured properly.
used | If false, then this handle is not to be used. Instead of normal initialization, the key will be cleared. |
This will return failure if the key is blank or if the event store cannot be found.
Definition at line 452 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
True if this handle has a proxy, and the proxy is const.
Refers to the state of the proxy, not of the handle.
Definition at line 432 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Has a proxy been retrieved from SG?
(Weaker test than isValid
, but does not touch the disk.)
Definition at line 406 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Is the referenced object present in SG?
Const method; the handle does not change as a result of this.
Definition at line 394 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Is the referenced object present in SG?
key | SG key to test. |
Const method; the handle does not change as a result of this.
Definition at line 1101 of file StoreGate/src/VarHandleBase.cxx.
|
finaloverridevirtualinherited |
Has a proxy been retrieved from SG?
Same as isInitialized
; this is an interface required by IResetable
.
Implements IResetable.
Definition at line 420 of file StoreGate/src/VarHandleBase.cxx.
|
finaloverridevirtual |
Can the handle be successfully dereferenced?
Implements SG::VarHandleBase.
|
finaloverridevirtualinherited |
Return the StoreGate ID for the referenced object.
This is defined in VarHandleKey
. We need to redefine it here because it's also in IResetable
. (Otherwise there would be an ambiguity.)
Implements IResetable.
Definition at line 64 of file AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx.
|
inherited |
Return the mode (read/write/update) for this handle.
|
inherited |
Return the StoreGate ID for the referenced object.
Definition at line 75 of file AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx.
|
inherited |
Return the key string of the underlying DataObjID
.
Compared to key()
, this will be prefixed with the store name.
const_reference_type SG::ReadHandle< T >::operator* | ( | ) |
Dereference the pointer.
Throws ExcNullReadHandle on failure.
const_pointer_type SG::ReadHandle< T >::operator-> | ( | ) |
Dereference the pointer.
Throws ExcNullReadHandle on failure.
ReadHandle& SG::ReadHandle< T >::operator= | ( | const ReadHandle< T > & | rhs | ) |
Assignment operator.
ReadHandle& SG::ReadHandle< T >::operator= | ( | ReadHandle< T > && | rhs | ) |
Move operator.
const_pointer_type SG::ReadHandle< T >::ptr | ( | ) |
Dereference the pointer.
Returns nullptr on failure.
|
protectedinherited |
Helper to record an object in the event store.
Unlike record, put does not change the handle and does not cache the pointer in the handle.
ctx | The event context, or nullptr to use the current context. | |
dobj | The wrapped data object (DataBucket) to record. | |
dataPtr | Pointer to the transient object itself. | |
allowMods | If false, record the object as const. | |
returnExisting | Allow an existing object. | |
[out] | store | The store being used. |
Returns the object placed in the store, or nullptr if there was an error. If there was already an object in the store with the given key, then return null, unless returnExisting
is true, in which case return success. In either case, dobj
is destroyed.
Definition at line 782 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Helper to record an object in the event store.
The | wrapped data object (DataBucket) to record. |
dataPtr | Pointer to the transient object itself. |
allowMods | If false, record the object as const. |
returnExisting | Allow an existing object. |
If there is already an existing object with our key, then return failure, unless returnExisting
is true, in which case return success. In either case, dobj
is destroyed.
Definition at line 713 of file StoreGate/src/VarHandleBase.cxx.
|
overridevirtualinherited |
Reset this handle.
hard | If true, anything depending on the event store is cleared. |
If the handle stays associated with a given event store, then hard=false. In that case, we clear the cached pointer; the proxy is also dropped if it is reset only. If hard=true, then we always drop the proxy and in addition clear the cached pointer to the event store.
Implements IResetable.
Reimplemented in SG::UpdateHandle< T >.
Definition at line 570 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
Clear the m_proxy field and release the old proxy.
Definition at line 1004 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Set the 'const' bit for the bound proxy in the store.
Definition at line 606 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
Set a new proxy.
Release any old one first.
proxy | The new proxy. |
Definition at line 1020 of file StoreGate/src/VarHandleBase.cxx.
|
virtualinherited |
Explicitly set the event store.
store | The new event store. |
This implicitly does a reset().
Reimplemented in SG::WriteDecorHandle< DataVector, int >, SG::WriteDecorHandle< DataVector, float >, SG::WriteDecorHandle< DataVector, std::vector< float > >, SG::WriteDecorHandle< DataVector, std::vector< int > >, SG::WriteDecorHandle< DataVector, std::vector< bool > >, and SG::WriteDecorHandle< DataVector, uint32_t >.
Definition at line 551 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Retrieve and cache all information managed by a handle.
This will retrieve and cache the associated DataProxy
.
Note for the case of a WriteHandle that has not yet been written to, the proxy may not exist. We return Success in that case; however, isInitialized
will still return false.
Definition at line 487 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Set the state of a handle from a store and a key name.
store | The event store to access. |
name | The StoreGate key to search for. |
Fails if no such object is recorded.
store | The event store to access. |
name | The StoreGate key to search for. |
Definition at line 686 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Set the state of the handle to a given proxy.
proxy | The proxy to set. |
The proxy must be valid; otherwise FAILURE will be returned.
Definition at line 660 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
Initialize the store pointer from the store handle.
Also checks that the key is valid.
ctx | The current event context, or nullptr. |
Returns true on success.
Definition at line 987 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return the name of the store holding the object we are proxying.
Definition at line 376 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
Return the store instance to use.
ctx | The current event context, or nullptr. |
ctx | The current event context, or nullptr. |
If we're referencing the default event store, pick the specific store to use in this order:
For another store:
Definition at line 957 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return handle to the referenced store.
|
protectedinherited |
Make a symlink or alias to the object currently referenced by this handle.
newClid | CLID of link. |
newKey | SG key of link. |
If newClid matches the existing clid, then make an alias. If newKey matches the existing key, then make a symlink. If neither match, it's an error.
Definition at line 926 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Retrieve an object from StoreGate as a const pointer.
Same as typeless_dataPointer with the return value converted to const.
|
protectedinherited |
Retrieve an object from StoreGate.
quiet | If true, suppress failure messages. |
Inline method: first check cached pointer, then call the _impl method.
|
privateinherited |
Retrieve a pointer from a proxy.
proxy | The proxy object. |
quiet | If true, suppress failure messages. |
Warning — doesn't enforce const rules; the caller must do that.
Definition at line 1041 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Retrieve an object from StoreGate.
quiet | If true, suppress failure messages. |
Definition at line 824 of file StoreGate/src/VarHandleBase.cxx.
|
protectedinherited |
Retrieve an object from StoreGate as non-const pointer.
Calls typeless_dataPointer, then raises an exception if the proxy is marked as const.
Definition at line 859 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return a non-const reference to the HandleKey.
If this handle was initialized from a HandleKey, then this doesn't work (since the HandleKey is const). ExcNonConstHandleKey will be thrown in that case.
Definition at line 623 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
The associated key object.
If we were initialized from a key object, then this points at that. Otherwise, it points at the same object as m_ownedKey
.
Definition at line 523 of file StoreGate/StoreGate/VarHandleBase.h.
|
privateinherited |
An owned VarHandleKey
.
This is set in the case where a VarHandle
is not initialized from a key object.
Definition at line 518 of file StoreGate/StoreGate/VarHandleBase.h.
|
protectedinherited |
Proxy holding the object to which we are bound.
Definition at line 505 of file StoreGate/StoreGate/VarHandleBase.h.
|
protectedinherited |
The object to which we are bound.
Definition at line 502 of file StoreGate/StoreGate/VarHandleBase.h.
|
protectedinherited |
Pointer to the store that owns the object.
Definition at line 508 of file StoreGate/StoreGate/VarHandleBase.h.
|
protectedinherited |
True if the store was set explicitly via setProxyDict.
Definition at line 511 of file StoreGate/StoreGate/VarHandleBase.h.