STIR
6.2.0
|
This class provides member functions to find out what byte-order your machine is and to swap numbers. More...
#include "stir/ByteOrder.h"
Public Types | |
enum | Order { little_endian, big_endian, native, swapped } |
enum for specifying the byte-order More... | |
Public Member Functions | |
ByteOrder (Order byte_order=native) | |
constructor, defaulting to 'native' byte order | |
bool | operator== (const ByteOrder order2) const |
comparison operator More... | |
bool | operator!= (const ByteOrder order2) const |
bool | is_native_order () const |
check if the object refers to the native order. | |
template<class NUMBER > | |
void | swap_if_necessary (NUMBER &a) const |
this swaps only when the order != native order | |
Static Public Member Functions | |
static Order | get_native_order () |
returns the byte-order native to the machine the programme is running on. More... | |
template<class NUMBER > | |
static void | swap_order (NUMBER &value) |
swap the byteorder of the argument | |
This class provides member functions to find out what byte-order your machine is and to swap numbers.
In a little-endian architecture, within a given 16- or 32-bit word, bytes at lower addresses have lower significance (the word is stored `little-end-first'). (Quoted from http://www.techfak.uni-bielefeld.de/~joern/jargon/)
|
inlinestatic |
returns the byte-order native to the machine the programme is running on.
for efficiency, this refers to the static member native_order.
Referenced by stir::ecat::CListModeDataECAT8_32bit::get_empty_record_sptr(), is_native_order(), stir::CListModeDataSAFIR< CListRecordT >::reset(), and stir::ProjDataFromStream::set_segment().
|
inline |
comparison operator
This takes care of interpreting 'native' and 'swapped'.
References is_native_order().