Base for data encoders.
More...
#include <Coder.hpp>
Base for data encoders.
Used for encoding integer values to a certain bit representation.
Definition at line 14 of file Coder.hpp.
◆ Encoder() [1/2]
template<typename literals_t >
tdc::Encoder::Encoder |
( |
Env && |
env, |
|
|
std::shared_ptr< BitOStream > |
out, |
|
|
literals_t && |
literals |
|
) |
| |
|
inline |
Constructor.
- Template Parameters
-
literals_t | The literal iterator type. |
- Parameters
-
env | The algorithm's environment. |
out | The bit stream to write to. |
literals | The literal iterator. |
Definition at line 29 of file Coder.hpp.
◆ Encoder() [2/2]
template<typename literals_t >
tdc::Encoder::Encoder |
( |
Env && |
env, |
|
|
Output & |
out, |
|
|
literals_t && |
literals |
|
) |
| |
|
inline |
Convenience constructor.
- Template Parameters
-
literals_t | The literal iterator type. |
- Parameters
-
env | The algorithm's environment. |
out | The output to write to. |
literals | The literal iterator. |
Definition at line 44 of file Coder.hpp.
◆ encode() [1/2]
template<typename value_t >
void tdc::Encoder::encode |
( |
value_t |
v, |
|
|
const Range & |
r |
|
) |
| |
|
inline |
Encodes an arbitrary-range integer value.
This default implementation computes the amount of bits required to store an integer value of the given range and writes its binary representation to the output.
- Template Parameters
-
value_t | The input value type. |
- Parameters
-
v | The integer value to encode. |
r | The value range. |
Definition at line 61 of file Coder.hpp.
◆ encode() [2/2]
template<typename value_t >
void tdc::Encoder::encode |
( |
value_t |
v, |
|
|
const BitRange & |
r |
|
) |
| |
|
inline |
Encodes a bit.
This default implementation will write exactly one bit to the output. A zero bit is written if the given value is zero, a one bit is written otherwise.
- Template Parameters
-
value_t | The input value type. |
- Parameters
-
v | The value to encode. |
r | Unused. |
Definition at line 75 of file Coder.hpp.
◆ stream()
const std::shared_ptr<BitOStream>& tdc::Encoder::stream |
( |
| ) |
|
|
inline |
◆ m_out
The underlying bit output stream.
Definition at line 18 of file Coder.hpp.
The documentation for this class was generated from the following file: