Proud::CMessage 클래스 참조
Proud::CMessage에 대한 상속 다이어그램 :

Public 멤버 함수

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)
 
bool ReadStringA (Proud::StringA &str)
 
bool ReadStringW (Proud::StringW &str)
 
void WriteStringA (const char *str)
 
void WriteStringW (const wchar_t *str)
 
void WriteBits (uint8_t *src, int srcBitLength)
 
bool ReadBits (uint8_t *output, int outputBitLength)
 
bool ReadBits (bool &output, int outputBitLength)
 
void WriteBits (bool src, int srcBitLength)
 
bool ReadBits (int8_t &output, int outputBitLength)
 
void WriteBits (int8_t src, int srcBitLength)
 
bool ReadBits (uint8_t &output, int outputBitLength)
 
void WriteBits (uint8_t src, int srcBitLength)
 
bool ReadBits (int16_t &output, int outputBitLength)
 
void WriteBits (int16_t src, int srcBitLength)
 
bool ReadBits (uint16_t &output, int outputBitLength)
 
void WriteBits (uint16_t src, int srcBitLength)
 
bool ReadBits (int32_t &output, int outputBitLength)
 
void WriteBits (int32_t src, int srcBitLength)
 
bool ReadBits (uint32_t &output, int outputBitLength)
 
void WriteBits (uint32_t src, int srcBitLength)
 
bool ReadBits (float &output, int outputBitLength)
 
void WriteBits (float src, int srcBitLength)
 
bool ReadBits (double &output, int outputBitLength)
 
void WriteBits (double src, int srcBitLength)
 

정적 Public 멤버 함수

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 속성

ByteArrayPtr m_msgBuffer
 

Friends

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

상세한 설명

메시지 클래스. 자세한 내용은 메시지 객체(Proud.CMessage)를 참고.

멤버 함수 문서화

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

메시지의 길이를 얻는다.

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

메시지의 현재 읽기 지점을 구한다. 리턴값은 바이트 단위다.

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

메시지로부터 데이터를 읽는다.

매개변수
data읽은 데이터가 저장될 곳
countdata의 바이트 단위 크기
반환값
count만큼 성공적으로 읽었으면 true.
bool Proud::CMessage::Read ( bool &  b)
inline

메시지 객체에 데이터를 추가 기록한다. bool 타입 뿐만 아니라 다양한 타입을 지원한다.

반환값
완전히 읽는데 성공하면 true
bool Proud::CMessage::ReadBits ( uint8_t *  output,
int  outputBitLength 
)
inline

bitCount만큼의 비트 데이터를 읽어들인다.

반환값
읽는데 성공하면 true를 리턴한다. 읽을 bit가 모자라면 false를 리턴.
  • 만약 앞서 bit를 읽던 중이라 bit offset > 0인 경우 사용 가능한 잔여 비트에 이어서 읽는다.
  • 만약 bit offset>0인 상태에서 Read()로 인해 byte 단위 읽기를 할 경우 잔여 비트는 무시되고 새 바이트에서 읽기가 재개된다. 즉 byte assign으로 조정된다. 따라서 효과적인 비트 사용을 위해서 비트 필드과 비트가 아닌 필드를 끼리끼리 모아서 읽기/쓰기를 해야 한다.
bool Proud::CMessage::ReadScalar ( int64_t &  a)
inline

scalar compression 기법으로 값을 읽는다.

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

문자열 꺼내기

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

문자열 꺼내기

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

문자열 꺼내기

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

문자열 꺼내기

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

이 객체의 메모리 버퍼를 output이 length 크기만큼 읽어가는 양상으로 만들되, output은 외부로서 이 객체의 버퍼를 참조하도록 만든다. 성능을 위해 사용되는 함수다.

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

메시지의 현재 크기를 설정한다.

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

읽기 지점을 강제 조정한다. 바이트 단위이다.

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

읽은 것처럼 구라친다.

현재 읽은 데이터 크기에 count를 더한다.

void Proud::CMessage::UninitBuffer ( )
inline

사용하던 버퍼를 완전히 리셋하고, 새로 외부 또는 내부 버퍼를 사용하도록 선언한다.

  • UseExternalBuffer, UseInternalBuffer를 재사용하려면 반드시 이것을 호출해야 한다. 이러한 메서드가 따로 있는 이유는 사용자가 실수하는 것을 방지하기 위해서다.
  • 이 메서드 호출 후에는 read offset과 메시지 크기가 초기화된다.
void Proud::CMessage::UseExternalBuffer ( uint8_t *  buf,
int  capacity 
)
inline

외부 버퍼를 사용하도록 선언한다.

매개변수
buf외부 버퍼 포인터
capacity외부 버퍼의 크기
void Proud::CMessage::UseInternalBuffer ( )
inline

내부 버퍼를 사용하도록 선언한다.

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

메시지에 데이터를 기록한다.

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

메시지 객체에 데이터를 추가 기록한다. bool 타입 뿐만 아니라 다양한 타입을 지원한다.

void Proud::CMessage::WriteBits ( uint8_t *  src,
int  srcBitLength 
)
inline

bitCount 만큼의 비트 데이터를 기록한다.

  • 만약 앞서 bit를 기록하던 중이라 bit offset > 0인 경우 사용 가능한 잔여 비트에 이어서 기록된다.
  • 만약 bit offset > 0인 상태에서 Write()로 인해 byte 단위 쓰기를 할 경우 잔여 비트는 무시되고 새 바이트에서 쓰기가 재개된다. 즉 byte assign으로 조정된다. 따라서 효과적인 비트 사용을 위해서 비트 필드과 비트가 아닌 필드를 끼리끼리 모아서 읽기/쓰기를 해야 한다.
void Proud::CMessage::WriteScalar ( int64_t  a)
inline

scalar compression 기법으로 값을 기록한다.

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

문자열 넣기

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

문자열 넣기

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

문자열 넣기

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

문자열 넣기

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

문자열 넣기

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

문자열 넣기