ATLAS Offline Software
|
#include <UpdateHandle.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 | |
UpdateHandle () | |
Default constructor. More... | |
UpdateHandle (const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE)) | |
Constructor with full arguments. More... | |
UpdateHandle (const UpdateHandleKey< T > &key) | |
Constructor from an UpdateHandleKey. More... | |
UpdateHandle (const UpdateHandleKey< T > &key, const EventContext &ctx) | |
Constructor from an UpdateHandleKey and an explicit event context. More... | |
UpdateHandle (const UpdateHandle &rhs) | |
Copy constructor. More... | |
UpdateHandle (UpdateHandle &&rhs) | |
Move constructor. More... | |
UpdateHandle & | operator= (const UpdateHandle &rhs) |
Assignment operator. More... | |
UpdateHandle & | operator= (UpdateHandle &&rhs) |
Move operator. More... | |
pointer_type | operator-> () |
Dereference the pointer. More... | |
reference_type | operator* () |
Dereference the pointer. More... | |
const_pointer_type | cptr () |
Dereference the pointer. More... | |
pointer_type | ptr () |
Dereference the pointer. More... | |
pointer_type | cachedPtr () |
Return the cached pointer directly; no lookup. More... | |
virtual bool | isValid () override final |
Can the handle be successfully dereferenced? More... | |
virtual void | reset (bool hard) override |
Reset this handle. More... | |
virtual void | reset (bool hard)=0 |
Clear cached data from this object. 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 | 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 | |
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 | |
pointer_type | checkedPtr () |
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 92 of file UpdateHandle.h.
typedef const T* SG::UpdateHandle< T >::const_pointer_type |
Definition at line 97 of file UpdateHandle.h.
typedef const T& SG::UpdateHandle< T >::const_reference_type |
Definition at line 99 of file UpdateHandle.h.
typedef T* SG::UpdateHandle< T >::pointer_type |
Definition at line 96 of file UpdateHandle.h.
typedef T& SG::UpdateHandle< T >::reference_type |
Definition at line 98 of file UpdateHandle.h.
SG::UpdateHandle< T >::UpdateHandle | ( | ) |
Default constructor.
The handle will not be usable until a non-blank key is assigned.
SG::UpdateHandle< T >::UpdateHandle | ( | const std::string & | sgkey, |
const std::string & | storename = StoreID::storeName(StoreID::EVENT_STORE) |
||
) |
Constructor with full arguments.
sgkey | StoreGate key of the referenced object. |
storename | Name of the referenced event store. |
|
explicit |
Constructor from an UpdateHandleKey.
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 an UpdateHandleKey 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.
SG::UpdateHandle< T >::UpdateHandle | ( | const UpdateHandle< T > & | rhs | ) |
Copy constructor.
SG::UpdateHandle< T >::UpdateHandle | ( | UpdateHandle< T > && | rhs | ) |
Move constructor.
|
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.
pointer_type SG::UpdateHandle< T >::cachedPtr | ( | ) |
Return the cached pointer directly; no lookup.
|
private |
Helper: dereference the pointer.
Throws ExcNullUpdateHandle on failure.
|
inherited |
Return the class ID for the referenced object.
const_pointer_type SG::UpdateHandle< T >::cptr | ( | ) |
Dereference the pointer.
Returns nullptr on failure.
This will not inform Hive that the object has been modified.
|
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
.
|
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.
reference_type SG::UpdateHandle< T >::operator* | ( | ) |
Dereference the pointer.
Throws ExcNullReadHandle on failure.
This will inform Hive that the object has been modified.
pointer_type SG::UpdateHandle< T >::operator-> | ( | ) |
Dereference the pointer.
Throws ExcNullReadHandle on failure.
This will inform Hive that the object has been modified.
UpdateHandle& SG::UpdateHandle< T >::operator= | ( | const UpdateHandle< T > & | rhs | ) |
Assignment operator.
UpdateHandle& SG::UpdateHandle< T >::operator= | ( | UpdateHandle< T > && | rhs | ) |
Move operator.
pointer_type SG::UpdateHandle< T >::ptr | ( | ) |
Dereference the pointer.
Returns nullptr on failure.
This will inform Hive that the object has been modified.
|
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.
|
overridevirtual |
Reset this handle.
hard | If true, anything depending on the event store is cleared. |
Call reset() from the base class.
Reimplemented from SG::VarHandleBase.
virtual void IResetable::reset |
Clear cached data from this object.
If HARD is true, then also clear any data that depends on the identity of the current event store. HARD will be set if the handle could potentially be looking at a different store the next time it is used. (This happens in Hive.)
For example, a VarHandle caches both a pointer to the referenced object and a pointer to the DataProxy used to reference it. If HARD is false, then only the object pointer need be cleared; but if it is true, then the DataProxy pointer should be cleared as well (and the object deregistered from the store).
|
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.