semf
semf::Endian Class Reference

The Endian class provides a set of functions for handeling the conversion of data with a specific endianess. More...

#include <endian.h>

Collaboration diagram for semf::Endian:
Collaboration graph

Public Member Functions

virtual ~Endian ()=default
 

Static Public Member Functions

template<typename T >
static void fromBigEndian (const void *data, size_t size, void *buffer)
 Reads size big-endian numbers from data an stores them in a native representation in buffer. More...
 
template<typename T >
static T fromBigEndian (const void *data)
 Reads a single big-endian number from the given address and returns it converted to a native type. More...
 
template<typename T >
static T fromBigEndian (T data)
 Converts the given big-endian number to a native number. More...
 
template<typename T >
static void fromLittleEndian (const void *data, size_t size, void *buffer)
 Reads size little-endian numbers from data an stores them in a native representation in buffer. More...
 
template<typename T >
static T fromLittleEndian (const void *data)
 Reads a single little-endian number from the given address and returns it converted to a native type. More...
 
template<typename T >
static T fromLittleEndian (T data)
 Converts the given little-endian number to a native number. More...
 
template<typename T >
static void toBigEndian (const void *data, size_t size, void *buffer)
 Reads size native stored numbers and converts them into big endian numbers. More...
 
template<typename T >
static void toBigEndian (T data, void *buffer)
 Converts the given number to a big-endian number and stores at the given address. More...
 
template<typename T >
static T toBigEndian (T data)
 Converts the given number to a big-endian number. More...
 
template<typename T >
static void toLittleEndian (const void *data, size_t size, void *buffer)
 Reads size native stored numbers and converts them into little-endian numbers. More...
 
template<typename T >
static void toLittleEndian (T data, void *buffer)
 Converts the given number to a little-endian number. More...
 
template<typename T >
static T toLittleEndian (T data)
 Converts the given number to a little-endian number. More...
 

Detailed Description

The Endian class provides a set of functions for handeling the conversion of data with a specific endianess.

Definition at line 36 of file endian.h.

Constructor & Destructor Documentation

◆ ~Endian()

virtual semf::Endian::~Endian ( )
virtualdefault

Member Function Documentation

◆ fromBigEndian() [1/3]

template<typename T >
T semf::Endian::fromBigEndian ( const void *  data)
static

Reads a single big-endian number from the given address and returns it converted to a native type.

Template Parameters
TNative type of the number.
Parameters
dataAddress of a big-endian number.
Returns
Converted native number.

Definition at line 169 of file endian.h.

◆ fromBigEndian() [2/3]

template<typename T >
void semf::Endian::fromBigEndian ( const void *  data,
size_t  size,
void *  buffer 
)
static

Reads size big-endian numbers from data an stores them in a native representation in buffer.

Template Parameters
TNative type of the numbers.
Parameters
dataIncomming big-endian numbers.
sizeThe count (!) of numbers.
bufferBuffer for storing the numbers.

Definition at line 147 of file endian.h.

◆ fromBigEndian() [3/3]

template<typename T >
T semf::Endian::fromBigEndian ( data)
static

Converts the given big-endian number to a native number.

Template Parameters
TNative type of the number.
Parameters
dataNumber to convert.
Returns
Converted number.

Definition at line 177 of file endian.h.

◆ fromLittleEndian() [1/3]

template<typename T >
T semf::Endian::fromLittleEndian ( const void *  data)
static

Reads a single little-endian number from the given address and returns it converted to a native type.

Template Parameters
TNative type of the number.
Parameters
dataAddress of a little-endian number.
Returns
Converted native number.

Definition at line 205 of file endian.h.

◆ fromLittleEndian() [2/3]

template<typename T >
void semf::Endian::fromLittleEndian ( const void *  data,
size_t  size,
void *  buffer 
)
static

Reads size little-endian numbers from data an stores them in a native representation in buffer.

Template Parameters
TNative type of the numbers.
Parameters
dataIncomming little-endian numbers.
sizeThe count (!) of numbers.
bufferBuffer for storing the numbers.

Definition at line 183 of file endian.h.

◆ fromLittleEndian() [3/3]

template<typename T >
T semf::Endian::fromLittleEndian ( data)
static

Converts the given little-endian number to a native number.

Template Parameters
TNative type of the number.
Parameters
dataNumber to convert.
Returns
Converted number.

Definition at line 213 of file endian.h.

◆ toBigEndian() [1/3]

template<typename T >
void semf::Endian::toBigEndian ( const void *  data,
size_t  size,
void *  buffer 
)
static

Reads size native stored numbers and converts them into big endian numbers.

Template Parameters
TNative type of the number.
Parameters
dataIncomming native numbers.
sizeCount (!) of native numbers.
bufferBuffer for storing the converted numbers.

Definition at line 219 of file endian.h.

◆ toBigEndian() [2/3]

template<typename T >
T semf::Endian::toBigEndian ( data)
static

Converts the given number to a big-endian number.

Template Parameters
TNative type of the number.
Parameters
dataNumber to convert.
Returns
Converted number.

Definition at line 231 of file endian.h.

◆ toBigEndian() [3/3]

template<typename T >
void semf::Endian::toBigEndian ( data,
void *  buffer 
)
static

Converts the given number to a big-endian number and stores at the given address.

Template Parameters
TNative type of the number.
Parameters
dataNumber to convert.
bufferBuffer for storing.

Definition at line 225 of file endian.h.

◆ toLittleEndian() [1/3]

template<typename T >
void semf::Endian::toLittleEndian ( const void *  data,
size_t  size,
void *  buffer 
)
static

Reads size native stored numbers and converts them into little-endian numbers.

Template Parameters
TNative type of the number.
Parameters
dataIncomming native numbers.
sizeCount (!) of native numbers.
bufferBuffer for storing the converted numbers.

Definition at line 239 of file endian.h.

◆ toLittleEndian() [2/3]

template<typename T >
T semf::Endian::toLittleEndian ( data)
static

Converts the given number to a little-endian number.

Template Parameters
TNative type of the number.
Parameters
dataNumber to convert.
Returns
Converted number.

Definition at line 251 of file endian.h.

◆ toLittleEndian() [3/3]

template<typename T >
void semf::Endian::toLittleEndian ( data,
void *  buffer 
)
static

Converts the given number to a little-endian number.

Template Parameters
TNative type of the number.
Parameters
dataNumber to convert.
bufferBuffer for storing.

Definition at line 245 of file endian.h.