The Nebula Device 3: System::ByteOrder Class Reference

The Nebula Device 3

System::ByteOrder Class Reference

#include <byteorder.h>


Detailed Description

Provides information and methods to help with byte ordering issues.

The following byte orders are defined:

  • ByteOrder::LittleEndian: Intel byte order
  • ByteOrder::BigEndian: Motorola byte order
  • ByteOrder::Network network byte order (always big endian)
  • ByteOrder::Host hardwired to little or big endian depending on host cpu

NOTE: on console-platforms it is strongly recommended to store binary data in console-byte-order during asset processing on the development PC, so that the console doesn't waste loading time with byte conversions!

(C) 2007 Radon Labs GmbH

Public Member Functions

 ByteOrder ()
 default constructor
 ByteOrder (Type fromByteOrder, Type toByteOrder)
 constructor: set byte order conversion rule
void SetFromByteOrder (Type fromByteOrder)
 set from-byte-order
Type GetFromByteOrder () const
 get from-byte-order
void SetToByteOrder (Type toByteOrder)
 set to-byte-order
Type GetToByteOrder () const
 get to-byte-order
template<class TYPE>
void ConvertInPlace (TYPE &val) const
 endian-convert in place
template<class TYPE>
TYPE Convert (TYPE val) const
 endian-convert by copy

Static Public Member Functions

template<class TYPE>
static void ConvertInPlace (Type fromByteOrder, Type toByteOrder, TYPE &val)
 endian-convert in place
template<class TYPE>
static TYPE Convert (Type fromByteOrder, Type toByteOrder, TYPE val)
 endian-convert by copy