LibUDB 1.0
Loading...
Searching...
No Matches
ByteOrder Class Reference

The ByteOrder class. More...

#include <ByteOrder.h>

Public Member Functions

 ByteOrder (const ByteOrder &other)
 ByteOrder (uint64_t val)
 ByteOrder (uint32_t val)
 ByteOrder (uint16_t val)
 ByteOrder (int64_t val)
 ByteOrder (int32_t val)
 ByteOrder (int16_t val)
 ByteOrder (float val)
 ByteOrder (double val)
ByteOrderoperator= (const ByteOrder &other)
 operator =
ByteOrderoperator= (const uint64_t &val)
 operator =
ByteOrderoperator= (const uint32_t &val)
 operator =
ByteOrderoperator= (const uint16_t &val)
 operator =
ByteOrderoperator= (const int64_t &val)
 operator =
ByteOrderoperator= (const int32_t &val)
 operator =
ByteOrderoperator= (const int16_t &val)
 operator =
ByteOrderoperator= (const float &val)
 operator =
ByteOrderoperator= (const double &val)
 operator =
 operator uint64_t ()
 operator uint64_t
 operator uint32_t ()
 operator uint32_t
 operator uint16_t ()
 operator uint16_t
 operator int64_t ()
 operator int64_t
 operator int32_t ()
 operator int32_t
 operator int16_t ()
 operator int16_t
 operator float ()
 operator float
 operator double ()
 operator double
template<typename T>
void getNative (T &result)
template<typename T>
void getBig (T &result)
template<typename T>
void getLittle (T &result)
template<typename T>
void setBig (T val)
template<typename T>
void setLittle (T val)

Detailed Description

The ByteOrder class.

This class contains methods for converting numbers between different byte orders.

Warning
Input and output variables must have same type.

Constructor & Destructor Documentation

◆ ByteOrder() [1/9]

ByteOrder::ByteOrder ( const ByteOrder & other)

Copy constructor.

Parameters
otherByteOrder object to be copied.

◆ ByteOrder() [2/9]

ByteOrder::ByteOrder ( uint64_t val)

ByteOrder constructor.

Parameters
valuint64_t value in native byte order.

◆ ByteOrder() [3/9]

ByteOrder::ByteOrder ( uint32_t val)

ByteOrder constructor.

Parameters
valuint32_t value in native byte order.

◆ ByteOrder() [4/9]

ByteOrder::ByteOrder ( uint16_t val)

ByteOrder constructor.

Parameters
valuint16_t value in native byte order.

◆ ByteOrder() [5/9]

ByteOrder::ByteOrder ( int64_t val)

ByteOrder constructor.

Parameters
valint64_t value in native byte order.

◆ ByteOrder() [6/9]

ByteOrder::ByteOrder ( int32_t val)

ByteOrder constructor.

Parameters
valint32_t value in native byte order.

◆ ByteOrder() [7/9]

ByteOrder::ByteOrder ( int16_t val)

ByteOrder constructor.

Parameters
valint16_t value in native byte order.

◆ ByteOrder() [8/9]

ByteOrder::ByteOrder ( float val)

ByteOrder constructor.

Parameters
valfloat value in native byte order.

◆ ByteOrder() [9/9]

ByteOrder::ByteOrder ( double val)

ByteOrder constructor.

Parameters
valdouble value in native byte order.

Member Function Documentation

◆ getBig()

template<typename T>
void ByteOrder::getBig ( T & result)

Copies internal variable to result variable in 'big endian' byte order.

Parameters
resultVariable to be set to 'big endian' byte order.

◆ getLittle()

template<typename T>
void ByteOrder::getLittle ( T & result)

Copies internal variable to result variable in 'little endian' byte order.

Parameters
resultVariable to be set to 'little endian' byte order.

◆ getNative()

template<typename T>
void ByteOrder::getNative ( T & result)

Copies internal variable to result variable in native byte order.

Parameters
resultVariable to be set to native byte order.

◆ operator double()

ByteOrder::operator double ( )

operator double

Returns double in native byte order.

◆ operator float()

ByteOrder::operator float ( )

operator float

Returns float in native byte order.

◆ operator int16_t()

ByteOrder::operator int16_t ( )

operator int16_t

Returns int16_t in native byte order.

◆ operator int32_t()

ByteOrder::operator int32_t ( )

operator int32_t

Returns int32_t in native byte order.

◆ operator int64_t()

ByteOrder::operator int64_t ( )

operator int64_t

Returns int64_t in native byte order.

◆ operator uint16_t()

ByteOrder::operator uint16_t ( )

operator uint16_t

Returns uint16_t in native byte order.

◆ operator uint32_t()

ByteOrder::operator uint32_t ( )

operator uint32_t

Returns uint32_t in native byte order.

◆ operator uint64_t()

ByteOrder::operator uint64_t ( )

operator uint64_t

Returns uint64_t in native byte order.

◆ operator=() [1/9]

ByteOrder & ByteOrder::operator= ( const ByteOrder & other)

operator =

Parameters
otherByteOrder object to be copied.
Returns
Reference to ByteOrder object.

◆ operator=() [2/9]

ByteOrder & ByteOrder::operator= ( const double & val)

operator =

Parameters
valdouble value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [3/9]

ByteOrder & ByteOrder::operator= ( const float & val)

operator =

Parameters
valfloat value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [4/9]

ByteOrder & ByteOrder::operator= ( const int16_t & val)

operator =

Parameters
valint16_t value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [5/9]

ByteOrder & ByteOrder::operator= ( const int32_t & val)

operator =

Parameters
valint32_t value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [6/9]

ByteOrder & ByteOrder::operator= ( const int64_t & val)

operator =

Parameters
valint64_t value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [7/9]

ByteOrder & ByteOrder::operator= ( const uint16_t & val)

operator =

Parameters
valuint16_t value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [8/9]

ByteOrder & ByteOrder::operator= ( const uint32_t & val)

operator =

Parameters
valuint32_t value in native byte order.
Returns
Reference to ByteOrder object.

◆ operator=() [9/9]

ByteOrder & ByteOrder::operator= ( const uint64_t & val)

operator =

Parameters
valuint64_t value in native byte order.
Returns
Reference to ByteOrder object.

◆ setBig()

template<typename T>
void ByteOrder::setBig ( T val)

Converts and copies 'big endian' val variable to internal variable.

Parameters
val'Big endian' value.

◆ setLittle()

template<typename T>
void ByteOrder::setLittle ( T val)

Converts and copies 'little endian' val variable to internal variable.

Parameters
val'Little endian' value.