TPProto::FrameBuilder Class Reference

Builds Frames from frame type and Buffer. More...

#include <framebuilder.h>

List of all members.

Public Member Functions

 FrameBuilder ()
 Constructs object and sets up defaults.
virtual ~FrameBuilder ()
 Destructor.
void setProtocolLayer (ProtocolLayer *pl)
 Sets the ProtocolLayer.
void setOrderDescCache (OrderDescCache *odc)
 Sets the OrderDescCache to use. Used to build Order Frames.
void setObjectDescCache (ObjectDescCache *odc)
 Sets the ObjectDescCache to use. Used to build Object Frames.
void setCommandDescCache (CommandDescCache *cdc)
 Sets the CommandDescCache to use. Used to build Command Frames.
virtual void buildFrame (uint32_t type, Buffer *data, uint32_t ftver, uint32_t seqnum)
 Builds a frame from it's type. Builds a frame subclass object that corresponds to the type given, or NULL if none is found. Frame sent to FrameCodec::receivedFrame().

Protected Member Functions

void processOrderDescription (Frame *frame, Buffer *data, boost::shared_ptr< OrderDescription > od)
 Builds an Order Frame from the frame, Buffer, and the OrderDescription.
void processObjectDescription (Frame *frame, Buffer *data, boost::shared_ptr< ObjectDescription > od)
 Builds an Object Frame from the frame, Buffer, and the ObjectDescription.
void processCommandDescription (Frame *frame, Buffer *data, boost::shared_ptr< CommandDescription > cd)
 Builds an Command Frame from the frame, Buffer, and the CommandDescription.

Protected Attributes

ProtocolLayerlayer
 The ProtocolLayer this FrameBuilder is part of.
OrderDescCacheorderdesccache
ObjectDescCacheobjectdesccache
CommandDescCachecommanddesccache

Detailed Description

Builds Frames from frame type and Buffer.

Also creates Objects from object types, Orders from order types, and Commands from command types.


Member Function Documentation

void TPProto::FrameBuilder::buildFrame ( uint32_t  type,
Buffer data,
uint32_t  ftver,
uint32_t  seqnum 
) [virtual]

Builds a frame from it's type. Builds a frame subclass object that corresponds to the type given, or NULL if none is found. Frame sent to FrameCodec::receivedFrame().

Parameters:
type The type of frame to build.
data The Buffer of data that is the contents of the frame.
ftver The version of the frametype
seqnum The sequence number

References commanddesccache, TPProto::FrameFactory::createBoard(), TPProto::FrameFactory::createBoardIdsList(), TPProto::FrameFactory::createCategory(), TPProto::FrameFactory::createCategoryIdsList(), TPProto::FrameFactory::createCommandDescription(), TPProto::FrameFactory::createCommandResult(), TPProto::FrameFactory::createCommandTypesList(), TPProto::FrameFactory::createComponent(), TPProto::FrameFactory::createComponentIdsList(), TPProto::FrameFactory::createDesign(), TPProto::FrameFactory::createDesignIdsList(), TPProto::FrameFactory::createFail(), TPProto::FrameFactory::createFeatures(), TPProto::FrameFactory::createGameInfo(), TPProto::FrameFactory::createLogMessage(), TPProto::FrameFactory::createMessage(), TPProto::FrameFactory::createObject(), TPProto::FrameFactory::createObjectDescription(), TPProto::FrameFactory::createObjectIdsList(), TPProto::FrameFactory::createObjectTypesList(), TPProto::FrameFactory::createOk(), TPProto::FrameFactory::createOrder(), TPProto::FrameFactory::createOrderDescription(), TPProto::FrameFactory::createOrderTypesList(), TPProto::FrameFactory::createPlayer(), TPProto::FrameFactory::createPlayerIdsList(), TPProto::FrameFactory::createProperty(), TPProto::FrameFactory::createPropertyIdsList(), TPProto::FrameFactory::createRedirect(), TPProto::FrameFactory::createResourceDescription(), TPProto::FrameFactory::createResourceTypesList(), TPProto::FrameFactory::createSequence(), TPProto::FrameFactory::createTimeRemaining(), TPProto::ProtocolLayer::getFrameCodec(), TPProto::ProtocolLayer::getFrameFactory(), layer, objectdesccache, orderdesccache, TPProto::Buffer::peekInt(), processCommandDescription(), processObjectDescription(), processOrderDescription(), TPProto::FrameCodec::receivedFrame(), TPProto::CommandDescCache::requestCommandDescription(), TPProto::Frame::setSequenceNumber(), and TPProto::Frame::unpackBuffer().

void TPProto::FrameBuilder::processCommandDescription ( Frame frame,
Buffer data,
boost::shared_ptr< CommandDescription cd 
) [protected]

Builds an Command Frame from the frame, Buffer, and the CommandDescription.

When done, the Frame is passed to FrameCodec::receiveFrame() to be send to the requester.

Parameters:
frame The Frame to build, is an Command.
data The Buffer to unpack to create the Command.
cd The CommandDescription for this Command's type.

References TPProto::ProtocolLayer::getFrameCodec(), layer, TPProto::FrameCodec::receivedFrame(), TPProto::Command::setCommandType(), and TPProto::Command::unpackBuffer().

Referenced by buildFrame().

void TPProto::FrameBuilder::processObjectDescription ( Frame frame,
Buffer data,
boost::shared_ptr< ObjectDescription od 
) [protected]

Builds an Object Frame from the frame, Buffer, and the ObjectDescription.

When done, the Frame is passed to FrameCodec::receiveFrame() to be send to the requester.

Parameters:
frame The Frame to build, is an Object.
data The Buffer to unpack to create the Object.
od The ObjectDescription for this Object's type.

References TPProto::ProtocolLayer::getFrameCodec(), layer, TPProto::FrameCodec::receivedFrame(), and TPProto::Object::unpackBuffer().

Referenced by buildFrame().

void TPProto::FrameBuilder::processOrderDescription ( Frame frame,
Buffer data,
boost::shared_ptr< OrderDescription od 
) [protected]

Builds an Order Frame from the frame, Buffer, and the OrderDescription.

When done, the Frame is passed to FrameCodec::receiveFrame() to be send to the requester.

Parameters:
frame The Frame to build, is an Order.
data The Buffer to unpack to create the Order.
od The OrderDescription for this Order's type.

References TPProto::ProtocolLayer::getFrameCodec(), layer, TPProto::FrameCodec::receivedFrame(), TPProto::Order::setOrderType(), and TPProto::Order::unpackBuffer().

Referenced by buildFrame().

void TPProto::FrameBuilder::setCommandDescCache ( CommandDescCache cdc  ) 

Sets the CommandDescCache to use. Used to build Command Frames.

Parameters:
cdc The CommandDescCache to use.

References commanddesccache.

Referenced by TPProto::AdminLayer::AdminLayer().

void TPProto::FrameBuilder::setObjectDescCache ( ObjectDescCache odc  ) 

Sets the ObjectDescCache to use. Used to build Object Frames.

Parameters:
odc The ObjectDescCache to use.

References objectdesccache.

Referenced by TPProto::GameLayer::GameLayer().

void TPProto::FrameBuilder::setOrderDescCache ( OrderDescCache odc  ) 

Sets the OrderDescCache to use. Used to build Order Frames.

Parameters:
odc The OrderDescCache to use.

References orderdesccache.

Referenced by TPProto::GameLayer::GameLayer().

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

Sets the ProtocolLayer.

Parameters:
pl The ProtocolLayer to use.

References layer.

Referenced by TPProto::ProtocolLayer::ProtocolLayer(), and TPProto::ProtocolLayer::setFrameBuilder().


Member Data Documentation

The CommandDescCache to use to create Commands.

Referenced by buildFrame(), and setCommandDescCache().

The ObjectDescCache to use to create Objects.

Referenced by buildFrame(), and setObjectDescCache().

The OrderDescCache to use to create Orders.

Referenced by buildFrame(), and setOrderDescCache().


The documentation for this class was generated from the following files:

Generated on Mon Mar 15 09:00:05 2010 for libtpproto-cpp by  doxygen 1.6.1