GNE
0.75.0
|
The three ObjectBrokerPackets are all identical except for their packet IDs. More...
#include <ObjectBrokerPacket.h>
Public Types | |
typedef SmartPtr < ObjectBrokerPacket > | sptr |
typedef WeakPtr < ObjectBrokerPacket > | wptr |
![]() | |
typedef SmartPtr< WrapperPacket > | sptr |
typedef WeakPtr< WrapperPacket > | wptr |
![]() | |
typedef SmartPtr< Packet > | sptr |
typedef WeakPtr< Packet > | wptr |
Public Member Functions | |
ObjectBrokerPacket (int packetId, int objectId, const Packet *data) | |
Initializes a new ObjectBrokerPacket. | |
ObjectBrokerPacket (const ObjectBrokerPacket &o) | |
Initializes a new ObjectBrokerPacket from the given one. | |
int | getObjectId () const |
Returns the object ID. | |
void | setObjectId (int newId) |
Sets the object ID for this packet. | |
virtual int | getSize () const |
Returns the current size of this packet in bytes. | |
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. | |
![]() | |
const Packet * | getData () const |
Returns the encapsulated data in this WrapperPacket. | |
Packet * | getData () |
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. | |
WrapperPacket & | operator= (const WrapperPacket &rhs) |
Copies the given WrapperPacket into this one. | |
![]() | |
Packet * | makeClone () 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 | |
ObjectBrokerPacket (int id) | |
This ctor is suitable for use only in the create method. | |
![]() | |
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. | |
![]() | |
Packet (int id) | |
Constructs a packet with the given ID. | |
Packet (const Packet &o) | |
Copy constructor. | |
Packet & | operator= (const Packet &rhs) |
Copy operator you can use to help you in creating your own. |
The three ObjectBrokerPackets are all identical except for their packet IDs.
This base class abstracts the common functionality.
GNE::ObjectBrokerPacket::ObjectBrokerPacket | ( | int | packetId, |
int | objectId, | ||
const Packet * | data | ||
) |
Initializes a new ObjectBrokerPacket.
The given Packet is copied, if it not NULL. ObjectCreationPacket and ObjectUpdatePacket require a passed packet, but ObjectDeathPacket does not.
void GNE::ObjectBrokerPacket::setObjectId | ( | int | newId | ) |
Sets the object ID for this packet.
the | new ID, in the range of [0..65535] (inclusive). |