Proud::CMessage Class Reference
Inheritance diagram for Proud::CMessage:

Public Member Functions

bool IsSimplePacketMode () const
 
 CMessage (const CMessage &src)
 
bool DataEquals (const CMessage &rhs)
 
bool Read (uint8_t *data, int count)
 
template<typename POD >
bool Read_POD (POD *data)
 
bool CanRead (int count)
 
void Write (const uint8_t *data, int count)
 
template<typename POD >
void Write_POD (const POD *data)
 
void CopyFromArrayAndResetReadOffset (const uint8_t *src, int srcLength)
 
void SetReadOffset (int offset)
 
void SetSimplePacketMode (bool isSimplePacketMode)
 
void SetLength (int count)
 
int GetWriteOffset ()
 
bool Read_NoTestSplitter (uint8_t *data, int count)
 
template<typename POD >
bool Read_NoTestSplitter_POD (POD *data)
 
bool CanRead_NoTestSplitter (int count)
 
void Write_NoTestSplitter (const uint8_t *data, int count)
 
template<typename POD >
void Write_NoTestSplitter_POD (const POD *data)
 
void AdjustWriteOffsetByteAlign ()
 
bool ReadWithShareBuffer (CMessage &output, int length)
 
void Write (bool b)
 
void Write (int8_t b)
 
void Write (uint8_t b)
 
void Write (int16_t b)
 
void Write (uint16_t b)
 
void Write (int32_t b)
 
void Write (uint32_t b)
 
void Write (int64_t b)
 
void Write (uint64_t b)
 
void Write (float b)
 
void Write (double b)
 
void Write (HostID b)
 
void Write (const AddrPort &b)
 
bool Read (AddrPort &b)
 
bool Read (ByteArray &b)
 
void Write (const ByteArray &b)
 
void Write (ByteArrayPtr b)
 
bool Read (ByteArrayPtr &b)
 
bool ReadScalar (int64_t &a)
 
bool ReadScalar (int32_t &a)
 
bool ReadScalar (int16_t &a)
 
bool ReadScalar (int8_t &a)
 
bool ReadScalar (uint64_t &a)
 
bool ReadScalar (uint32_t &a)
 
bool ReadScalar (uint16_t &a)
 
bool ReadScalar (uint8_t &a)
 
void WriteScalar (int64_t a)
 
void WriteScalar (int32_t a)
 
void WriteScalar (int16_t a)
 
void WriteScalar (int8_t a)
 
void WriteScalar (uint64_t a)
 
void WriteScalar (uint32_t a)
 
void WriteScalar (uint16_t a)
 
void WriteScalar (uint8_t a)
 
bool Read (bool &b)
 
bool Read (int8_t &b)
 
bool Read (uint8_t &b)
 
bool Read (int16_t &b)
 
bool Read (uint16_t &b)
 
bool Read (int32_t &b)
 
bool Read (uint32_t &b)
 
bool Read (int64_t &b)
 
bool Read (uint64_t &b)
 
bool Read (float &b)
 
bool Read (double &b)
 
void Write (const Guid &b)
 
bool Read (Guid &b)
 
bool Read (HostID &b)
 
void Write (NamedAddrPort n)
 
bool Read (NamedAddrPort &n)
 
int GetLength () const
 
int GetReadOffset () const
 
void AppendByteArray (const uint8_t *fragment, int fragmentLength)
 
uint8_t * GetData ()
 
const uint8_t * GetData () const
 
template<typename BYTEARRAY >
void CopyToT (BYTEARRAY &dest)
 
void CopyTo (ByteArray &dest)
 
void CopyTo (ByteArrayPtr &dest)
 
void CopyTo (CMessage &dest)
 
void Clear ()
 
void ShareFromAndResetReadOffset (ByteArrayPtr data)
 
void UseExternalBuffer (uint8_t *buf, int capacity)
 
void UseInternalBuffer ()
 
void UninitBuffer ()
 
bool SkipRead (int count)
 읽은 것처럼 구라친다.
 
void WriteString (const char *str)
 
void WriteString (const wchar_t *str)
 
void WriteString (const Proud::StringA &str)
 
void WriteString (const Proud::StringW &str)
 
void WriteString (const std::string &str)
 
void WriteString (const std::wstring &str)
 
bool ReadString (Proud::StringA &str)
 
bool ReadString (Proud::StringW &str)
 
bool ReadString (std::string &str)
 
bool ReadString (std::wstring &str)
 
PROUD_API bool ReadStringA (Proud::StringA &str)
 
PROUD_API bool ReadStringW (Proud::StringW &str)
 
PROUD_API void WriteStringA (const char *str)
 
PROUD_API void WriteStringW (const wchar_t *str)
 
bool ReadVariant (NetVariant &var)
 
void WriteVariant (const NetVariant &var)
 

Static Public Member Functions

template<typename T , bool RAWTYPE, typename COLLT >
static bool ReadArrayT (CMessage &a, COLLT &b)
 
template<typename T , bool RAWTYPE, typename COLLT >
static void WriteArrayT (CMessage &a, const COLLT &b)
 

Public Attributes

ByteArrayPtr m_msgBuffer
 

Friends

void AdjustReadOffsetByteAlign (CMessage &msg)
 
void AssureReadOffsetByteAlign (CMessage &msg)
 

Detailed Description

Message class. For detailed information, refer to Message Object(Proud.CMessage)

Member Function Documentation

int Proud::CMessage::GetLength ( ) const
inline

Gets the length of message

int Proud::CMessage::GetReadOffset ( ) const
inline

Calculates current read point of message. The return value is in byte.

bool Proud::CMessage::Read ( uint8_t *  data,
int  count 
)
inline

Read data from the message.

Parameters
dataWhere the read data will be stored.
countByte unit size of the data
Returns
True if successfully read as the count
bool Proud::CMessage::Read ( bool &  b)
inline

Additionally writes data to message object Suuports various types including bool type

Returns
True if successful in thorough reading
bool Proud::CMessage::ReadScalar ( int64_t &  a)
inline

Reads with scalar compression technique

bool Proud::CMessage::ReadString ( Proud::StringA str)
inline

Read string

bool Proud::CMessage::ReadString ( Proud::StringW str)
inline

Read string

bool Proud::CMessage::ReadString ( std::string &  str)
inline

Read string

bool Proud::CMessage::ReadString ( std::wstring &  str)
inline

Read string

bool Proud::CMessage::ReadWithShareBuffer ( CMessage output,
int  length 
)
inline

Make the memory buffer of this object as if the output reads as much as the size of the length, the output should be made to refer the buffer of this object. This is the function used for performance.

void Proud::CMessage::SetLength ( int  count)
inline

Set the current size of the message.

void Proud::CMessage::SetReadOffset ( int  offset)
inline

Read point is forcibly adjusted. It is in bytes.

bool Proud::CMessage::SkipRead ( int  count)
inline

읽은 것처럼 구라친다.

Add count to the data size read currently.

void Proud::CMessage::UninitBuffer ( )
inline

Completely resets the void UseExternalBuffer(BYTE* buf, int capacity)r

  • This must be called in order to re-use UseExternalBuffer and UseInternalBuffer. The reasone why this kind of method exists is to prevent for user to make mistakes.
  • After this method is called, the size of read offset and message will be initialized.
void Proud::CMessage::UseExternalBuffer ( uint8_t *  buf,
int  capacity 
)
inline

Declare to use an external buffer

Parameters
bufExternal buffer pointer
capacitySize of an external buffer
void Proud::CMessage::UseInternalBuffer ( )
inline

Declares to use internal buffer

void Proud::CMessage::Write ( const uint8_t *  data,
int  count 
)
inline

Record data in the message

void Proud::CMessage::Write ( bool  b)
inline

Additionally record the data in the message object. It supports not only Boolean type but also various types.

void Proud::CMessage::WriteScalar ( int64_t  a)
inline

Writes with scalar compression technique

void Proud::CMessage::WriteString ( const char *  str)
inline

Write string

void Proud::CMessage::WriteString ( const wchar_t *  str)
inline

Write string

void Proud::CMessage::WriteString ( const Proud::StringA str)
inline

Write string

void Proud::CMessage::WriteString ( const Proud::StringW str)
inline

Write string

void Proud::CMessage::WriteString ( const std::string &  str)
inline

Write string

void Proud::CMessage::WriteString ( const std::wstring &  str)
inline

Write string