Protocols::Generics::BadPacket Class Reference

#include <BadPacket.h> [code]

Inherits Protocols::Generics::PacketBase.

Inheritance diagram for Protocols::Generics::BadPacket:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

A packet class encapsulating the raw data of a packet that cannot be parsed.

An instance of this class only stores a packet's raw data. PacketFactory creates an instance of this class if the raw data cannot be parsed.

Todo:
How to reduce the code duplication with BadPacket for each protocol implementing its own PacketBase specialization? Make this class a template? But then what if different specializations require further pure virtual methods to be implemented and specific values to be passed to the PacketBase ctor?
See also:
PacketFactory

Definition at line 45 of file BadPacket.h.

Public Member Functions

virtual QString protocol () const
 Returns the name of the protocol this PacketBase belongs to.
virtual QString name () const
 Returns the name of the PacketBase type the dynamic object belongs to.
virtual auto_ptr< DataBasecopy () const
 Virtual copy constructor.
 BadPacket (const QByteArray &rawHeader=QByteArray(), const QByteArray &rawPayload=QByteArray())
 Constructs an object from raw data.

Protected Member Functions

virtual bool readHeader (const QByteArray &rawHeader)
virtual bool readPayload (const QByteArray &rawPayload)
virtual QByteArray writeHeader () const
virtual QByteArray writePayload () const

Private Member Functions

 Q_DECLARE_SHARED_DATA (Data)

Classes

class  Data
 BadPacket private data. More...


Constructor & Destructor Documentation

BadPacket::BadPacket const QByteArray &  rawHeader = QByteArray(),
const QByteArray &  rawPayload = QByteArray()
 

Constructs an object from raw data.

Definition at line 45 of file BadPacket.cpp.


Member Function Documentation

auto_ptr< DataBase > BadPacket::copy  )  const [virtual]
 

Virtual copy constructor.

Implements Protocols::Generics::PacketBase.

Definition at line 37 of file BadPacket.cpp.

QString BadPacket::name  )  const [virtual]
 

Returns the name of the PacketBase type the dynamic object belongs to.

Todo:
Better use PacketId (which possibly contains the ProtocolId)?

Implements Protocols::Generics::PacketBase.

Definition at line 32 of file BadPacket.cpp.

QString BadPacket::protocol  )  const [virtual]
 

Returns the name of the protocol this PacketBase belongs to.

Todo:
Better use ProtocolId?

Implements Protocols::Generics::PacketBase.

Definition at line 27 of file BadPacket.cpp.

Protocols::Generics::BadPacket::Q_DECLARE_SHARED_DATA Data   )  [private]
 

bool BadPacket::readHeader const QByteArray &  rawHeader  )  [protected, virtual]
 

Implements Protocols::Generics::PacketBase.

Definition at line 56 of file BadPacket.cpp.

bool BadPacket::readPayload const QByteArray &  rawPayload  )  [protected, virtual]
 

Implements Protocols::Generics::PacketBase.

Definition at line 62 of file BadPacket.cpp.

QByteArray BadPacket::writeHeader  )  const [protected, virtual]
 

Implements Protocols::Generics::PacketBase.

Definition at line 68 of file BadPacket.cpp.

QByteArray BadPacket::writePayload  )  const [protected, virtual]
 

Implements Protocols::Generics::PacketBase.

Definition at line 74 of file BadPacket.cpp.


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