TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/memory/IMemoryCache.cpp
Go to the documentation of this file.
00001 #include "IMemoryCache.hpp"
00002 
00003 #include <boost/functional/hash.hpp>
00004 #include <ostream>
00005 
00006 namespace tuttle {
00007 namespace host {
00008 namespace memory {
00009 
00010 bool Key::operator<( const Key& other ) const
00011 {
00012         if( _time != other._time )
00013                 return _time < other._time;
00014         return _identifier < other._identifier;
00015 }
00016 
00017 bool Key::operator==( const Key& v ) const
00018 {
00019         return _time == v._time && _identifier == v._identifier;
00020 }
00021 
00022 std::size_t Key::getHash() const
00023 {
00024         std::size_t seed = 0;
00025 
00026         boost::hash_combine( seed, _time );
00027         boost::hash_combine( seed, _identifier );
00028         return seed;
00029 }
00030 
00031 std::ostream& operator<<( std::ostream& os, const Key& v )
00032 {
00033         os << "[identifier:" << v._identifier
00034            << ", time:" << v._time << "]";
00035         return os;
00036 }
00037 
00038 IMemoryCache::~IMemoryCache() {}
00039 
00040 std::ostream& operator<<( std::ostream& os, const IMemoryCache& v )
00041 {
00042         return v.outputStream(os);
00043 }
00044 
00045 }
00046 }
00047 }
00048