ATLAS Offline Software
|
Handle allowing writes to the event store with a configurable type. More...
#include <TypelessWriteHandle.h>
Public Member Functions | |
TypelessWriteHandle (const TypelessWriteHandleKey &key, const EventContext &ctx) | |
Constructor from a TypelessWriteHandleKey and an explicit event context. More... | |
virtual bool | isValid () override final |
Can the handle be successfully dereferenced? More... | |
StatusCode | typelessPut (std::unique_ptr< DataObject > data) const |
Record an object in the store. 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 | |
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... | |
virtual 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 | |
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... | |
Handle allowing writes to the event store with a configurable type.
This is like WriteHandle
, except that the type to be written is configurable as a job property. Accordingly, most of the functionality of WriteHandle
is not supported. One records to the store with a put-like operation that is passed a DataObject
.
Definition at line 33 of file TypelessWriteHandle.h.
|
explicit |
Constructor from a TypelessWriteHandleKey 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.
Definition at line 29 of file TypelessWriteHandle.cxx.
|
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 635 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return the class ID for the referenced object.
|
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 583 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return the key as a DataObjID
.
|
protectedinherited |
Definition at line 886 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 465 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 437 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 409 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 397 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 1108 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 425 of file StoreGate/src/VarHandleBase.cxx.
|
finaloverridevirtual |
Can the handle be successfully dereferenced?
This will always return false.
Implements SG::VarHandleBase.
Definition at line 41 of file TypelessWriteHandle.cxx.
|
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.
A synonym for key().
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.
|
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 784 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 715 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 553 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
Clear the m_proxy field and release the old proxy.
Definition at line 1011 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Set the 'const' bit for the bound proxy in the store.
Definition at line 599 of file StoreGate/src/VarHandleBase.cxx.
|
privateinherited |
Set a new proxy.
Release any old one first.
proxy | The new proxy. |
Definition at line 1027 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 534 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 500 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 685 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 653 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 994 of file StoreGate/src/VarHandleBase.cxx.
|
inherited |
Return the name of the store holding the object we are proxying.
Definition at line 379 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 964 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 933 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 1048 of file StoreGate/src/VarHandleBase.cxx.
|
protectedvirtualinherited |
Retrieve an object from StoreGate.
quiet | If true, suppress failure messages. |
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 826 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 869 of file StoreGate/src/VarHandleBase.cxx.
StatusCode SG::TypelessWriteHandle::typelessPut | ( | std::unique_ptr< DataObject > | data | ) | const |
Record an object in the store.
data | The object to record. |
data
will usually be a DataBucket
object. Will fail if there is already an object present with this key.
Definition at line 55 of file TypelessWriteHandle.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 616 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.