CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Binary< byteOrder > Class Template Referencefinal

Read and write binary data structures. More...

#include <cc/Binary>

Public Member Functions

 Binary (const Bytes &bytes)
 Create an interpretation of bytes.
 
template<class T >
value (long i, long j) const
 Read the value ranging from byte i to byte j.
 
template<class T >
value (long i) const
 Read the value of type T starting at byte i.
 
template<class T , long I, long J>
value () const
 Read the value ranging from byte i to byte j.
 
template<class T , long I>
value () const
 Read the value ranging from byte i to byte j.
 

Detailed Description

template<ByteOrder byteOrder = ByteOrder::LittleEndian>
class cc::Binary< byteOrder >

Read and write binary data structures.

Template Parameters
byteOrderByte order for reading words
Todo
Add support for reading floating point values of <stdfloat>

Constructor & Destructor Documentation

◆ Binary()

template<ByteOrder byteOrder = ByteOrder::LittleEndian>
Binary ( const Bytes & bytes)
explicit

Create an interpretation of bytes.

Member Function Documentation

◆ value() [1/4]

template<ByteOrder byteOrder = ByteOrder::LittleEndian>
template<class T >
T value ( long i,
long j ) const

Read the value ranging from byte i to byte j.

Template Parameters
TValue type (e.g. int32_t)
iIndex of first byte
jIndex of last byte
Returns
Decoded value

◆ value() [2/4]

template<ByteOrder byteOrder = ByteOrder::LittleEndian>
template<class T >
T value ( long i) const

Read the value of type T starting at byte i.

Template Parameters
TValue type (e.g. int32_t)
Returns
Decoded value

◆ value() [3/4]

template<ByteOrder byteOrder = ByteOrder::LittleEndian>
template<class T , long I, long J>
T value ( ) const

Read the value ranging from byte i to byte j.

Template Parameters
TValue type (e.g. int32_t)
IIndex of first byte provided at compile time
JIndex of last byte provided at compile time
Returns
Decoded value

◆ value() [4/4]

template<ByteOrder byteOrder = ByteOrder::LittleEndian>
template<class T , long I>
T value ( ) const

Read the value ranging from byte i to byte j.

Template Parameters
TValue type (e.g. int32_t)
IIndex of first byte provided at compile time
Returns
Decoded value