LibNRG  0.0.1
Networking for Real-time Games library
 All Classes Files Functions Variables Friends
nrg::Packet Class Reference

Class for storing data to be sent / received across the network.

#include <nrg_packet.h>

Inheritance diagram for nrg::Packet:
nrg::PacketReadable nrg::PacketWritable

Public Member Functions

 Packet ()
 Default Constructor.
 
 Packet (size_t initial_size)
 Constructor with explicit initial size.
 
 Packet (const Packet &copy)
 Copy Constructor.
 
Packetoperator= (const Packet &other)
 Assignment operator.
 
virtual ~Packet ()
 Standard Destructor.
 
PacketWritablewrite8 (const uint8_t &v)
 Write a uint8_t, automatically converting endianness.
 
PacketWritablewrite16 (const uint16_t &v)
 Write a uint16_t, automatically converting endianness.
 
PacketWritablewrite32 (const uint32_t &v)
 Write a uint32_t, automatically converting endianness.
 
PacketWritablewrite64 (const uint64_t &v)
 Write a uint64_t, automatically converting endianness.
 
PacketWritablewriteArray (const void *v, size_t size)
 Write an array of size size, no endian conversion is performed.
 
template<typename T >
void writeBE (const T &be_v)
 Generic write function without endian conversion, be careful with types like size_t that differ across platforms!
 
template<typename T >
void write (const T &v)
 Generic write function with endian conversion, be careful with types like size_t that differ across platforms!
 
PacketReadableread8 (uint8_t &v)
 Read a uint8_t, automatically converting endianness.
 
PacketReadableread16 (uint16_t &v)
 Read a uint16_t, automatically converting endianness.
 
PacketReadableread32 (uint32_t &v)
 Read a uint32_t, automatically converting endianness.
 
PacketReadableread64 (uint64_t &v)
 Read a uint64_t, automatically converting endianness.
 
PacketReadablereadArray (uint8_t *v, size_t size)
 Read an array of size size into v, make sure it's big enough!
 
template<typename T >
void readBE (T &be_v)
 Generic read function without endian conversion, be careful with types like size_t that differ across platforms!
 
template<typename T >
void read (T &v)
 Generic read function with endian conversion, be careful with types like size_t that differ across platforms!
 
virtual Packetreset ()
 Clears all data in the Packet.
 
Packetseek (off_t offset, int whence)
 Seeks the packet to some offset using SEEK_SET, SEEK_CUR or SEEK_END.
 
off_t tell () const
 Get the current offset of this Packet's internal pointer.
 
size_t size () const
 Get the total used-size of this packet.
 
size_t remaining () const
 Get the amount of data that can be read from the internal pointer's current position.
 
const uint8_t * getPointer () const
 Returns the internal pointer.
 
const uint8_t * getBasePointer () const
 Returns the base address of the packet's data without affecting the internal pointer.
 
- Public Member Functions inherited from nrg::PacketReadable
virtual ~PacketReadable ()
 Standard Destructor.
 
- Public Member Functions inherited from nrg::PacketWritable
virtual ~PacketWritable ()
 Standard Destructor.
 

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