ATLAS Offline Software
|
Generic class to outsource the cache of transformations, Vectors, etc, from the core class instance. More...
#include <TransformMap.h>
Public Member Functions | |
TransformMap ()=default | |
: Default constructor More... | |
TransformMap (const TransformMap &other)=default | |
TransformMap & | operator= (const TransformMap &other)=default |
: Copy assignment operator More... | |
~TransformMap ()=default | |
bool | setTransform (const T *obj, const X &xf) const |
: Adds a transform object to the map. More... | |
bool | setTransform (const T *obj, const X &xf) |
bool | setTransform (const T *obj, std::shared_ptr< const X > xf) const |
: Adds a transform object to the map. More... | |
bool | setTransform (const T *obj, std::shared_ptr< const X > xf) |
const X * | getTransform (const T *obj) const |
: Returns the transform that's associated with input object. More... | |
bool | append (const TransformMap &other) |
: Copies all key value pairs from the external map and appends it to this map instance. More... | |
void | clear () |
: Clear the transform cache map More... | |
void | lock () |
: Lock the map which switches off the mutex protection mechanism. More... | |
std::vector< const T * > | getStoredKeys () const |
: Returns a vector of all objects that have been parsed to the map More... | |
Private Types | |
using | ConCurrentMap_t = CxxUtils::ConcurrentToValMap< const T *, std::shared_ptr< const X >, CxxUtils::SimpleUpdater > |
using | ConCurrentMap_ptr = std::unique_ptr< ConCurrentMap_t > |
using | CanonicalMap_t = std::unordered_map< const T *, std::shared_ptr< const X > > |
using | CanonicalMap_ptr = std::unique_ptr< CanonicalMap_t > |
Private Attributes | |
CanonicalMap_t m_container | ATLAS_THREAD_SAFE {} |
bool m_locked | ATLAS_THREAD_SAFE {false} |
std::shared_mutex m_mutex | ATLAS_THREAD_SAFE {} |
ConCurrentMap_ptr m_mutableCont | ATLAS_THREAD_SAFE |
Generic class to outsource the cache of transformations, Vectors, etc, from the core class instance.
The pointer to the class instance serves as access key to the map. The cache can be filled on-the fly and hence does not require an initialization step.
Definition at line 21 of file TransformMap.h.
|
private |
Definition at line 71 of file TransformMap.h.
|
private |
Definition at line 70 of file TransformMap.h.
|
private |
Definition at line 69 of file TransformMap.h.
|
private |
Definition at line 68 of file TransformMap.h.
|
default |
: Default constructor
|
default |
|
default |
bool TransformMap< T, X >::append | ( | const TransformMap< T, X > & | other | ) |
: Copies all key value pairs from the external map and appends it to this map instance.
Returns false if the second map partially overlaps with this map.
other | Other map in memory to copy from |
void TransformMap< T, X >::clear | ( | ) |
: Clear the transform cache map
std::vector<const T*> TransformMap< T, X >::getStoredKeys | ( | ) | const |
: Returns a vector of all objects that have been parsed to the map
const X* TransformMap< T, X >::getTransform | ( | const T * | obj | ) | const |
: Returns the transform that's associated with input object.
If the object has not been added via the setTransform method, a nullptr is returned
obj | Pointer to the class instance which associated transform shall be fetched |
void TransformMap< T, X >::lock | ( | ) |
: Lock the map which switches off the mutex protection mechanism.
Any attempt to const modify the container afterwards leads to exceptions.
|
default |
: Copy assignment operator
bool TransformMap< T, X >::setTransform | ( | const T * | obj, |
const X & | xf | ||
) |
bool TransformMap< T, X >::setTransform | ( | const T * | obj, |
const X & | xf | ||
) | const |
: Adds a transform object to the map.
Returns false if a transform has been already associated before with the object. The object is turned into a shared pointer to allow sharing of the same memory in cases where multiple TransformMaps are around in memory and the transform remains constant across the maps.
obj | Pointer to the class instance to which the transform shall be associated. |
xf | Transform object to cache |
bool TransformMap< T, X >::setTransform | ( | const T * | obj, |
std::shared_ptr< const X > | xf | ||
) |
bool TransformMap< T, X >::setTransform | ( | const T * | obj, |
std::shared_ptr< const X > | xf | ||
) | const |
: Adds a transform object to the map.
Returns false if a transform has been already associated before with the object
obj | Pointer to the class instance to which the transform shall be associated. |
xf | Shared pointer of the transform object to cache |
|
mutableprivate |
Definition at line 74 of file TransformMap.h.
|
mutableprivate |
Definition at line 75 of file TransformMap.h.
|
mutableprivate |
Definition at line 76 of file TransformMap.h.
|
mutableprivate |
Definition at line 77 of file TransformMap.h.