ByteOrder Class Reference

Byte-order conversion routines. More...

#include <ByteOrder.h++>

List of all members.

Static Public Member Functions

static uint16_t hostToNetwork (uint16_t n) throw ()
 Convert an unsigned 16-bit integer from host to network byte-order.
static uint32_t hostToNetwork (uint32_t n) throw ()
 Convert an unsigned 32-bit integer from host to network byte-order.
static uint64_t hostToNetwork (uint64_t n) throw ()
 Convert an unsigned 64-bit integer from host to network byte-order.
static uint16_t networkToHost (uint16_t n) throw ()
 Convert an unsigned 16-bit integer from network to host byte-order.
static uint32_t networkToHost (uint32_t n) throw ()
 Convert an unsigned 32-bit integer from network to host byte-order.
static uint64_t networkToHost (uint64_t n) throw ()
 Convert an unsigned 64-bit integer from network to host byte-order.
static bool isBigEndian () throw ()
 Determine if the host system is big-endian.
static bool isLittleEndian () throw ()
 Determine if the host system is little-endian.
static Endianness getEndianness () throw ()
 Get the endianness of the host system.
template<typename T >
static T & reverseBytes (T &value) throw ()
 Reverse the bytes in a value.


Detailed Description

Byte-order conversion routines.

Author:
Mark Lindner

Member Function Documentation

static Endianness getEndianness (  )  throw () [inline, static]

Get the endianness of the host system.

Returns:
The endianness.

uint64_t hostToNetwork ( uint64_t  n  )  throw () [static]

Convert an unsigned 64-bit integer from host to network byte-order.

static uint32_t hostToNetwork ( uint32_t  n  )  throw () [inline, static]

Convert an unsigned 32-bit integer from host to network byte-order.

static uint16_t hostToNetwork ( uint16_t  n  )  throw () [inline, static]

Convert an unsigned 16-bit integer from host to network byte-order.

bool isBigEndian (  )  throw () [static]

Determine if the host system is big-endian.

Returns:
true if the host system is big-endian, false otherwise.

static bool isLittleEndian (  )  throw () [inline, static]

Determine if the host system is little-endian.

Returns:
true if the host system is little-endian, false otherwise.

uint64_t networkToHost ( uint64_t  n  )  throw () [static]

Convert an unsigned 64-bit integer from network to host byte-order.

static uint32_t networkToHost ( uint32_t  n  )  throw () [inline, static]

Convert an unsigned 32-bit integer from network to host byte-order.

static uint16_t networkToHost ( uint16_t  n  )  throw () [inline, static]

Convert an unsigned 16-bit integer from network to host byte-order.

static T& reverseBytes ( T &  value  )  throw () [inline, static]

Reverse the bytes in a value.

This method may be used to toggle the endianness of an arbitrary value.

Parameters:
value The value.
Returns:
The value.


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

Generated on Sat Apr 17 23:03:08 2010 for libcommonc++ by  doxygen 1.5.9