All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Static Public Member Functions
GpCoreTools::ByteOrder Class Reference

Brief description of class still missing. More...

#include <ByteOrder.h>

List of all members.

Static Public Member Functions

static int bigEndianToNative (int v)
static short bigEndianToNative (const unsigned short &v)
static int littleEndianToNative (int v)
static short littleEndianToNative (const unsigned short &v)
static int swap (int v)
static short swap (const unsigned short &v)
static void swap (char &v1, char &v2)
static void swap (unsigned char &v1, unsigned char &v2)
static void swap (char *v)
static void swap (unsigned char *v)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Member Function Documentation

int GpCoreTools::ByteOrder::bigEndianToNative ( int  v) [inline, static]

References swap().

Referenced by GpCoreTools::MessageRawHeader::lengthBigEndian(), and GpCoreTools::MessageClassIdHeader::lengthBigEndian().

  {
#if BYTE_ORDER == LITTLE_ENDIAN
    return swap(v);
#else
    return v;
#endif
  }
short GpCoreTools::ByteOrder::bigEndianToNative ( const unsigned short &  v) [inline, static]

References swap().

  {
#if BYTE_ORDER == LITTLE_ENDIAN
    return swap(v);
#else
    return v;
#endif
  }
int GpCoreTools::ByteOrder::littleEndianToNative ( int  v) [inline, static]

References swap().

Referenced by GpCoreTools::MessageRawHeader::lengthLittleEndian(), and GpCoreTools::MessageClassIdHeader::lengthLittleEndian().

  {
#if BYTE_ORDER == BIG_ENDIAN
    return swap(v);
#else
    return v;
#endif
  }
short GpCoreTools::ByteOrder::littleEndianToNative ( const unsigned short &  v) [inline, static]

References swap().

  {
#if BYTE_ORDER == BIG_ENDIAN
    return swap(v);
#else
    return v;
#endif
  }
int GpCoreTools::ByteOrder::swap ( int  v) [static]

Referenced by bigEndianToNative(), GpCoreTools::MessageRawHeader::bigEndianValues(), GpCoreTools::MessageClassIdHeader::bigEndianValues(), littleEndianToNative(), GpCoreTools::MessageRawHeader::littleEndianValues(), GpCoreTools::MessageClassIdHeader::littleEndianValues(), and swap().

  {
    char * b1=reinterpret_cast<char *>(&v);
    int i;
    char * b2=reinterpret_cast<char *>(&i);
    b2[0]=b1[3];
    b2[1]=b1[2];
    b2[2]=b1[1];
    b2[3]=b1[0];
    return i;
  }
short GpCoreTools::ByteOrder::swap ( const unsigned short &  v) [static]
  {
    const char * b1=reinterpret_cast<const char *>(&v);
    short i;
    char * b2=reinterpret_cast<char *>(&i);
    b2[0]=b1[1];
    b2[1]=b1[0];
    return i;
  }
void GpCoreTools::ByteOrder::swap ( char &  v1,
char &  v2 
) [inline, static]
  {
    char tmp=v1;
    v1=v2;
    v2=tmp;
  }
void GpCoreTools::ByteOrder::swap ( unsigned char &  v1,
unsigned char &  v2 
) [inline, static]
  {
    char tmp=v1;
    v1=v2;
    v2=tmp;
  }
void GpCoreTools::ByteOrder::swap ( char *  v) [inline, static]

References swap().

  {
    swap(v[0], v[3]);
    swap(v[1], v[2]);
  }
void GpCoreTools::ByteOrder::swap ( unsigned char *  v) [inline, static]

References swap().

  {
    swap(v[0], v[3]);
    swap(v[1], v[2]);
  }

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