struct rate_controller

Scope: kodo_slide

In header: #include <kodo_slide/rate_controller.hpp>

Member functions (public)

  rate_controller (uint32_t n, uint32_t k)
void advance ()
bool send_repair () const

Description

Small helper to control the amount of redundancy generated. Using the common n,k termionology. For each k symbols we send n. This means that r=n-k is the redundancy/repair symbols. Example: n=6, k=4, r=2. We have k=4 source symbols, we send n=6 symbols so after the 4’th source symbol we send r=2 (coded) redundancy symbols. Usage:

rate_controller rate = {6, 4};

// For every 6 symbols we send 4 are source symbols and 2 are
// repair.
assert(rate.send_repair() == false);
rate.advance();

assert(rate.send_repair() == false);
rate.advance();

assert(rate.send_repair() == false);
rate.advance();

assert(rate.send_repair() == false);
rate.advance();

assert(rate.send_repair() == true);
rate.advance();

assert(rate.send_repair() == true);
rate.advance();

// We now start over
assert(rate.send_repair() == false);
rate.advance();

Member Function Description

rate_controller (uint32_t n, uint32_t k)

Create a new rate controller.

void advance ()

Increment position to be a number from 0 to n.

bool send_repair ()

If true we should generate a repair symbol. Otherwise send a source symbol.