MADNESS 0.10.1
Public Member Functions | Private Types | Private Attributes | List of all members
madness::SimpleCache< Q, NDIM > Class Template Reference

Simplified interface around hash_map to cache stuff for 1D. More...

#include <simplecache.h>

Collaboration diagram for madness::SimpleCache< Q, NDIM >:
Collaboration graph
[legend]

Public Member Functions

 SimpleCache ()
 
 SimpleCache (const SimpleCache &c)
 
const Qgetptr (const Key< NDIM > &key) const
 If key is present return pointer to cached value, otherwise return NULL.
 
const Qgetptr (Level n, const Key< NDIM > &disp) const
 If key=(n,l) is present return pointer to cached value, otherwise return NULL.
 
const Qgetptr (Level n, Translation l) const
 If key=(n,l) is present return pointer to cached value, otherwise return NULL.
 
SimpleCacheoperator= (const SimpleCache &c)
 
void set (const Key< NDIM > &key, const Q &val)
 Set value associated with key ... gives ownership of a new copy to the container.
 
void set (Level n, const Key< NDIM > &disp, const Q &val)
 
void set (Level n, Translation l, const Q &val)
 

Private Types

typedef ConcurrentHashMap< Key< NDIM >, QmapT
 
typedef std::pair< Key< NDIM >, QpairT
 

Private Attributes

mapT cache
 

Detailed Description

template<typename Q, std::size_t NDIM>
class madness::SimpleCache< Q, NDIM >

Simplified interface around hash_map to cache stuff for 1D.

This is a write once cache — subsequent writes of elements have no effect (so that pointers/references to cached data cannot be invalidated)

Member Typedef Documentation

◆ mapT

template<typename Q , std::size_t NDIM>
typedef ConcurrentHashMap< Key<NDIM>, Q > madness::SimpleCache< Q, NDIM >::mapT
private

◆ pairT

template<typename Q , std::size_t NDIM>
typedef std::pair<Key<NDIM>, Q> madness::SimpleCache< Q, NDIM >::pairT
private

Constructor & Destructor Documentation

◆ SimpleCache() [1/2]

template<typename Q , std::size_t NDIM>
madness::SimpleCache< Q, NDIM >::SimpleCache ( )
inline

◆ SimpleCache() [2/2]

template<typename Q , std::size_t NDIM>
madness::SimpleCache< Q, NDIM >::SimpleCache ( const SimpleCache< Q, NDIM > &  c)
inline

Member Function Documentation

◆ getptr() [1/3]

template<typename Q , std::size_t NDIM>
const Q * madness::SimpleCache< Q, NDIM >::getptr ( const Key< NDIM > &  key) const
inline

◆ getptr() [2/3]

template<typename Q , std::size_t NDIM>
const Q * madness::SimpleCache< Q, NDIM >::getptr ( Level  n,
const Key< NDIM > &  disp 
) const
inline

If key=(n,l) is present return pointer to cached value, otherwise return NULL.

This for the convenience (backward compatibility) of 1D routines

References madness::SimpleCache< Q, NDIM >::getptr(), and madness::Key< NDIM >::translation().

◆ getptr() [3/3]

template<typename Q , std::size_t NDIM>
const Q * madness::SimpleCache< Q, NDIM >::getptr ( Level  n,
Translation  l 
) const
inline

If key=(n,l) is present return pointer to cached value, otherwise return NULL.

This for the convenience (backward compatibility) of 1D routines

References madness::SimpleCache< Q, NDIM >::getptr().

◆ operator=()

template<typename Q , std::size_t NDIM>
SimpleCache & madness::SimpleCache< Q, NDIM >::operator= ( const SimpleCache< Q, NDIM > &  c)
inline

◆ set() [1/3]

template<typename Q , std::size_t NDIM>
void madness::SimpleCache< Q, NDIM >::set ( const Key< NDIM > &  key,
const Q val 
)
inline

Set value associated with key ... gives ownership of a new copy to the container.

References madness::SimpleCache< Q, NDIM >::cache, and madness::ConcurrentHashMap< keyT, valueT, hashfunT >::insert().

Referenced by madness::SimpleCache< Q, NDIM >::set(), and madness::SimpleCache< Q, NDIM >::set().

◆ set() [2/3]

template<typename Q , std::size_t NDIM>
void madness::SimpleCache< Q, NDIM >::set ( Level  n,
const Key< NDIM > &  disp,
const Q val 
)
inline

◆ set() [3/3]

template<typename Q , std::size_t NDIM>
void madness::SimpleCache< Q, NDIM >::set ( Level  n,
Translation  l,
const Q val 
)
inline

Member Data Documentation

◆ cache

template<typename Q , std::size_t NDIM>
mapT madness::SimpleCache< Q, NDIM >::cache
private

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