Warning: This is a development version. The latest stable version is Version 10.0.0.

Code Example: Hello World

This simple example can be used for checking whether your build system has been successfully setup to use the otacast library.

 1// Copyright (c) Steinwurf ApS 2023.
 2// This file is licensed under the terms of the accompanying LICENSE.rst file.
 3
 4#include <iostream>
 5
 6#include <otacast/encoder.hpp>
 7#include <otacast/version.hpp>
 8
 9int main()
10{
11    // Print the version of the library used
12    std::cout << "version:      " << otacast::version() << "\n";
13
14    // Create the encoder object with a specific finite field
15    otacast::encoder encoder;
16
17    auto width = otacast::codec_width::_32;
18    std::size_t block_bytes = 1024 * 1000; // 1 MB
19    std::size_t symbol_bytes = 1500;
20
21    encoder.configure(width, block_bytes, symbol_bytes);
22
23    std::cout << "block_bytes:  " << encoder.block_bytes() << "\n";
24    std::cout << "symbol_bytes: " << encoder.symbol_bytes() << "\n";
25    std::cout << "width:        " << encoder.width() << "\n";
26    std::cout << "symbols       " << encoder.symbols() << "\n";
27    return 0;
28}