DUNE: Uniform Navigational Environment  2016.05.0
DUNE::Utils::ByteCopy Class Reference

Static Public Member Functions

static uint16_t toBE (uint16_t n)
 
static int16_t toBE (int16_t n)
 
static uint32_t toBE (uint32_t n)
 
static int32_t toBE (int32_t n)
 
static uint32_t fromBE (uint32_t n)
 
static int32_t fromBE (int32_t n)
 
static uint16_t fromBE (uint16_t n)
 
static int16_t fromBE (int16_t n)
 
static uint16_t fromBE (uint8_t *n)
 
template<typename T >
static uint16_t fromBE (T &var, const uint8_t *bfr)
 
template<typename T >
static uint16_t fromLE (T &var, const uint8_t *bfr)
 
static uint16_t copy1b (uint8_t *dest, const uint8_t *src)
 
static uint16_t copy2b (uint8_t *dest, const uint8_t *src)
 
static uint16_t copy4b (uint8_t *dest, const uint8_t *src)
 
static uint16_t copy8b (uint8_t *dest, const uint8_t *src)
 
static uint16_t rcopy1b (uint8_t *dest, const uint8_t *src)
 
static uint16_t rcopy2b (uint8_t *dest, const uint8_t *src)
 
static uint16_t rcopy4b (uint8_t *dest, const uint8_t *src)
 
static uint16_t rcopy8b (uint8_t *dest, const uint8_t *src)
 
static uint16_t copy (int8_t &dest, const uint8_t *src)
 
static uint16_t copy (uint8_t &dest, const uint8_t *src)
 
static uint16_t copy (int16_t &dest, const uint8_t *src)
 
static uint16_t copy (uint16_t &dest, const uint8_t *src)
 
static uint16_t copy (int32_t &dest, const uint8_t *src)
 
static uint16_t copy (uint32_t &dest, const uint8_t *src)
 
static uint16_t copy (fp32_t &dest, const uint8_t *src)
 
static uint16_t copy (fp64_t &dest, const uint8_t *src)
 
static uint16_t rcopy (int8_t &dest, const uint8_t *src)
 
static uint16_t rcopy (uint8_t &dest, const uint8_t *src)
 
static uint16_t rcopy (int16_t &dest, const uint8_t *src)
 
static uint16_t rcopy (uint16_t &dest, const uint8_t *src)
 
static uint16_t rcopy (int32_t &dest, const uint8_t *src)
 
static uint16_t rcopy (uint32_t &dest, const uint8_t *src)
 
static uint16_t rcopy (fp32_t &dest, const uint8_t *src)
 
static uint16_t rcopy (fp64_t &dest, const uint8_t *src)
 
static unsigned toLE (const uint8_t value, uint8_t *dst)
 
static unsigned toLE (const int8_t value, uint8_t *dst)
 
static unsigned toLE (const uint16_t value, uint8_t *dst)
 
static unsigned toLE (const int16_t value, uint8_t *dst)
 
static unsigned toLE (const uint32_t value, uint8_t *dst)
 
static unsigned toLE (const int32_t value, uint8_t *dst)
 
static unsigned toBE (const uint8_t value, uint8_t *dst)
 
static unsigned toBE (const int8_t value, uint8_t *dst)
 
static unsigned toBE (const uint16_t value, uint8_t *dst)
 
static unsigned toBE (const int16_t value, uint8_t *dst)
 
static unsigned toBE (const uint32_t value, uint8_t *dst)
 
static unsigned toBE (const int32_t value, uint8_t *dst)
 
static unsigned toBE (const float value, uint8_t *dst)
 

Member Function Documentation

static uint16_t DUNE::Utils::ByteCopy::copy ( int8_t &  dest,
const uint8_t *  src 
)
inlinestatic
static uint16_t DUNE::Utils::ByteCopy::copy ( uint8_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy1b().

static uint16_t DUNE::Utils::ByteCopy::copy ( int16_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy2b().

static uint16_t DUNE::Utils::ByteCopy::copy ( uint16_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy2b().

static uint16_t DUNE::Utils::ByteCopy::copy ( int32_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy4b().

static uint16_t DUNE::Utils::ByteCopy::copy ( uint32_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy4b().

static uint16_t DUNE::Utils::ByteCopy::copy ( fp32_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy4b().

static uint16_t DUNE::Utils::ByteCopy::copy ( fp64_t &  dest,
const uint8_t *  src 
)
inlinestatic

References copy8b().

static uint16_t DUNE::Utils::ByteCopy::copy1b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy one byte of a memory area.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by copy().

static uint16_t DUNE::Utils::ByteCopy::copy2b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy two bytes of a memory area.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by copy().

static uint16_t DUNE::Utils::ByteCopy::copy4b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy four bytes of a memory area.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by copy(), and toBE().

static uint16_t DUNE::Utils::ByteCopy::copy8b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy eight bytes of a memory area.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by copy().

static uint32_t DUNE::Utils::ByteCopy::fromBE ( uint32_t  n)
inlinestatic

Convert the 32-bit unsigned integer from big endian byte order to host byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
32-bit unsigned integer in host byte order.

Referenced by DUNE::Network::TCPSocket::accept(), fromBE(), DUNE::Network::TCPSocket::getBoundAddress(), DUNE::Network::TCPSocket::getBoundPort(), DUNE::Network::UDPSocket::read(), and DUNE::Network::Address::toIntegerNative().

static int32_t DUNE::Utils::ByteCopy::fromBE ( int32_t  n)
inlinestatic

Convert the 32-bit signed integer from big endian byte order to host byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
32-bit signed integer in host byte order.

References fromBE().

static uint16_t DUNE::Utils::ByteCopy::fromBE ( uint16_t  n)
inlinestatic

Convert the 16-bit unsigned integer from big endian byte order to host byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
16-bit unsigned integer in host byte order.
static int16_t DUNE::Utils::ByteCopy::fromBE ( int16_t  n)
inlinestatic

Convert the 16-bit signed integer from big endian byte order to host byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
16-bit signed integer in host byte order.

References fromBE().

static uint16_t DUNE::Utils::ByteCopy::fromBE ( uint8_t *  n)
inlinestatic

Converts the first 2 bytes of an array from big endian byte order to host byte order.

Parameters
narray to convert.
Returns
16 bit unsigned integer in host byte order.
template<typename T >
static uint16_t DUNE::Utils::ByteCopy::fromBE ( T &  var,
const uint8_t *  bfr 
)
inlinestatic

References copy(), and rcopy().

template<typename T >
static uint16_t DUNE::Utils::ByteCopy::fromLE ( T &  var,
const uint8_t *  bfr 
)
inlinestatic

References copy(), and rcopy().

Referenced by DUNE::Hardware::UCTK::Frame::get().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( int8_t &  dest,
const uint8_t *  src 
)
inlinestatic
static uint16_t DUNE::Utils::ByteCopy::rcopy ( uint8_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy1b().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( int16_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy2b().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( uint16_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy2b().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( int32_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy4b().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( uint32_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy4b().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( fp32_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy4b().

static uint16_t DUNE::Utils::ByteCopy::rcopy ( fp64_t &  dest,
const uint8_t *  src 
)
inlinestatic

References rcopy8b().

static uint16_t DUNE::Utils::ByteCopy::rcopy1b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy one byte of a memory area.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by rcopy().

static uint16_t DUNE::Utils::ByteCopy::rcopy2b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy two bytes of a memory area while reversing the order of the bytes.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by rcopy().

static uint16_t DUNE::Utils::ByteCopy::rcopy4b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy four bytes of a memory area while reversing the order of the bytes.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by rcopy(), and toBE().

static uint16_t DUNE::Utils::ByteCopy::rcopy8b ( uint8_t *  dest,
const uint8_t *  src 
)
inlinestatic

Copy eight bytes of a memory area while reversing the order of the bytes.

Parameters
destdestination memory area.
srcsource memory area.
Returns
number of copied bytes.

Referenced by rcopy().

static uint16_t DUNE::Utils::ByteCopy::toBE ( uint16_t  n)
inlinestatic

Convert the 16-bit unsigned integer to big endian byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
16-bit unsigned integer in big endian byte order.

Referenced by DUNE::Network::TCPSocket::bind(), DUNE::Network::UDPSocket::bind(), DUNE::Network::TCPSocket::connect(), DUNE::Network::Address::operator=(), toBE(), and DUNE::Network::UDPSocket::write().

static int16_t DUNE::Utils::ByteCopy::toBE ( int16_t  n)
inlinestatic

Convert the 16-bit signed integer to big endian byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
16-bit unsigned integer in big endian byte order.

References toBE().

static uint32_t DUNE::Utils::ByteCopy::toBE ( uint32_t  n)
inlinestatic

Convert the 32-bit unsigned integer to big endian byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
32-bit unsigned integer in big endian byte order.
static int32_t DUNE::Utils::ByteCopy::toBE ( int32_t  n)
inlinestatic

Convert the 32-bit signed integer to big endian byte order.

If the host is big endian no conversion is performed.

Parameters
ninteger to convert.
Returns
32-bit signed integer in big endian byte order.

References toBE().

static unsigned DUNE::Utils::ByteCopy::toBE ( const uint8_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toBE ( const int8_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toBE ( const uint16_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toBE ( const int16_t  value,
uint8_t *  dst 
)
inlinestatic

References toBE().

static unsigned DUNE::Utils::ByteCopy::toBE ( const uint32_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toBE ( const int32_t  value,
uint8_t *  dst 
)
inlinestatic

References toBE().

static unsigned DUNE::Utils::ByteCopy::toBE ( const float  value,
uint8_t *  dst 
)
inlinestatic

References copy4b(), and rcopy4b().

static unsigned DUNE::Utils::ByteCopy::toLE ( const uint8_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toLE ( const int8_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toLE ( const uint16_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toLE ( const int16_t  value,
uint8_t *  dst 
)
inlinestatic

References toLE().

static unsigned DUNE::Utils::ByteCopy::toLE ( const uint32_t  value,
uint8_t *  dst 
)
inlinestatic
static unsigned DUNE::Utils::ByteCopy::toLE ( const int32_t  value,
uint8_t *  dst 
)
inlinestatic

References toLE().

Collaboration diagram for DUNE::Utils::ByteCopy:
Collaboration graph