ED2KParser< Parent >::PacketFactory Class Reference

PacketFactory is an abstract base class for specific packet factories, which handle specific packet construction and user callbacks after packet construction. More...

#include <parser.h>

List of all members.


Public Member Functions

virtual void create (Parent *parent, std::istringstream &i)=0
 Creates a packet and calls back to packet handler.

Protected Member Functions

 PacketFactory (uint8_t proto, uint8_t opcode)
 Base class constructor registers the factory with ED2KParser factories list, making it available to receive packets for construction.
virtual ~PacketFactory ()
 Dummy destructor.

Detailed Description

template<typename Parent>
class ED2KParser< Parent >::PacketFactory

PacketFactory is an abstract base class for specific packet factories, which handle specific packet construction and user callbacks after packet construction.

This class is implemented as public here for specific derived factories to be able to access it. It should not be used by user code.

Specific factory must pass it's supported opcode (based on which ED2KParser chooses that factory to pass data to) to the base class's constructor. Specific factory must also override pure virtual create() method to perform the packet construction.

Definition at line 142 of file parser.h.


Constructor & Destructor Documentation

template<typename Parent>
ED2KParser< Parent >::PacketFactory::PacketFactory uint8_t  proto,
uint8_t  opcode
[inline, protected]
 

Base class constructor registers the factory with ED2KParser factories list, making it available to receive packets for construction.

Parameters:
proto Protocol, into which the packet belongs
opcode Opcode, upon which to call this factory

Definition at line 161 of file parser.h.

References ED2KParser< Parent >::factories().

template<typename Parent>
virtual ED2KParser< Parent >::PacketFactory::~PacketFactory  )  [inline, protected, virtual]
 

Dummy destructor.

Definition at line 174 of file parser.h.


Member Function Documentation

template<typename Parent>
virtual void ED2KParser< Parent >::PacketFactory::create Parent *  parent,
std::istringstream &  i
[pure virtual]
 

Creates a packet and calls back to packet handler.

Parameters:
parent Pointer to packet handler object
i Stream containing packet data
proto Protocol used for this packet

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