ATLAS Offline Software
|
#include <WriteHandle.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 | |
WriteHandle () | |
Default constructor. More... | |
WriteHandle (const std::string &sgkey, const std::string &storename=StoreID::storeName(StoreID::EVENT_STORE)) | |
Constructor with full arguments. More... | |
WriteHandle (const WriteHandleKey< T > &key) | |
Constructor from a WriteHandleKey. More... | |
WriteHandle (const WriteHandleKey< T > &key, const EventContext &ctx) | |
Constructor from a WriteHandleKey and an explicit event context. More... | |
WriteHandle (const WriteHandle &rhs) | |
Copy constructor. More... | |
WriteHandle (WriteHandle &&rhs) | |
Move constructor. More... | |
WriteHandle & | operator= (const WriteHandle &rhs) |
Assignment operator. More... | |
WriteHandle & | operator= (WriteHandle &&rhs) |
Move operator. More... | |
~WriteHandle () | |
Destructor. More... | |
pointer_type | operator-> () |
Dereference the pointer. More... | |
reference_type | operator* () |
Dereference the pointer. More... | |
const_pointer_type | cptr () const |
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... | |
StatusCode | record (std::unique_ptr< T > data) |
Record a const object to the store. More... | |
StatusCode | recordNonConst (std::unique_ptr< T > data) |
Record a non-const object to the store. More... | |
template<class AUXSTORE > | |
StatusCode | record (std::unique_ptr< T > data, std::unique_ptr< AUXSTORE > store) |
Record a const object and its auxiliary store to the store. More... | |
template<class AUXSTORE > | |
StatusCode | recordNonConst (std::unique_ptr< T > data, std::unique_ptr< AUXSTORE > store) |
Record a non-const object and its auxiliary store to the store. More... | |
StatusCode | record (SG::DataObjectSharedPtr< T > data) |
Record a const shared DataObject to the store. More... | |
StatusCode | recordNonConst (SG::DataObjectSharedPtr< T > data) |
Record a non-const shared DataObject to the store. More... | |
const_pointer_type | put (std::unique_ptr< T > data, bool returnExisting=false) const |
Record an object to the store. More... | |
const_pointer_type | put (std::unique_ptr< const T > data, bool returnExisting=false) const |
Record an object to the store. More... | |
const_pointer_type | put (std::unique_ptr< const ConstDataVector< T > > data, bool returnExisting=false) const |
Record an object to the store. More... | |
const_pointer_type | put (const EventContext &ctx, std::unique_ptr< const ConstDataVector< T > > data, bool returnExisting=false) const |
Record an object to the store. More... | |
const_pointer_type | put (const EventContext &ctx, std::unique_ptr< T > data, bool returnExisting=false) const |
Record an object to the store. More... | |
const_pointer_type | put (const EventContext &ctx, std::unique_ptr< const T > data, bool returnExisting=false) const |
Record an object to the store. More... | |
const_pointer_type | put (SG::DataObjectSharedPtr< T > data) const |
Record an object to the store. More... | |
const_pointer_type | put (const EventContext &ctx, SG::DataObjectSharedPtr< T > data) const |
Record an object to the store. More... | |
template<class AUXSTORE > | |
const_pointer_type | put (std::unique_ptr< T > data, std::unique_ptr< AUXSTORE > auxstore) const |
Record an object and its auxiliary store to the store. More... | |
template<class AUXSTORE > | |
const_pointer_type | put (std::unique_ptr< const T > data, std::unique_ptr< const AUXSTORE > auxstore) const |
Record an object and its auxiliary store to the store. More... | |
template<class AUXSTORE > | |
const_pointer_type | put (const EventContext &ctx, std::unique_ptr< T > data, std::unique_ptr< AUXSTORE > auxstore) const |
Record an object and its auxiliary store to the store. More... | |
template<class AUXSTORE > | |
const_pointer_type | put (const EventContext &ctx, std::unique_ptr< const T > data, std::unique_ptr< const AUXSTORE > auxstore) const |
Record an object and its auxiliary store to the store. More... | |
WriteHandle & | operator= (std::unique_ptr< T > data) |
Alternate notation for record. More... | |
StatusCode | alias (const WriteHandleKey< T > &key) |
Make an alias. More... | |
template<class U > | |
StatusCode | symLink (const WriteHandleKey< U > &key) |
Make an explicit link. 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... | |
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 | checkedCachedPtr () |
Return the cached pointer directly. More... | |
template<class U > | |
StatusCode | doRecord (U data, bool isConst, bool returnExisting) |
Helper for record. More... | |
template<class U > | |
const_pointer_type | doPut (const EventContext *ctx, U data, bool returnExisting, IProxyDict *&store) const |
Helper for put. More... | |
template<class AUXSTORE > | |
WriteHandle< T >::const_pointer_type | doPut (const EventContext *ctx, std::unique_ptr< T > data, std::unique_ptr< AUXSTORE > auxstore) const |
Helper for recording an object and its auxiliary store to the store. More... | |
template<class AUXSTORE > | |
WriteHandle< T >::const_pointer_type | doPut (const EventContext *ctx, std::unique_ptr< const T > data, std::unique_ptr< const AUXSTORE > auxstore) const |
Helper for recording an object and its auxiliary store to the store. More... | |
template<class AUXSTORE > | |
StatusCode | record (std::unique_ptr< T > data, std::unique_ptr< AUXSTORE > auxstore, bool isConst) |
Record an object and its auxiliary store to the store. 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 | |
SG::DataProxy * | m_lockAuxPending = nullptr |
If non-null, then we need to lock the associated aux store object when we're deleted. More... | |
std::unique_ptr< VarHandleKey > | m_ownedKey |
An owned VarHandleKey . More... | |
const VarHandleKey * | m_key |
The associated key object. More... | |
Definition at line 74 of file StoreGate/StoreGate/WriteHandle.h.
typedef const T* SG::WriteHandle< T >::const_pointer_type |
Definition at line 79 of file StoreGate/StoreGate/WriteHandle.h.
typedef const T& SG::WriteHandle< T >::const_reference_type |
Definition at line 81 of file StoreGate/StoreGate/WriteHandle.h.
typedef T* SG::WriteHandle< T >::pointer_type |
Definition at line 78 of file StoreGate/StoreGate/WriteHandle.h.
typedef T& SG::WriteHandle< T >::reference_type |
Definition at line 80 of file StoreGate/StoreGate/WriteHandle.h.
SG::WriteHandle< T >::WriteHandle | ( | ) |
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 WriteHandleKey.
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 WriteHandleKey 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::WriteHandle< T >::WriteHandle | ( | const WriteHandle< T > & | rhs | ) |
Copy constructor.
SG::WriteHandle< T >::WriteHandle | ( | WriteHandle< T > && | rhs | ) |
Move constructor.
SG::WriteHandle< T >::~WriteHandle | ( | ) |
Destructor.
Lock an aux object if m_lockAuxPending is set.
StatusCode SG::WriteHandle< 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 (i.e., record
should have been called on it).
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.
pointer_type SG::WriteHandle< T >::cachedPtr | ( | ) |
Return the cached pointer directly; no lookup.
|
private |
Return the cached pointer directly.
If it is null, throw ExcNullWriteHandle.
|
inherited |
Return the class ID for the referenced object.
const_pointer_type SG::WriteHandle< T >::cptr | ( | ) | const |
Dereference the pointer.
Returns the cached pointer.
|
private |
Helper for recording an object and its auxiliary store to the store.
ctx | The event context, or nullptr to use the current context. |
data | The object to record. |
auxstore | Auxiliary store object. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, and the objects passed in are destroyed.
|
private |
Helper for recording an object and its auxiliary store to the store.
ctx | The event context, or nullptr to use the current context. |
data | The object to record. |
auxstore | Auxiliary store object. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, and the objects passed in are destroyed.
|
private |
Helper for put.
ctx | The event context, or nullptr to use the current context. | |
data | The object to record. | |
returnExisting | Allow an existing object. | |
[out] | store | The store being used. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
|
private |
Helper for record.
data | The object to record. |
isConst | If true, record the object as const. |
returnExisting | Allow an existing 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 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::WriteHandle< T >::operator* | ( | ) |
Dereference the pointer.
Returns the cached pointer. Throws ExcNullWriteHandle if null.
pointer_type SG::WriteHandle< T >::operator-> | ( | ) |
Dereference the pointer.
Returns the cached pointer. Throws ExcNullWriteHandle if null.
WriteHandle& SG::WriteHandle< T >::operator= | ( | const WriteHandle< T > & | rhs | ) |
Assignment operator.
WriteHandle& SG::WriteHandle< T >::operator= | ( | std::unique_ptr< T > | data | ) |
Alternate notation for record.
Records a non-const object.
data | Object to record. |
Throws an exception on failure.
WriteHandle& SG::WriteHandle< T >::operator= | ( | WriteHandle< T > && | rhs | ) |
Move operator.
pointer_type SG::WriteHandle< T >::ptr | ( | ) |
Dereference the pointer.
Returns the cached pointer.
const_pointer_type SG::WriteHandle< T >::put | ( | const EventContext & | ctx, |
SG::DataObjectSharedPtr< T > | data | ||
) | const |
Record an object to the store.
ctx | The event context to use. |
data | The object to record. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. Returns the object placed in the store, or nullptr if there was an error.
The event store takes shared ownership of the object.
const_pointer_type SG::WriteHandle< T >::put | ( | const EventContext & | ctx, |
std::unique_ptr< const ConstDataVector< T > > | data, | ||
bool | returnExisting = false |
||
) | const |
Record an object to the store.
ctx | The event context to use. |
data | The object to record. |
returnExisting | Allow an existing object? |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | const EventContext & | ctx, |
std::unique_ptr< const T > | data, | ||
bool | returnExisting = false |
||
) | const |
Record an object to the store.
ctx | The event context to use. |
data | The object to record. |
returnExisting | Allow an existing object? |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | const EventContext & | ctx, |
std::unique_ptr< const T > | data, | ||
std::unique_ptr< const AUXSTORE > | auxstore | ||
) | const |
Record an object and its auxiliary store to the store.
ctx | The event context to use. |
data | The object to record. |
auxstore | Auxiliary store object. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, and the objects passed in are destroyed.
Unlike the version taking unique_ptr<T>, this does not alter the store pointer of data
.
const_pointer_type SG::WriteHandle< T >::put | ( | const EventContext & | ctx, |
std::unique_ptr< T > | data, | ||
bool | returnExisting = false |
||
) | const |
Record an object to the store.
ctx | The event context to use. |
data | The object to record. |
returnExisting | Allow an existing object? |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | const EventContext & | ctx, |
std::unique_ptr< T > | data, | ||
std::unique_ptr< AUXSTORE > | auxstore | ||
) | const |
Record an object and its auxiliary store to the store.
ctx | The event context to use. |
data | The object to record. |
auxstore | Auxiliary store object. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, and the objects passed in are destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | SG::DataObjectSharedPtr< T > | data | ) | const |
Record an object to the store.
data | The object to record. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. Returns the object placed in the store, or nullptr if there was an error.
The event store takes shared ownership of the object.
const_pointer_type SG::WriteHandle< T >::put | ( | std::unique_ptr< const ConstDataVector< T > > | data, |
bool | returnExisting = false |
||
) | const |
Record an object to the store.
data | The object to record. |
returnExisting | Allow an existing object? |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | std::unique_ptr< const T > | data, |
bool | returnExisting = false |
||
) | const |
Record an object to the store.
data | The object to record. |
returnExisting | Allow an existing object? |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | std::unique_ptr< const T > | data, |
std::unique_ptr< const AUXSTORE > | auxstore | ||
) | const |
Record an object and its auxiliary store to the store.
data | The object to record. |
auxstore | Auxiliary store object. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, and the objects passed in are destroyed.
Unlike the version taking unique_ptr<T>, this does not alter the store pointer of data
.
const_pointer_type SG::WriteHandle< T >::put | ( | std::unique_ptr< T > | data, |
bool | returnExisting = false |
||
) | const |
Record an object to the store.
data | The object to record. |
returnExisting | Allow an existing object? |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, data
is destroyed.
const_pointer_type SG::WriteHandle< T >::put | ( | std::unique_ptr< T > | data, |
std::unique_ptr< AUXSTORE > | auxstore | ||
) | const |
Record an object and its auxiliary store to the store.
data | The object to record. |
auxstore | Auxiliary store object. |
Unlike record(), this does not change the handle object. That means that one will not be able to get the object back by dereferencing the handle. 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, and the objects passed in are destroyed.
|
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.
StatusCode SG::WriteHandle< T >::record | ( | SG::DataObjectSharedPtr< T > | data | ) |
Record a const shared DataObject to the store.
data | The object to record. |
The event store takes shared ownership of the object.
StatusCode SG::WriteHandle< T >::record | ( | std::unique_ptr< T > | data | ) |
Record a const object to the store.
data | The object to record. |
|
private |
Record an object and its auxiliary store to the store.
data | The object to record. |
auxstore | Auxiliary store object. |
isConst | If true, record the objects as const. |
StatusCode SG::WriteHandle< T >::record | ( | std::unique_ptr< T > | data, |
std::unique_ptr< AUXSTORE > | store | ||
) |
Record a const object and its auxiliary store to the store.
data | The object to record. |
auxstore | Auxiliary store object. |
|
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.
StatusCode SG::WriteHandle< T >::recordNonConst | ( | SG::DataObjectSharedPtr< T > | data | ) |
Record a non-const shared DataObject to the store.
data | The object to record. |
The event store takes shared ownership of the object.
StatusCode SG::WriteHandle< T >::recordNonConst | ( | std::unique_ptr< T > | data | ) |
Record a non-const object to the store.
data | The object to record. |
StatusCode SG::WriteHandle< T >::recordNonConst | ( | std::unique_ptr< T > | data, |
std::unique_ptr< AUXSTORE > | store | ||
) |
Record a non-const object and its auxiliary store to the store.
data | The object to record. |
auxstore | Auxiliary store object. |
|
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.
StatusCode SG::WriteHandle< T >::symLink | ( | const WriteHandleKey< U > & | key | ) |
Make an explicit link.
key | Alternate clid by which the referenced object should be known. The SG key must match the key of the current handle. |
You should generally not be using this!
The current handle should be valid and referencing an object (i.e., record
should have been called on it).
This makes a symlink: the object will be retrievable as a different type.
Note that if T
and @U
are related via SG_BASE
and/or DATAVECTOR_BASE
, then you shouldn't need to explicitly make a symlink; that should happen automatically.
If a U*
is not convertable to a T*
via C++ rules, then you likely will be, at best, relying on undefined behavior. You will probably get warnings from the undefined behavior sanitizer when if you try to dereference the U*
.
This usage is here mainly to assist in migrating some existing patterns to MT. You should think several times before using in new code.
|
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.
|
private |
If non-null, then we need to lock the associated aux store object when we're deleted.
This is set when we record an object along with the associated aux const with the const flag set (the default). Recall that for a const record, we want to support the semantics that you can get a non-const pointer back from the handle as long as it exists, to finish initialization of the object. For an aux store, though, just getting back a non-const pointer is not sufficient, since the store will have been locked at the time of the record, preventing changes to the store.
So if we're meant to record a const aux store object, we don't actually set it const on the record, but instead set this and do the setConst in the destructor.
Definition at line 662 of file StoreGate/StoreGate/WriteHandle.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.