CatapultServer  v0.5.0.1 (Elephant)
catapult::ionet::PacketReader Class Reference

Public Member Functions

 PacketReader (const Packet &packet)
 Creates a reader around packet. More...
 
bool empty () const
 Returns true if the reader has consumed all data, false otherwise. More...
 
bool hasError () const
 Returns true if a reading error has been encountered, false otherwise. More...
 
template<typename TValue >
const TValue * readFixed ()
 Reads a fixed-sized value from the packet. More...
 
template<typename TEntity >
const TEntity * readVariable ()
 Reads a variable-sized value from the packet. More...
 

Private Member Functions

void require (uint32_t numBytes, const char *message)
 
void advance (uint32_t numBytes)
 
void rewind (uint32_t numBytes)
 

Private Attributes

const uint8_t * m_pData
 
uint32_t m_numRemainingBytes
 
bool m_hasError
 

Detailed Description

Stateful packet reader.

Note
Behavior is undefined if error has been encountered on any previous call.

Constructor & Destructor Documentation

◆ PacketReader()

catapult::ionet::PacketReader::PacketReader ( const Packet packet)
inlineexplicit

Creates a reader around packet.

Here is the call graph for this function:

Member Function Documentation

◆ advance()

void catapult::ionet::PacketReader::advance ( uint32_t  numBytes)
inlineprivate
Here is the caller graph for this function:

◆ empty()

bool catapult::ionet::PacketReader::empty ( ) const
inline

Returns true if the reader has consumed all data, false otherwise.

◆ hasError()

bool catapult::ionet::PacketReader::hasError ( ) const
inline

Returns true if a reading error has been encountered, false otherwise.

Here is the caller graph for this function:

◆ readFixed()

template<typename TValue >
const TValue* catapult::ionet::PacketReader::readFixed ( )
inline

Reads a fixed-sized value from the packet.

Here is the call graph for this function:

◆ readVariable()

template<typename TEntity >
const TEntity* catapult::ionet::PacketReader::readVariable ( )
inline

Reads a variable-sized value from the packet.

Here is the call graph for this function:

◆ require()

void catapult::ionet::PacketReader::require ( uint32_t  numBytes,
const char *  message 
)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rewind()

void catapult::ionet::PacketReader::rewind ( uint32_t  numBytes)
inlineprivate
Here is the caller graph for this function:

Member Data Documentation

◆ m_hasError

bool catapult::ionet::PacketReader::m_hasError
private

◆ m_numRemainingBytes

uint32_t catapult::ionet::PacketReader::m_numRemainingBytes
private

◆ m_pData

const uint8_t* catapult::ionet::PacketReader::m_pData
private

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