Protocols::Generics::PacketSerializer Class Reference

#include <PacketSerializer.h> [code]

Inherits Protocols::Generics::DataSerializer.

Inheritance diagram for Protocols::Generics::PacketSerializer:

Inheritance graph
[legend]
Collaboration diagram for Protocols::Generics::PacketSerializer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Serializes Packet objects to and from Transport.

PacketBuffer serializes Packet objects to and from a Transport. It is generic in the sense that it can read packets for any PacketProtocol.

Definition at line 40 of file PacketSerializer.h.

Public Member Functions

 PacketSerializer (PacketProtocol *)
 Creates a PacketSerializer object.
 ~PacketSerializer ()
 Dtor.
bool read (Data &, Transport *)
 Reads a packet from the underlying Transport.
bool write (const Data &, Transport *)
 Buffers and eventually writes packet to the underlying Transport.

Private Member Functions

CALITKO_TESTABLE PacketSerializer (const PacketSerializer &)
PacketSerializeroperator= (const PacketSerializer &)

Private Attributes

PacketProtocolpacketProtocol


Constructor & Destructor Documentation

CALITKO_TESTABLE Protocols::Generics::PacketSerializer::PacketSerializer const PacketSerializer  )  [private]
 

PacketSerializer::PacketSerializer PacketProtocol pp  ) 
 

Creates a PacketSerializer object.

Parameters:
t is the Transport to use for reading and writing of raw bytes.
pp is the PacketProtocol that defines the raw format of the packets.

Definition at line 32 of file PacketSerializer.cpp.

PacketSerializer::~PacketSerializer  ) 
 

Dtor.

Definition at line 38 of file PacketSerializer.cpp.


Member Function Documentation

PacketSerializer& Protocols::Generics::PacketSerializer::operator= const PacketSerializer  )  [private]
 

bool PacketSerializer::read Data data,
Transport transport
[virtual]
 

Reads a packet from the underlying Transport.

Parameters:
[out] packet will contain the read packet.
transport is the Transport object to read from.
Returns:
true if a complete packet could be read. The value of packet will be set to the Packet object that was just read.

false if a complete packet could not be read. The called should try again later (e.g. the next time when Transport signals readyRead() over the TransportStatus interface). The value of packet will not be changed.

Implements Protocols::Generics::DataSerializer.

Definition at line 53 of file PacketSerializer.cpp.

bool PacketSerializer::write const Data data,
Transport transport
[virtual]
 

Buffers and eventually writes packet to the underlying Transport.

Parameters:
packet will be buffered and the function will try to directly write it to transport.
transport is the Transport to try to write the packet to.
Returns:
true if packet was written.

false if packet could not be written.

Implements Protocols::Generics::DataSerializer.

Definition at line 81 of file PacketSerializer.cpp.


Member Data Documentation

PacketProtocol* Protocols::Generics::PacketSerializer::packetProtocol [private]
 

Definition at line 53 of file PacketSerializer.h.


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