All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | List of all members
lar::util::details::UniqueAssociationCache< Source, Dest > Class Template Reference

A class holding many associations between objects. More...

#include <FindAllP.h>

Public Types

using Source_t = Source
 
using Dest_t = Dest
 
using SourcePtr_t = art::Ptr< Source_t >
 
using DestPtr_t = art::Ptr< Dest_t >
 
using InProductCache_t = std::vector< DestPtr_t >
 type for a cache of dest products for a given source product ID More...
 
using Hash_t = details::hash< art::ProductID >
 type of hash functor for the cache More...
 
using Cache_t = std::unordered_map< art::ProductID, InProductCache_t, Hash_t >
 type for the complete cache, keyed by source product ID More...
 

Public Member Functions

 UniqueAssociationCache ()=default
 Constructor: an empty cache. More...
 
DestPtr_t operator[] (SourcePtr_t const &src) const
 Returns the specified element of the cache. More...
 
void clear ()
 Empties the cache. More...
 
size_t NProductIDs () const
 

Public Attributes

Cache_t AssnCache
 association cache, keyed by product ID and index More...
 

Detailed Description

template<typename Source, typename Dest>
class lar::util::details::UniqueAssociationCache< Source, Dest >

A class holding many associations between objects.


Template Parameters
Sourcetype of the object we use as query key (indexing object)
Desttype of the object we query for

This class is conceptually related to the query object FindOneP. This object is a cache of possible query results of the type: which Dest object is associated to this specific Src object? The cache is structured so that only one Dest object is known for each Src.

Definition at line 65 of file FindAllP.h.

Member Typedef Documentation

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::Cache_t = std::unordered_map<art::ProductID, InProductCache_t, Hash_t>

type for the complete cache, keyed by source product ID

Definition at line 81 of file FindAllP.h.

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::Dest_t = Dest

Definition at line 68 of file FindAllP.h.

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::DestPtr_t = art::Ptr<Dest_t>

Definition at line 71 of file FindAllP.h.

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::Hash_t = details::hash<art::ProductID>

type of hash functor for the cache

Definition at line 77 of file FindAllP.h.

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::InProductCache_t = std::vector<DestPtr_t>

type for a cache of dest products for a given source product ID

Definition at line 74 of file FindAllP.h.

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::Source_t = Source

Definition at line 67 of file FindAllP.h.

template<typename Source, typename Dest>
using lar::util::details::UniqueAssociationCache< Source, Dest >::SourcePtr_t = art::Ptr<Source_t>

Definition at line 70 of file FindAllP.h.

Constructor & Destructor Documentation

template<typename Source, typename Dest>
lar::util::details::UniqueAssociationCache< Source, Dest >::UniqueAssociationCache ( )
default

Constructor: an empty cache.

Member Function Documentation

template<typename Source, typename Dest>
void lar::util::details::UniqueAssociationCache< Source, Dest >::clear ( )
inline

Empties the cache.

Definition at line 98 of file FindAllP.h.

98 { AssnCache.clear(); }
Cache_t AssnCache
association cache, keyed by product ID and index
Definition: FindAllP.h:83
template<typename Source, typename Dest>
size_t lar::util::details::UniqueAssociationCache< Source, Dest >::NProductIDs ( ) const
inline

Definition at line 100 of file FindAllP.h.

100 { return AssnCache.size(); }
Cache_t AssnCache
association cache, keyed by product ID and index
Definition: FindAllP.h:83
template<typename Source, typename Dest>
DestPtr_t lar::util::details::UniqueAssociationCache< Source, Dest >::operator[] ( SourcePtr_t const &  src) const
inline

Returns the specified element of the cache.

Parameters
srcart pointer to the object we want the association of
Returns
the requested element, or a null pointer if not found

Definition at line 94 of file FindAllP.h.

95  { return AssnCache[src.id()][src.key()]; }
Cache_t AssnCache
association cache, keyed by product ID and index
Definition: FindAllP.h:83

Member Data Documentation

template<typename Source, typename Dest>
Cache_t lar::util::details::UniqueAssociationCache< Source, Dest >::AssnCache

association cache, keyed by product ID and index

Definition at line 83 of file FindAllP.h.


The documentation for this class was generated from the following file: