00001 #ifndef TPPROTO_CACHEMETHOD_H
00002 #define TPPROTO_CACHEMETHOD_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #include <map>
00028 #include <set>
00029 #include <boost/signal.hpp>
00030
00031 namespace TPProto{
00032
00033 class Frame;
00034 class Cache;
00035 class ProtocolLayer;
00036
00037 typedef boost::signal<void (std::set<uint32_t>)> IdSetSignal;
00038 typedef IdSetSignal::slot_type IdSetCallback;
00039
00044 class CacheMethod{
00045 public:
00046 CacheMethod();
00047 CacheMethod(const CacheMethod& rhs);
00048 virtual ~CacheMethod();
00049
00053 virtual void update() = 0;
00054
00055 void setCache(Cache* c);
00056
00057 void setProtocolLayer(ProtocolLayer* pl);
00058
00065 virtual void getById(uint32_t id) = 0;
00066
00072 virtual void markInvalid(uint32_t id) = 0;
00073
00077 void getAllIds(const IdSetCallback& cb);
00078
00079 boost::signals::connection watchAllIds(const IdSetCallback& cb);
00080
00084 virtual CacheMethod* clone() = 0;
00085
00086 protected:
00087 virtual void getIdList() = 0;
00088 void newIdList(std::set<uint32_t> list);
00089 void existingList(std::set<uint32_t> list);
00090
00093 Cache* cache;
00094
00097 ProtocolLayer* protocol;
00098
00099 IdSetSignal waiters;
00100 IdSetSignal watchers;
00101
00102 };
00103
00104 }
00105
00106 #endif
00107