Belle II Software light-2406-ragdoll
|
Manager to keep a cache of existing RelationIndexContainers. More...
#include <RelationIndexManager.h>
Public Member Functions | |
template<class FROM , class TO > | |
std::shared_ptr< RelationIndexContainer< FROM, TO > > | get (const RelationArray &relation) |
Get a RelationIndexContainer. | |
void | clear (DataStore::EDurability durability=DataStore::c_Event) |
Clear the cache of RelationIndexContainers with the given durability. | |
void | reset () |
Reset the cache completely, that is clear all caches and don't even keep the Index objects around. | |
Static Public Member Functions | |
static RelationIndexManager & | Instance () |
Returns the singleton instance. | |
Protected Types | |
typedef std::map< std::string, std::shared_ptr< RelationIndexBase > > | RelationMap |
Maptype to keep track of all Containers of one durability. | |
typedef std::array< RelationMap, DataStore::c_NDurabilityTypes > | RelationCache |
Cachetype for all Containers. | |
Protected Member Functions | |
RelationIndexManager ()=default | |
No Constructor hidden. | |
RelationIndexManager (const RelationIndexManager &)=delete | |
No copy-constructor. | |
RelationIndexManager (RelationIndexManager &&)=delete | |
No move constructor. | |
RelationIndexManager & | operator= (const RelationIndexManager &)=delete |
Also no assignment. | |
template<class FROM , class TO > | |
std::shared_ptr< RelationIndexContainer< FROM, TO > > | getIndexIfExists (const std::string &name, DataStore::EDurability durability) const |
if the index exists in the cache, it is returned; otherwise NULL. | |
~RelationIndexManager () | |
Clean cache on exit. | |
Protected Attributes | |
RelationCache | m_cache |
Cache for all Containers. | |
Friends | |
class | DataStore |
only DataStore should be able to get non-const indices. | |
Manager to keep a cache of existing RelationIndexContainers.
This singleton keeps track of all RelationIndexContainers that where created to make sure indices are not created more often than needed.
This class is only used internally, users should use RelationsObject/RelationsInterface to access/add relations.
Definition at line 30 of file RelationIndexManager.h.
|
protected |
Cachetype for all Containers.
Definition at line 122 of file RelationIndexManager.h.
|
protected |
Maptype to keep track of all Containers of one durability.
Definition at line 120 of file RelationIndexManager.h.
|
inlineprotected |
Clean cache on exit.
Definition at line 114 of file RelationIndexManager.h.
void clear | ( | DataStore::EDurability | durability = DataStore::c_Event | ) |
Clear the cache of RelationIndexContainers with the given durability.
durability | Which cache to clear |
Definition at line 18 of file RelationIndexManager.cc.
|
inline |
Get a RelationIndexContainer.
Return a const reference to a RelationIndexContainer for the given name and durability. If none exists it will be created. If it already exists we rebuild the index if the underlying RelationArray has changed in the meantime
relation | Relation to build an index for |
Definition at line 45 of file RelationIndexManager.h.
|
inlineprotected |
if the index exists in the cache, it is returned; otherwise NULL.
The index is not rebuilt, which makes this mostly useful to do minor changes to the index in DataStore::addRelation().
Definition at line 101 of file RelationIndexManager.h.
|
static |
Returns the singleton instance.
Definition at line 13 of file RelationIndexManager.cc.
|
inline |
Reset the cache completely, that is clear all caches and don't even keep the Index objects around.
Needed when the DataStore is reset to make sure we don't have dangling pointer into the previous DataStore contents.
Definition at line 81 of file RelationIndexManager.h.
|
friend |
only DataStore should be able to get non-const indices.
Definition at line 127 of file RelationIndexManager.h.
|
protected |
Cache for all Containers.
Definition at line 124 of file RelationIndexManager.h.