GNE  0.75.0
GNE::WrapperPacket Class Reference

WrapperPacket is a Packet that encapsulates another packet for the purposes of adding information to that packet. More...

#include <WrapperPacket.h>

Inheritance diagram for GNE::WrapperPacket:
GNE::Packet GNE::ChannelPacket GNE::ObjectBrokerPacket GNE::ObjectCreationPacket GNE::ObjectDeathPacket GNE::ObjectUpdatePacket

Public Types

typedef SmartPtr< WrapperPacketsptr
typedef WeakPtr< WrapperPacketwptr
- Public Types inherited from GNE::Packet
typedef SmartPtr< Packetsptr
typedef WeakPtr< Packetwptr

Public Member Functions

virtual int getSize () const
 Returns the current size of this packet in bytes.
const PacketgetData () const
 Returns the encapsulated data in this WrapperPacket.
PacketgetData ()
 Returns the encapsulated data in this WrapperPacket.
void setData (const Packet *packet)
 Replaces the given packet with the current packet as this WrapperPacket's data.
virtual void writePacket (Buffer &raw) const
 Writes the packet to the given Buffer.
virtual void readPacket (Buffer &raw)
 Reads this packet from the given Buffer.
WrapperPacketoperator= (const WrapperPacket &rhs)
 Copies the given WrapperPacket into this one.
- Public Member Functions inherited from GNE::Packet
PacketmakeClone () const
 Returns a newly allocated exact copy of this packet, using the PacketParser::clonePacket function.
int getType () const
 Returns the type of this instance.

Protected Member Functions

 WrapperPacket (int id)
 Initializes a new WrapperPacket with the given Packet ID and no encapsulated Packet.
 WrapperPacket (int id, const Packet *packet)
 Initializes a new WrapperPacket with the given Packet ID and encapsulated Packet.
 WrapperPacket (const WrapperPacket &o)
 Initializes this WrapperPacket with the given WrapperPacket.
- Protected Member Functions inherited from GNE::Packet
 Packet (int id)
 Constructs a packet with the given ID.
 Packet (const Packet &o)
 Copy constructor.
Packetoperator= (const Packet &rhs)
 Copy operator you can use to help you in creating your own.

Detailed Description

WrapperPacket is a Packet that encapsulates another packet for the purposes of adding information to that packet.

A WrapperPacket on its own has no identity; it is meant only to be used as a base class for the real packet types that perform this common functionality.

Constructor & Destructor Documentation

GNE::WrapperPacket::WrapperPacket ( int  id,
const Packet packet 
)
protected

Initializes a new WrapperPacket with the given Packet ID and encapsulated Packet.

The encapsulated Packet may be NULL.

Member Function Documentation

const Packet * GNE::WrapperPacket::getData ( ) const

Returns the encapsulated data in this WrapperPacket.

There may not currently be an encapsulated Packet, so this method may return NULL.

Packet * GNE::WrapperPacket::getData ( )

Returns the encapsulated data in this WrapperPacket.

There may not currently be an encapsulated Packet, so this method may return NULL.

WrapperPacket & GNE::WrapperPacket::operator= ( const WrapperPacket rhs)

Copies the given WrapperPacket into this one.

Calls Packet::operator=( const Packet& rhs ).

void GNE::WrapperPacket::setData ( const Packet packet)

Replaces the given packet with the current packet as this WrapperPacket's data.

The given packet is copied with the Packet::makeClone method, if it is not NULL.


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