class pure_recoder

Scope: kodo_rlnc

In header: #include <pure_recoder.hpp>

Brief description

Implementation of a pure RLNC recoder that will not decode the incoming data, it will only re-encode it.

Member types (public)

class factory

Member functions (public)

uint32_t block_size () const
uint32_t coefficient_vector_size () const
bool has_trace_support () const
void initialize (factory & the_factory)
bool is_trace_enabled () const
uint32_t payload_size () const
void read_payload (uint8_t * payload)
void read_symbol (uint8_t * symbol_data, uint8_t * coefficients)
uint32_t recoder_coefficient_vector_size () const
void recoder_generate (uint8_t * coefficients)
uint32_t recoder_symbols () const
uint32_t recoder_write_symbol (uint8_t * recoded_symbol_data, uint8_t * recoded_symbol_coefficients, uint8_t * recoding_coefficients)
void set_coefficient_vector_data (uint32_t index, const storage::const_storage & storage)
void set_const_symbol (uint32_t index, const storage::const_storage & symbol)
void set_trace_callback (const kodo_core::trace_callback_function & callback)
void set_trace_off ()
void set_trace_stdout ()
void set_zone_prefix (const std::string & zone_prefix)
uint32_t symbol_size () const
uint32_t symbols () const
uint32_t write_payload (uint8_t * payload)

Description

The “set_recoder_symbols” method of the factory can be used to set the number of symbols/combinations that should be stored in the pure recoder. These coded symbols are combinations of previously received symbols. When a new symbol is received, the pure recoder will combine it with its existing symbols using random coefficients.

Member Function Description

uint32_t block_size ()

Returns:
the block size i.e. the total size in bytes that this coder operates on. Users may use the bytes_used() function provided in the symbol storage layers to see how many of those bytes are then used.

uint32_t coefficient_vector_size ()

Returns:
The number of bytes needed to store the symbol coefficients.

bool has_trace_support ()

Returns whether the coder has support for tracing.

Returns:
True if tracing is available otherwise false

void initialize (factory & the_factory)

Initializes the coder and ensures the object is in a clean state. A coder may be initialized many times.

Parameter the_factory:
The factory used to build the codec layer. Provides access to cached data and factory functions.

bool is_trace_enabled ()

Returns whether a tracing is enabled for the coder.

Returns:
True if tracing is enabled otherwise false

uint32_t payload_size ()

Returns:
the required payload buffer size in bytes

void read_payload (uint8_t * payload)

Reads an encoded symbol stored in the payload buffer.

Parameter payload:
The buffer storing the payload of an encoded symbol. The payload buffer may be changed by this function, so it cannot be reused. If the payload is needed multiple times, then make sure to keep a copy of the original payload.

void read_symbol (uint8_t * symbol_data, uint8_t * coefficients)

Decodes an encoded symbol according to the coding coefficients.

Both buffers may be modified during this call. The reason for this is that the decoder will directly operate on the provided memory for performance reasons.

Parameter symbol_data:
Buffer representing an encoded symbol.
Parameter coefficients:
The coding coefficients used to create the encoded symbol

uint32_t recoder_coefficient_vector_size ()

Returns:
The number of bytes needed to store the recoder symbol coefficients.

void recoder_generate (uint8_t * coefficients)

Fills the input buffer with symbol coefficients used for either encoding or decoding a symbol.

Parameter coefficients:
Pointer to the memory where the coefficients should be stored. The coefficient buffer should have at least layer::coefficient_vector_size() capacity.

uint32_t recoder_symbols ()

Returns:
the number of internal symbols that are stored in the recoder

uint32_t recoder_write_symbol (uint8_t * recoded_symbol_data, uint8_t * recoded_symbol_coefficients, uint8_t * recoding_coefficients)

Write an encoded symbol based on the recoding coefficients.

Parameter recoded_symbol_data:
This is the buffer where the re-encoded symbol will be stored.
Parameter recoded_symbol_coefficients:
This is the buffer where the re-encoded symbol coefficients will be stored.
Parameter recoding_coefficients:
These are the recoding coeffcients that are used to produce the symbol_data and symbol_coefficients.
Returns:
The number of bytes used.

void set_coefficient_vector_data (uint32_t index, const storage::const_storage & storage)

Sets a coefficient buffer - by copying it into the right location in the buffer.

Parameter index:
the index of the coefficients into the coding block
Parameter storage:
The actual data of the coefficients

void set_const_symbol (uint32_t index, const storage::const_storage & symbol)

Sets the data storage for a const symbol.

Parameter index:
the index of the symbol in the coding block
Parameter symbol:
the actual data of that symbol

void set_trace_callback (const kodo_core::trace_callback_function & callback)

Enables tracing in a stack. trace_callback for more information about the callback signature.

Parameter callback:
The function callback where the tracing information will be delivered. As a user you specify the callback if you want to have control over the tracing output.

void set_trace_off ()

Disables tracing in a stack.

void set_trace_stdout ()

Enables tracing in a stack. The output will be written to standard out.

void set_zone_prefix (const std::string & zone_prefix)

Sets a zone prefix for the tracing output. The zone prefix will be appended to all the output. This makes it possible to have two stacks that both trace to standard out, but still differentiate the output.

Parameter zone_prefix:
The zone prefix to append to all tracing zones

uint32_t symbol_size ()

Returns:
the symbol size of a symbol in bytes

uint32_t symbols ()

Returns:
the number of symbols in this block coder

uint32_t write_payload (uint8_t * payload)

Writes the payload representing a single encoded symbol into the provided buffer. The exact content and structure of the payload depends on the codec used. The provided buffer should have a size of at least layer::payload_size() bytes. This is guaranteed to be enough for the specific configuration used for the codec, e.g. the number of symbols and the size of a symbol. However, since many codecs use variable-size encoding, i.e. using less bytes to represent the headers of a systematic symbol, we will return the actual number of bytes used. So that the application can avoid transmitting/storing more data than actually needed.

Parameter payload:
The buffer where the payload should be written.
Returns:
the total bytes used from the payload buffer

class factory

Scope: kodo_rlnc::pure_recoder

In header: #include <pure_recoder.hpp>

Brief description

Factory class that is needed to instantiate a recoder.

Member types (public)

using pointer

Member functions (public)

  factory (fifi::api::field field, uint32_t symbols, uint32_t symbol_size)
pointer build ()
uint32_t recoder_symbols () const
void set_field (fifi::api::field field)
void set_recoder_symbols (uint32_t symbols)
void set_symbol_size (uint32_t symbol_size)
void set_symbols (uint32_t symbols)
uint32_t symbol_size () const
uint32_t symbols () const

Member Function Description

factory (fifi::api::field field, uint32_t symbols, uint32_t symbol_size)

Factory base constructor.

Parameter field:
the chosen finite field
Parameter symbols:
the number of symbols in the coding block
Parameter symbol_size:
the size of a symbol in bytes

pointer build ()

Builds the actual coder.

Returns:
pointer to an instantiation of an encoder or decoder

uint32_t recoder_symbols ()

Returns:
the number of internal symbols that should be stored in the recoder.

void set_field (fifi::api::field field)

Sets the finite field

Parameter field:
the selected field type

void set_recoder_symbols (uint32_t symbols)

Set the number of recoder symbols for coders to be created with this factory.

Parameter symbols:
the number of recoder symbols

void set_symbol_size (uint32_t symbol_size)

Sets the symbol size

Parameter symbol_size:
the symbol size

void set_symbols (uint32_t symbols)

Sets the number of symbols

Parameter symbols:
the number of symbols

uint32_t symbol_size ()

Returns:
the symbol size in bytes

uint32_t symbols ()

Returns:
the number of symbols in a block

Type Description

using pointer = std::shared_ptr
Type of the pointer returned by the factory objects.