All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Types | Public Member Functions | Protected Attributes
GpCoreTools::MessageRawHeader Class Reference

Brief description of class still missing. More...

#include <MessageRawHeader.h>

List of all members.

Public Types

enum  { SynchronizationSize = 2, HeaderSize = 2, CheckSumSize = 2 }

Public Member Functions

void bigEndianValues ()
const char * header () const
bool isValid () const
bool isValid (const FletcherChecksum &cksum, const char *payload=0, unsigned short payloadLength=0) const
unsigned int lengthBigEndian () const
unsigned int lengthLittleEndian () const
void littleEndianValues ()
 MessageRawHeader ()
 MessageRawHeader (unsigned int length)
 MessageRawHeader (const MessageRawHeader &o)

Protected Attributes

union {
   char   _bytes [HeaderSize]
   struct {
      unsigned short   length
   }   _values
}; 
unsigned char _sync [2]

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Enumeration Documentation

anonymous enum
Enumerator:
SynchronizationSize 
HeaderSize 
CheckSumSize 

Constructor & Destructor Documentation

{}
GpCoreTools::MessageRawHeader::MessageRawHeader ( unsigned int  length) [inline]

References _sync, _values, and length.

  {
    _sync[0]=0xB5;
    _sync[1]=0x62;
    _values.length=length;
  }

References _sync, and _values.

  {
    _sync[0]=o._sync[0];
    _sync[1]=o._sync[1];
    _values.length=o._values.length;
  }

Member Function Documentation

References _bytes, and GpCoreTools::ByteOrder::swap().

  {
#if BYTE_ORDER==LITTLE_ENDIAN
    ByteOrder::swap(_bytes[0], _bytes[1]);
#endif
  }
const char* GpCoreTools::MessageRawHeader::header ( ) const [inline]

Referenced by isValid().

{return _bytes;}
bool GpCoreTools::MessageRawHeader::isValid ( ) const [inline]
bool GpCoreTools::MessageRawHeader::isValid ( const FletcherChecksum cksum,
const char *  payload = 0,
unsigned short  payloadLength = 0 
) const [inline]

References GpCoreTools::FletcherChecksum::add(), header(), and HeaderSize.

  {
    FletcherChecksum mycs;
    mycs.add(reinterpret_cast<const char *>(header()), HeaderSize);
    if(payload) {
      mycs.add(payload, payloadLength);
    }
    return cksum==mycs;
  }
unsigned int GpCoreTools::MessageRawHeader::lengthBigEndian ( ) const [inline]
unsigned int GpCoreTools::MessageRawHeader::lengthLittleEndian ( ) const [inline]

References _bytes, and GpCoreTools::ByteOrder::swap().

Referenced by GpCoreTools::ScreenClient::write().

  {
#if BYTE_ORDER==BIG_ENDIAN
    ByteOrder::swap(_bytes[0], _bytes[1]);
#endif
  }

Member Data Documentation

union { ... } [protected]
unsigned char GpCoreTools::MessageRawHeader::_sync[2] [protected]

Referenced by MessageRawHeader().

Referenced by MessageRawHeader().

Referenced by MessageRawHeader().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines