TuttleOFX
1
|
#include <MemoryCache.hpp>
Public Member Functions | |
MemoryCache (const MemoryCache &other) | |
MemoryCache () | |
~MemoryCache () | |
MemoryCache & | operator= (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) |
Definition at line 14 of file MemoryCache.hpp.
typedef boost::unordered_map<Key, CACHE_ELEMENT, KeyHash> tuttle::host::memory::MemoryCache::MAP [private] |
Definition at line 29 of file MemoryCache.hpp.
typedef MemoryCache tuttle::host::memory::MemoryCache::This [private] |
Reimplemented from tuttle::host::memory::IMemoryCache.
Definition at line 16 of file MemoryCache.hpp.
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.
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.
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] |
Implements tuttle::host::memory::IMemoryCache.
Definition at line 77 of file MemoryCache.cpp.
References _map, and _mutexMap.
Referenced by BOOST_AUTO_TEST_CASE(), tuttle::host::loadAndGenerateThumbnail(), and tuttle::host::loadImage().
CACHE_ELEMENT tuttle::host::memory::MemoryCache::get | ( | const std::size_t & | i | ) | const |
Definition at line 87 of file MemoryCache.cpp.
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().
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().
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.
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().
MemoryCache & tuttle::host::memory::MemoryCache::operator= | ( | const MemoryCache & | cache | ) |
Definition at line 61 of file MemoryCache.cpp.
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] |
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().
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<<().
std::ostream& operator<< | ( | std::ostream & | os, |
const MemoryCache & | v | ||
) | [friend] |
Definition at line 206 of file MemoryCache.cpp.
MAP tuttle::host::memory::MemoryCache::_map [private] |
Definition at line 31 of file MemoryCache.hpp.
Referenced by clearAll(), clearUnused(), empty(), get(), getIteratorForValue(), getPluginName(), getTime(), getUnusedWithSize(), inCache(), tuttle::host::memory::operator<<(), operator=(), put(), remove(), and size().
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().