TPProto::CacheMethod Class Reference

Base class for a method of caching frames. Works in partnership with Cache to cache frames. CacheMethod determains how to cache the frames. More...

#include <cachemethod.h>

Inheritance diagram for TPProto::CacheMethod:

TPProto::CacheNoneMethod List of all members.

Public Member Functions

 CacheMethod ()
 Default Constructor.
 CacheMethod (const CacheMethod &rhs)
 Copy Constructor, sets all fields to NULL. Subclasses should call this, and initialise any fields it might have.
virtual ~CacheMethod ()
 Destructor, virtual.
virtual void update ()=0
 Called when the client wants to update the cache. Can do nothing.
void setCache (Cache *c)
 Sets the Cache object this CacheMethod is for. CacheMethods can (and need to) use the Cache to get useful information.
void setProtocolLayer (ProtocolLayer *pl)
 Sets the ProtocolLayer to use.
virtual void getById (uint32_t id)=0
 Gets a item from the cache by Id.
virtual void markInvalid (uint32_t id)=0
 Marks an item as invalid. If a method wishes to it can refetch it from the server. The pointer to the frame should not be consided valid, and does not get deleted by the CacheMethod.
void getAllIds (const IdSetCallback &cb)
 Gets all the ids.
boost::signals::connection watchAllIds (const IdSetCallback &cb)
virtual CacheMethodclone ()=0
 Returns an empty clone of this CacheMethod. body should be return new CacheMethodNameCopyConstructor(this);.

Protected Member Functions

virtual void getIdList ()=0
void newIdList (std::set< uint32_t > list)
void existingList (std::set< uint32_t > list)

Protected Attributes

Cachecache
 The Cache this CacheMethod will use.
ProtocolLayerprotocol
 The ProtocolLayer that will be used.
IdSetSignal waiters
IdSetSignal watchers

Detailed Description

Base class for a method of caching frames. Works in partnership with Cache to cache frames. CacheMethod determains how to cache the frames.


Member Function Documentation

void TPProto::CacheMethod::setCache ( Cache c  ) 

Sets the Cache object this CacheMethod is for. CacheMethods can (and need to) use the Cache to get useful information.

Parameters:
c The Cache this cache method will be used for.

void TPProto::CacheMethod::setProtocolLayer ( ProtocolLayer pl  ) 

Sets the ProtocolLayer to use.

Parameters:
pl The ProtocolLayer to use.

virtual void TPProto::CacheMethod::getById ( uint32_t  id  )  [pure virtual]

Gets a item from the cache by Id.

Returned by call to Cache::newItem or Cache::existingItem

Parameters:
id The Id of the item to get.

Implemented in TPProto::CacheNoneMethod.

virtual void TPProto::CacheMethod::markInvalid ( uint32_t  id  )  [pure virtual]

Marks an item as invalid. If a method wishes to it can refetch it from the server. The pointer to the frame should not be consided valid, and does not get deleted by the CacheMethod.

Parameters:
id The id of the item that is invalid.

Implemented in TPProto::CacheNoneMethod.

void TPProto::CacheMethod::getAllIds ( const IdSetCallback &  cb  ) 

Gets all the ids.

Parameters:
cb The callback to send the set of ids to..


The documentation for this class was generated from the following files:
Generated on Thu Nov 20 11:30:42 2008 for libtpproto-cpp by  doxygen 1.5.1