aether::netcode::transcode::finite_int< T, limit, > Struct Template Referencefinal

Encodes a integer within [0, limit) using as little bits as possible. More...

#include <transcode.hh>

Public Types

using Item = T
 

Public Member Functions

bool encode (const T &input, bit_appender &w) override final
 
bool decode (bit_stream &r, T &out) override final
 
virtual bool encode_stream (io::reader &r, bit_appender &w)
 
virtual bool decode_stream (bit_stream &r, io::writer &w)
 

Static Public Attributes

static constexpr int bit_size = log2(limit)
 

Detailed Description

template<typename T, T limit, std::enable_if_t< std::is_integral< T >::value, int > = 0>
struct aether::netcode::transcode::finite_int< T, limit, >

Encodes a integer within [0, limit) using as little bits as possible.

Member Typedef Documentation

template<typename T>
using aether::netcode::transcode::transcode_base< T >::Item = T
inherited

Member Function Documentation

template<typename T , T limit, std::enable_if_t< std::is_integral< T >::value, int > = 0>
bool aether::netcode::transcode::finite_int< T, limit, >::decode ( bit_stream r,
T &  out 
)
inlinefinaloverridevirtual
template<typename T>
virtual bool aether::netcode::transcode::transcode_base< T >::decode_stream ( bit_stream r,
io::writer w 
)
inlinevirtualinherited
template<typename T , T limit, std::enable_if_t< std::is_integral< T >::value, int > = 0>
bool aether::netcode::transcode::finite_int< T, limit, >::encode ( const T &  input,
bit_appender w 
)
inlinefinaloverridevirtual
template<typename T>
virtual bool aether::netcode::transcode::transcode_base< T >::encode_stream ( io::reader r,
bit_appender w 
)
inlinevirtualinherited

Member Data Documentation

template<typename T , T limit, std::enable_if_t< std::is_integral< T >::value, int > = 0>
constexpr int aether::netcode::transcode::finite_int< T, limit, >::bit_size = log2(limit)
static