aether::netcode::transcode Namespace Reference

Classes

struct  as_uint64
 
struct  bit_appender
 Densely pack a stream of bits into a byte array. More...
 
struct  bit_stream
 Wraps an array of bytes and provides an interface for reading arbitrary number of bits from the array. More...
 
struct  boolean
 Encodes a boolean value using 1 bit. More...
 
struct  clamp
 clamp a number to range [lower, upper] More...
 
struct  finite_int
 Encodes a integer within [0, limit) using as little bits as possible. More...
 
struct  identity
 Copy T verbatim. More...
 
struct  integer_delta_transform
 Stateful transformer that XORs values. More...
 
struct  optional_struct_coder
 A struct coder that can skip fields based on a bit mask. More...
 
struct  optional_struct_coder< T, struct_member< BM T::*, bit_mask_ptr, BitMaskCoder >, Spec... >
 
struct  optional_struct_coder_impl
 
struct  optional_struct_coder_impl< T, index, struct_member< BM T::*, bit_mask_ptr, BitMaskCoder >, struct_member< S T::*, ptr, Coder >, Rest... >
 
struct  optional_struct_coder_impl< T, index, BitMaskMember >
 
struct  Rebase
 Transform a number from [old_base, +inf) to [0, +inf). By subtracting old_base More...
 
struct  scale
 scale a number up by scale More...
 
struct  struct_coder
 Encode a C++ struct according to Spec. More...
 
struct  struct_coder< T >
 ditto More...
 
struct  struct_coder< T, struct_member< S T::*, ptr, Coder >, Rest... >
 ditto More...
 
struct  struct_member
 
struct  struct_member< T S::*, ptr, Coder >
 Represents a member in the struct, and how it should be encoded. More...
 
struct  to_integer
 Cast a float point number to integer. More...
 
struct  transcode_base
 Base interface for Transcoders. More...
 
struct  transform_base
 Base for transformers. More...
 
struct  transform_coder
 A coder that transforms the input with Transformer, then encodes it with Coder More...
 
struct  transform_compose
 

Functions

template<typename T , T lower, T upper, std::enable_if_t< lower< upper, int >=0 > using bounded_int = transform_coder<T, Rebase<T, lower>, finite_int<T, upper - lower>>; template < typename T, T lower, T upper, std::enable_if_t<lower<upper, int> = 0> using clamped_int = transform_coder< T, clamp<T, lower, upper - 1>, transform_coder<T, Rebase<T, lower>, finite_int<T, upper - lower>>>;template < typename T, int64_t Scale, int64_t Lower, int64_t Upper, std::enable_if_t<std::is_floating_point<T>::value, int> = 0>using BoundedFixedPoint = transform_coder< T, scale<T, Scale>, transform_coder<T, to_integer<T, int64_t>, bounded_int<int64_t, Lower, Upper>>>;template < typename T, int64_t Scale, int64_t Lower, int64_t Upper, std::enable_if_t<std::is_floating_point<T>::value, int> = 0>using clamped_fixed_point = transform_coder< T, scale<T, Scale>, transform_coder<T, to_integer<T, int64_t>, clamped_int<int64_t, Lower, Upper>>>;template < typename T, std::enable_if_t<std::is_integral<T>::value, int> = 0>struct variable_int final : public transcode_base<T> { static const size_t bit_size = 0; bool encode(const T &_input, bit_appender &w) override final { uint64_t input = to_u64(_input); std::array<unsigned char, 10> encoded; size_t length = 0; do { encoded[length] = input & 127; input >>
 if (input!=0)
 Encode an integer value within the range of [lower, upper) More...
 
 while (input!=0)
 
push_bits (reinterpret_cast< const uint8_t * >(encoded.data()), length *CHAR_BIT)
 
bool decode (bit_stream &r, T &out) override final
 

Variables

 length
 
return true
 

Function Documentation

bool aether::netcode::transcode::decode ( bit_stream r,
T &  out 
)
finaloverride
template<typename T , T lower, T upper, std::enable_if_t< lower< upper, int >=0 > using bounded_int = transform_coder<T, Rebase<T, lower>, finite_int<T, upper - lower>>; template < typename T, T lower, T upper, std::enable_if_t<lower<upper, int> = 0> using clamped_int = transform_coder< T, clamp<T, lower, upper - 1>, transform_coder<T, Rebase<T, lower>, finite_int<T, upper - lower>>>;template < typename T, int64_t Scale, int64_t Lower, int64_t Upper, std::enable_if_t<std::is_floating_point<T>::value, int> = 0>using BoundedFixedPoint = transform_coder< T, scale<T, Scale>, transform_coder<T, to_integer<T, int64_t>, bounded_int<int64_t, Lower, Upper>>>;template < typename T, int64_t Scale, int64_t Lower, int64_t Upper, std::enable_if_t<std::is_floating_point<T>::value, int> = 0>using clamped_fixed_point = transform_coder< T, scale<T, Scale>, transform_coder<T, to_integer<T, int64_t>, clamped_int<int64_t, Lower, Upper>>>;template < typename T, std::enable_if_t<std::is_integral<T>::value, int> = 0>struct variable_int final : public transcode_base<T> { static const size_t bit_size = 0; bool encode(const T &_input, bit_appender &w) override final { uint64_t input = to_u64(_input); std::array<unsigned char, 10> encoded; size_t length = 0; do { encoded[length] = input & 127; input >>
aether::netcode::transcode::if ( input!  = 0)

Encode an integer value within the range of [lower, upper)

w aether::netcode::transcode::push_bits ( reinterpret_cast< const uint8_t * >  encoded.data(),
length CHAR_BIT 
)
aether::netcode::transcode::while ( input!  = 0)

Variable Documentation

aether::netcode::transcode::length
return aether::netcode::transcode::true