cachemethod.h

Go to the documentation of this file.
00001 #ifndef TPPROTO_CACHEMETHOD_H
00002 #define TPPROTO_CACHEMETHOD_H
00003 /*  CacheMethod - Methods of caching Frames base class
00004  *
00005  *  Copyright (C) 2006, 2008  Lee Begg and the Thousand Parsec Project
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 

Generated on Tue Jan 6 00:45:48 2009 for libtpproto-cpp by  doxygen 1.5.1