class decoder

Scope: otacast

In header: #include <otacast/decoder.hpp>

Brief description

The otacast decoder.

Member functions (public)

  decoder ()
  decoder (const decoder & other)
decoder & operator= (const decoder & other)
  decoder (decoder && other)
decoder & operator= (decoder && other)
  ~decoder ()
void configure (finite_field field, uint64_t block_bytes, uint64_t symbol_bytes, uint64_t width)
void reset ()
uint64_t symbol_bytes () const
uint64_t width () const
uint64_t block_bytes () const
uint64_t symbols () const
finite_field finite_field () const
void set_symbols_storage (uint8_t * symbol_storage)
uint8_t * symbols_storage () const
void decode (uint8_t * symbol, uint64_t seed, uint64_t offset)
bool can_complete_decoding () const
void complete_decoding ()
bool is_complete () const
double progress () const
uint64_t state_bytes () const
void save_state (uint8_t * data) const
bool restore_state (const uint8_t * data, uint64_t size)

Member Function Description

decoder ()
Default constructor.

decoder (const decoder & other)
Copy constructor (disabled). This type is only movable.

decoder & operator= (const decoder & other)
Copy assign operator (disabled). This type is only movable.

decoder (decoder && other)
R-value copy constructor.

decoder & operator= (decoder && other)
R-value move assign operator.

~decoder ()
Destructor.

void configure (finite_field field, uint64_t block_bytes, uint64_t symbol_bytes, uint64_t width)

Configure the decoder with the given parameters. This is useful for reusing an existing coder. Note that the reconfiguration always implies a reset, so the coder will be in a clean state after this operation

Parameter field:
The finite field to use
Parameter block_bytes:
The size of the block in bytes
Parameter symbol_bytes:
The size of a symbol in bytes
Parameter width:
The width of the encoding i.e. now many symbols are combined for each encoded symbol

void reset ()
Reset the state of the decoder.

auto symbol_bytes () const -> uint64_t
Return the size in bytes per symbol supported by this decoder.

auto width () const -> uint64_t
Return the width of the encoding i.e. now many symbols are combined for each encoded symbol

auto block_bytes () const -> uint64_t
Return the total number of bytes that with this decoder spans.

auto symbols () const -> uint64_t
Return the number of symbols supported by this decoder.

auto finite_field () const -> finite_field
Return the finite field used.

void set_symbols_storage (uint8_t * symbol_storage)

Initialize all the symbols in the block

Parameter symbol_storage:
The buffer containing all the data for the the block

auto symbols_storage () const -> uint8_t *
Returns:
The memory for the block.

void decode (uint8_t * symbol, uint64_t seed, uint64_t offset)

Feed a coded symbol to the decoder.

Parameter symbol:
The data of the symbol assumed to be symbol_bytes() bytes in size.
Parameter seed:
The seed for generating the coding coefficients.
Parameter offset:
The offset of the coding coefficients

auto can_complete_decoding () const -> bool
Returns:
True if the decoder can complete the decoding, i.e., that the rank is full.

void complete_decoding ()
Instruct the decoder to complete the decoding, this is only possible when can_complete_decoding() returns true.

auto is_complete () const -> bool
Returns:
True if the decoder is complete

auto progress () const -> double
Returns:
A value between 0 and 100, representing the decoding progress.

auto state_bytes () const -> uint64_t
The number of bytes needed for storeing the state.

void save_state (uint8_t * data) const

Save the state of this decoder so that it can be restored later using restore_state.

Parameter data:
the data pointer writing the state, please make sure it is large enough to contain the number of bytes returned by state_bytes.

auto restore_state (const uint8_t * data, uint64_t size) -> bool

Restore the state of a past decoder. This operation is only allowed a new decoder object.

Parameter data:
a data pointer to the state.
Parameter size:
the size of the data being pointed to.
Returns:
True if the restore operation was successful, otherwise false.
Versions
3.0.0
2.1.0
2.0.1
2.0.0
1.0.0
Development
latest