![]() |
ATLAS Offline Software
|
Simple (non-deleting) Updater implementation. More...
#include <SimpleUpdater.h>
Classes | |
struct | Context_t |
Context object. More... | |
Public Member Functions | |
SimpleUpdater ()=default | |
We need a default constructor. More... | |
SimpleUpdater (SimpleUpdater &&other) | |
Move constructor. More... | |
const T & | get () const |
Return a reference to the current object. More... | |
void | update (std::unique_ptr< T > p, const Context_t &) |
Install a new object. More... | |
void | discard (std::unique_ptr< T > p) |
Queue an object for later deletion. More... | |
void | quiescent (const Context_t &) |
Mark that an event slot is not referencing this object. More... | |
void | clean () |
Delete all objects we're managing except for the current one. More... | |
void | swap (SimpleUpdater &other) |
Swap this object with another. More... | |
Static Public Member Functions | |
static const Context_t | defaultContext () |
Return the current event context. More... | |
Private Attributes | |
std::atomic< const T * > | m_obj = 0 |
Pointer to the current object. More... | |
std::vector< std::unique_ptr< T > > | m_objs |
List of all allocated objects. More... | |
Simple (non-deleting) Updater implementation.
This is a simple implementation of the Updater interface as described in ConcurrentRangeMap
that does not delete any memory until the SimpleUpdater
itself is deleted. This can be useful for, say, a ConcurrentStrMap
if you have a good initial guess for the size of the table.
Definition at line 36 of file SimpleUpdater.h.
|
default |
We need a default constructor.
CxxUtils::SimpleUpdater< T >::SimpleUpdater | ( | SimpleUpdater< T > && | other | ) |
Move constructor.
void CxxUtils::SimpleUpdater< T >::clean | ( | ) |
Delete all objects we're managing except for the current one.
This is NOT concurrency-safe. No other threads may be accessing the objects managed here.
|
static |
Return the current event context.
void CxxUtils::SimpleUpdater< T >::discard | ( | std::unique_ptr< T > | p | ) |
Queue an object for later deletion.
p | The object to delete. |
The object p
will be queued for deletion once a grace period has passed for all slots. In contrast to using update
, this does not change the current object.
const T& CxxUtils::SimpleUpdater< T >::get | ( | ) | const |
Return a reference to the current object.
void CxxUtils::SimpleUpdater< T >::quiescent | ( | const Context_t & | ) |
Mark that an event slot is not referencing this object.
A no-op for SimpleUpdater
.
void CxxUtils::SimpleUpdater< T >::swap | ( | SimpleUpdater< T > & | other | ) |
Swap this object with another.
other | The other object with which to swap. |
This operation is NOT concurrency-safe. No other threads may be accessing either container during this operation.
void CxxUtils::SimpleUpdater< T >::update | ( | std::unique_ptr< T > | p, |
const Context_t & | |||
) |
Install a new object.
p | The new object to install. |
ctx | Current execution context. |
The existing object should not be deleted until it can no longer be referenced by any thread.
|
private |
Pointer to the current object.
Definition at line 116 of file SimpleUpdater.h.
|
private |
List of all allocated objects.
Definition at line 119 of file SimpleUpdater.h.