dune-common 2.1.1
Public Types | Public Member Functions
Dune::lru< _Key, _Tp, _Traits > Class Template Reference

LRU Cache Container. More...

#include <dune/common/lru.hh>

List of all members.

Public Types

typedef _Traits::key_type key_type
typedef allocator::value_type value_type
typedef allocator::pointer pointer
typedef allocator::const_pointer const_pointer
typedef allocator::const_reference const_reference
typedef allocator::reference reference
typedef allocator::size_type size_type
typedef list_type::iterator iterator
typedef list_type::const_iterator const_iterator

Public Member Functions

reference front ()
const_reference front () const
reference back ()
const_reference back (int i) const
const void pop_front ()
 Removes the first element.
const void pop_back ()
 Removes the last element.
iterator find (const key_type &key)
 Finds the element whose key is k.
const_iterator find (const key_type &key) const
 Finds the element whose key is k.
reference insert (const key_type &key, const_reference data)
 Insert a value into the container.
reference insert (const key_type &key)
reference touch (const key_type &key)
 mark data associateed with key as most recent
size_type size () const
void resize (size_type new_size)
void clear ()

Detailed Description

template<typename _Key, typename _Tp, typename _Traits = _lru_default_traits<_Key, _Tp>>
class Dune::lru< _Key, _Tp, _Traits >

LRU Cache Container.

Implementatation of an LRU (least recently used) cache container. This implementation follows the approach presented in http://aim.adc.rmit.edu.au/phd/sgreuter/papers/graphite2003.pdf


Member Typedef Documentation

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef list_type::const_iterator Dune::lru< _Key, _Tp, _Traits >::const_iterator
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef allocator::const_pointer Dune::lru< _Key, _Tp, _Traits >::const_pointer
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef allocator::const_reference Dune::lru< _Key, _Tp, _Traits >::const_reference
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef list_type::iterator Dune::lru< _Key, _Tp, _Traits >::iterator
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef _Traits::key_type Dune::lru< _Key, _Tp, _Traits >::key_type
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef allocator::pointer Dune::lru< _Key, _Tp, _Traits >::pointer
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef allocator::reference Dune::lru< _Key, _Tp, _Traits >::reference
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef allocator::size_type Dune::lru< _Key, _Tp, _Traits >::size_type
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
typedef allocator::value_type Dune::lru< _Key, _Tp, _Traits >::value_type

Member Function Documentation

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
reference Dune::lru< _Key, _Tp, _Traits >::back ( ) [inline]

Returns a read/write reference to the data of the least recently used entry.

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
const_reference Dune::lru< _Key, _Tp, _Traits >::back ( int  i) const [inline]

Returns a read-only (constant) reference to the data of the least recently used entry.

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
void Dune::lru< _Key, _Tp, _Traits >::clear ( ) [inline]
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
const_iterator Dune::lru< _Key, _Tp, _Traits >::find ( const key_type key) const [inline]

Finds the element whose key is k.

Returns:
const_iterator
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
iterator Dune::lru< _Key, _Tp, _Traits >::find ( const key_type key) [inline]

Finds the element whose key is k.

Returns:
iterator
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
reference Dune::lru< _Key, _Tp, _Traits >::front ( ) [inline]

Returns a read/write reference to the data of the most recently used entry.

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
const_reference Dune::lru< _Key, _Tp, _Traits >::front ( ) const [inline]

Returns a read-only (constant) reference to the data of the most recently used entry.

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
reference Dune::lru< _Key, _Tp, _Traits >::insert ( const key_type key,
const_reference  data 
) [inline]

Insert a value into the container.

Stores value under key and marks it as most recent.

Parameters:
keyassociated with data
datato store
Returns:
reference of stored data
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
reference Dune::lru< _Key, _Tp, _Traits >::insert ( const key_type key) [inline]

mark data associateed with key as most recent

Returns:
reference of stored data

References Dune::lru< _Key, _Tp, _Traits >::touch().

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
const void Dune::lru< _Key, _Tp, _Traits >::pop_back ( ) [inline]

Removes the last element.

Referenced by Dune::lru< _Key, _Tp, _Traits >::resize().

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
const void Dune::lru< _Key, _Tp, _Traits >::pop_front ( ) [inline]

Removes the first element.

template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
void Dune::lru< _Key, _Tp, _Traits >::resize ( size_type  new_size) [inline]
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
size_type Dune::lru< _Key, _Tp, _Traits >::size ( ) const [inline]
template<typename _Key , typename _Tp , typename _Traits = _lru_default_traits<_Key, _Tp>>
reference Dune::lru< _Key, _Tp, _Traits >::touch ( const key_type key) [inline]

mark data associateed with key as most recent

Returns:
reference of stored data

Referenced by Dune::lru< _Key, _Tp, _Traits >::insert().


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