![]() |
The Gaudi Framework
v36r9 (fd2bdac3)
|
Simple implementation of a smart pointer with different values for different event contexts (slots). More...
#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/ContextSpecificPtr.h>

Public Member Functions | |
| T * | get () const |
| Return the pointer for the current context (null for a new context). More... | |
| T *& | set (T *ptr) |
| Set the pointer for the current context. More... | |
| T *& | operator= (T *ptr) |
| Assignment operator (. More... | |
| bool | isValid () const |
| Return true if the pointer is not null. More... | |
| operator bool () const | |
| Conversion to boolean (. More... | |
| bool | operator== (T *rhs) const |
| Comparison with another pointer. More... | |
| T & | operator* () |
| Dereference operators. More... | |
| const T & | operator* () const |
| T * | operator-> () |
| const T * | operator-> () const |
Private Types | |
| typedef std::unordered_map< ContextIdType, T * > | StorageType |
| Type used for the internal storage. More... | |
| StorageType | m_ptrs |
| Internal storage for the different internal pointers. More... | |
| std::mutex | m_ptrs_lock |
| Mutex for the m_ptrs container. More... | |
| void | clear () |
| Non thread-safe methods. More... | |
| template<class Mapper > | |
| auto | accumulate (Mapper f, std::result_of_t< Mapper(const T *)> init) const -> decltype(init) |
| Taking a function f that from a T* produces a value, return the sum of all the values corresponding to the contained pointers using init as first value. More... | |
| template<class Mapper , class BinaryOperation > | |
| auto | accumulate (Mapper f, std::result_of_t< Mapper(const T *)> init, BinaryOperation op) const -> decltype(init) |
| Taking a function f that from a T* produces a value, return the accumulated result, through the operation 'op', of all the values corresponding to the contained pointers using init as first value. More... | |
| template<class F > | |
| void | for_each (F f) const |
| Call a function on each contained pointer. More... | |
| template<class F > | |
| void | for_each (F f) |
| Call a function on each contained pointer. (non-const version) More... | |
| template<class F > | |
| void | for_all (F f) const |
| Call a function on each element, passing slot# as well. More... | |
| template<class F > | |
| void | for_all (F f) |
| void | deleteAll () |
Simple implementation of a smart pointer with different values for different event contexts (slots).
When the copy for a new context is requested, the returned pointer is null.
The interface is meant to allow for a drop-in replacement for regular pointers. It's still responsibility of the user to delete the memory associated to the pointers.
Definition at line 40 of file ContextSpecificPtr.h.
|
private |
Type used for the internal storage.
Definition at line 43 of file ContextSpecificPtr.h.
|
inline |
Taking a function f that from a T* produces a value, return the sum of all the values corresponding to the contained pointers using init as first value.
Definition at line 88 of file ContextSpecificPtr.h.
|
inline |
Taking a function f that from a T* produces a value, return the accumulated result, through the operation 'op', of all the values corresponding to the contained pointers using init as first value.
Definition at line 100 of file ContextSpecificPtr.h.
|
inline |
Non thread-safe methods.
Set to null all the used pointers.
Definition at line 79 of file ContextSpecificPtr.h.
|
inline |
Definition at line 135 of file ContextSpecificPtr.h.
|
inline |
Definition at line 130 of file ContextSpecificPtr.h.
|
inline |
Call a function on each element, passing slot# as well.
Definition at line 125 of file ContextSpecificPtr.h.
|
inline |
Call a function on each contained pointer. (non-const version)
Definition at line 118 of file ContextSpecificPtr.h.
|
inline |
|
inline |
Return the pointer for the current context (null for a new context).
Definition at line 47 of file ContextSpecificPtr.h.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 71 of file ContextSpecificPtr.h.
|
inline |
Definition at line 72 of file ContextSpecificPtr.h.
|
inline |
Definition at line 73 of file ContextSpecificPtr.h.
|
inline |
|
inline |
|
inline |
|
mutableprivate |
Internal storage for the different internal pointers.
Definition at line 144 of file ContextSpecificPtr.h.
|
mutableprivate |
Mutex for the m_ptrs container.
Definition at line 146 of file ContextSpecificPtr.h.