MADNESS 0.10.1
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 >:

Public Member Functions

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

Private Types

typedef ConcurrentHashMap< Key< NDIM >, Q > mapT
typedef std::pair< Key< NDIM >, Q > pairT

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

References cache.

Referenced by SimpleCache(), and operator=().

◆ SimpleCache() [2/2]

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

References SimpleCache(), c, and cache.

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

If key is present return pointer to cached value, otherwise return NULL.

References cache, Q(), and test().

Referenced by getptr(), and getptr().

◆ 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 getptr(), Q(), 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 getptr(), and Q().

◆ operator=()

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

References SimpleCache(), c, and cache.

◆ set() [1/3]

template<typename Q, std::size_t NDIM>
const Q * 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 cache, and Q().

Referenced by set(), and set().

◆ set() [2/3]

template<typename Q, std::size_t NDIM>
const Q * 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>
const Q * madness::SimpleCache< Q, NDIM >::set ( Level n,
Translation l,
const Q & val )
inline

References Q(), and set().

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: