TuttleOFX  1
tuttle::host::memory::MemoryCache Class Reference

#include <MemoryCache.hpp>

Inheritance diagram for tuttle::host::memory::MemoryCache:
Collaboration diagram for tuttle::host::memory::MemoryCache:

Public Member Functions

 MemoryCache (const MemoryCache &other)
 MemoryCache ()
 ~MemoryCache ()
MemoryCacheoperator= (const MemoryCache &cache)
void put (const std::string &identifier, const double time, CACHE_ELEMENT pData)
CACHE_ELEMENT get (const std::string &identifier, const double time) const
CACHE_ELEMENT get (const std::size_t &i) const
CACHE_ELEMENT getUnusedWithSize (const std::size_t requestedSize) const
std::size_t size () const
bool empty () const
bool inCache (const CACHE_ELEMENT &) const
double getTime (const CACHE_ELEMENT &) const
const std::string & getPluginName (const CACHE_ELEMENT &) const
bool remove (const CACHE_ELEMENT &)
void clearUnused ()
void clearAll ()
std::ostream & outputStream (std::ostream &os) const

Private Types

typedef MemoryCache This
typedef boost::unordered_map
< Key, CACHE_ELEMENT, KeyHash
MAP

Private Member Functions

MAP::const_iterator getIteratorForValue (const CACHE_ELEMENT &) const
MAP::iterator getIteratorForValue (const CACHE_ELEMENT &)

Private Attributes

MAP _map
boost::mutex _mutexMap
 Mutex for cache data map.

Friends

std::ostream & operator<< (std::ostream &os, const MemoryCache &v)

Detailed Description

Definition at line 14 of file MemoryCache.hpp.


Member Typedef Documentation

typedef boost::unordered_map<Key, CACHE_ELEMENT, KeyHash> tuttle::host::memory::MemoryCache::MAP [private]

Definition at line 29 of file MemoryCache.hpp.

Reimplemented from tuttle::host::memory::IMemoryCache.

Definition at line 16 of file MemoryCache.hpp.


Constructor & Destructor Documentation

tuttle::host::memory::MemoryCache::MemoryCache ( const MemoryCache other) [inline]

Definition at line 19 of file MemoryCache.hpp.

tuttle::host::memory::MemoryCache::MemoryCache ( ) [inline]

Definition at line 23 of file MemoryCache.hpp.

tuttle::host::memory::MemoryCache::~MemoryCache ( ) [inline]

Definition at line 24 of file MemoryCache.hpp.


Member Function Documentation

void tuttle::host::memory::MemoryCache::clearAll ( ) [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 199 of file MemoryCache.cpp.

References _map, _mutexMap, TUTTLE_LOG_DEBUG, and TUTTLE_TRACE.

Referenced by BOOST_AUTO_TEST_CASE().

void tuttle::host::memory::MemoryCache::clearUnused ( ) [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 183 of file MemoryCache.cpp.

References _map, and _mutexMap.

bool tuttle::host::memory::MemoryCache::empty ( ) const [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 111 of file MemoryCache.cpp.

References _map, and _mutexMap.

Referenced by BOOST_AUTO_TEST_CASE().

CACHE_ELEMENT tuttle::host::memory::MemoryCache::get ( const std::string &  identifier,
const double  time 
) const [virtual]
CACHE_ELEMENT tuttle::host::memory::MemoryCache::get ( const std::size_t &  i) const

Definition at line 87 of file MemoryCache.cpp.

References _map, and _mutexMap.

MemoryCache::MAP::const_iterator tuttle::host::memory::MemoryCache::getIteratorForValue ( const CACHE_ELEMENT pData) const [private]

Definition at line 142 of file MemoryCache.cpp.

References _map.

Referenced by getPluginName(), getTime(), inCache(), and remove().

MemoryCache::MAP::iterator tuttle::host::memory::MemoryCache::getIteratorForValue ( const CACHE_ELEMENT pData) [private]

Definition at line 147 of file MemoryCache.cpp.

References _map.

const std::string & tuttle::host::memory::MemoryCache::getPluginName ( const CACHE_ELEMENT pData) const [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 162 of file MemoryCache.cpp.

References _map, _mutexMap, and getIteratorForValue().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

double tuttle::host::memory::MemoryCache::getTime ( const CACHE_ELEMENT pData) const [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 152 of file MemoryCache.cpp.

References _map, _mutexMap, and getIteratorForValue().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

CACHE_ELEMENT tuttle::host::memory::MemoryCache::getUnusedWithSize ( const std::size_t  requestedSize) const [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 99 of file MemoryCache.cpp.

References _map, and _mutexMap.

bool tuttle::host::memory::MemoryCache::inCache ( const CACHE_ELEMENT pData) const [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 117 of file MemoryCache.cpp.

References _map, _mutexMap, and getIteratorForValue().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

MemoryCache & tuttle::host::memory::MemoryCache::operator= ( const MemoryCache cache)

Definition at line 61 of file MemoryCache.cpp.

References _map, and _mutexMap.

std::ostream& tuttle::host::memory::MemoryCache::outputStream ( std::ostream &  os) const [inline, virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 50 of file MemoryCache.hpp.

void tuttle::host::memory::MemoryCache::put ( const std::string &  identifier,
const double  time,
CACHE_ELEMENT  pData 
) [virtual]
Todo:
tuttle: use key here, instead of (name, time)

Implements tuttle::host::memory::IMemoryCache.

Definition at line 71 of file MemoryCache.cpp.

References _map, and _mutexMap.

Referenced by BOOST_AUTO_TEST_CASE().

bool tuttle::host::memory::MemoryCache::remove ( const CACHE_ELEMENT pData) [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 172 of file MemoryCache.cpp.

References _map, _mutexMap, and getIteratorForValue().

Referenced by BOOST_AUTO_TEST_CASE().

Here is the call graph for this function:

std::size_t tuttle::host::memory::MemoryCache::size ( ) const [virtual]

Implements tuttle::host::memory::IMemoryCache.

Definition at line 105 of file MemoryCache.cpp.

References _map, and _mutexMap.

Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::memory::operator<<().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const MemoryCache v 
) [friend]

Definition at line 206 of file MemoryCache.cpp.


Field Documentation

boost::mutex tuttle::host::memory::MemoryCache::_mutexMap [mutable, private]

Mutex for cache data map.

Definition at line 32 of file MemoryCache.hpp.

Referenced by clearAll(), clearUnused(), empty(), get(), getPluginName(), getTime(), getUnusedWithSize(), inCache(), operator=(), put(), remove(), and size().


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