TPProto::Cache Class Reference

Interface to a cache. Most of the work is done by CacheMethod, so this class is mostly just an interface, with subclasses working to cast things and get ids, etc from the frames. More...

#include <cache.h>

Inheritance diagram for TPProto::Cache:

TPProto::BoardCache TPProto::CategoryCache TPProto::CommandDescCache TPProto::ComponentCache TPProto::DesignCache TPProto::ObjectCache TPProto::ObjectDescCache TPProto::OrderDescCache TPProto::PlayerCache TPProto::PropertyCache TPProto::ResourceCache List of all members.

Public Member Functions

 Cache ()
 Constructor that sets up defaults. Default is for CacheNoneMethod CacheMethod.
virtual ~Cache ()
 Destructor.
virtual void update ()
 Call when you want to update the cache. Good times to do this are when we first log in, and when we notice an EOT has finished.
void setCacheMethod (CacheMethod *cm)
 Sets the CacheMethod this Cache will use.
void setProtocolLayer (ProtocolLayer *pl)
 Sets the ProtocolLayer this Cache will use.
virtual void newItem (boost::shared_ptr< Frame > item)=0
 Receive a new or updated version of an item from the CacheMethod.
virtual void existingItem (boost::shared_ptr< Frame > item)=0
 Receive an existing item from the CacheMethod.
virtual GetIdSequencecreateGetIdSequenceFrame ()=0
 Create a GetIdsSequence subclass frame for the CacheMethod to use. Must return the correct type of frame for this Cache.
virtual GetByIdcreateGetByIdFrame ()=0
 Create a GetById subclass frame for the CacheMethod to use. Must return the correct type of frame for this Cache.
virtual uint32_t getIdFromFrame (Frame *frame)=0
 Get the Id from the Frame provided. The Frame is of the correct type. For example, for the Object cache, the Frame will be an Object.
virtual uint64_t getModTimeFromFrame (Frame *frame)=0
 Get the Modification time from the Frame provided. The Frame is of the correct type. For example, for the Object cache, the Frame will be an Object.

Protected Attributes

CacheMethodcache
 The CacheMethod this Cache will use.
ProtocolLayerprotocol
 The ProtocolLayer that will be used.

Detailed Description

Interface to a cache. Most of the work is done by CacheMethod, so this class is mostly just an interface, with subclasses working to cast things and get ids, etc from the frames.


Member Function Documentation

void TPProto::Cache::setCacheMethod ( CacheMethod cm  ) 

Sets the CacheMethod this Cache will use.

Parameters:
cm The CacheMethod to use.

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

Sets the ProtocolLayer this Cache will use.

Parameters:
pl The ProtocolLayer to use.

virtual void TPProto::Cache::newItem ( boost::shared_ptr< Frame item  )  [pure virtual]

Receive a new or updated version of an item from the CacheMethod.

Parameters:
item The existing item in a Frame

Implemented in TPProto::BoardCache, TPProto::CategoryCache, TPProto::CommandDescCache, TPProto::ComponentCache, TPProto::DesignCache, TPProto::ObjectCache, TPProto::ObjectDescCache, TPProto::OrderDescCache, TPProto::PlayerCache, TPProto::PropertyCache, and TPProto::ResourceCache.

virtual void TPProto::Cache::existingItem ( boost::shared_ptr< Frame item  )  [pure virtual]

Receive an existing item from the CacheMethod.

Parameters:
item The existing item in a Frame

Implemented in TPProto::BoardCache, TPProto::CategoryCache, TPProto::CommandDescCache, TPProto::ComponentCache, TPProto::DesignCache, TPProto::ObjectCache, TPProto::ObjectDescCache, TPProto::OrderDescCache, TPProto::PlayerCache, TPProto::PropertyCache, and TPProto::ResourceCache.

virtual uint32_t TPProto::Cache::getIdFromFrame ( Frame frame  )  [pure virtual]

Get the Id from the Frame provided. The Frame is of the correct type. For example, for the Object cache, the Frame will be an Object.

Parameters:
frame The Frame to get the Id from.
Returns:
The id of the frame.

Implemented in TPProto::BoardCache, TPProto::CategoryCache, TPProto::CommandDescCache, TPProto::ComponentCache, TPProto::DesignCache, TPProto::ObjectCache, TPProto::ObjectDescCache, TPProto::OrderDescCache, TPProto::PlayerCache, TPProto::PropertyCache, and TPProto::ResourceCache.

virtual uint64_t TPProto::Cache::getModTimeFromFrame ( Frame frame  )  [pure virtual]

Get the Modification time from the Frame provided. The Frame is of the correct type. For example, for the Object cache, the Frame will be an Object.

Parameters:
frame The Frame to get the Modtime from.
Returns:
The modtime of the frame.

Implemented in TPProto::BoardCache, TPProto::CategoryCache, TPProto::CommandDescCache, TPProto::ComponentCache, TPProto::DesignCache, TPProto::ObjectCache, TPProto::ObjectDescCache, TPProto::OrderDescCache, TPProto::PlayerCache, TPProto::PropertyCache, and TPProto::ResourceCache.


The documentation for this class was generated from the following files:
Generated on Tue Jan 6 06:15:48 2009 for libtpproto-cpp by  doxygen 1.5.1