aether::compression::packed_reader Class Reference

Representation of compressed data: More...

#include <compression.hh>

Public Member Functions

 packed_reader (const uint8_t *blob, size_t bitSize, std::unique_ptr< compression_config > config)
 
const uint8_t & operator[] (size_t i) const
 
template<typename T >
bool pop (T &dst, size_t pop_bit_size)
 Set of methods used to decompress specific properties from bytearray. More...
 
bool pop_quat (net_quat &quat)
 
bool pop_velocity (vec3f &vel)
 
bool pop_4_b (uint32_t &bytes)
 
bool pop_1_b (uint8_t &byte)
 
bool pop_4_b_packed (uint32_t &bytes, int32_t max_val, int32_t min_val)
 
bool pop_float_packed (float &bytes, float max_val, float min_val, uint32_t precision)
 
size_t get_size_bits () const
 
const compression_configget_config () const
 
size_t get_cursor () const
 

Protected Attributes

size_t cursor
 
size_t size
 
const uint8_t * bulk_data
 
std::unique_ptr< compression_configconfig
 

Detailed Description

Representation of compressed data:

  • compressed data should have preallocated size via bitSize param in constructor. its preallocated size is defined in "size" property
  • current size of compressed data is stored in "cursor" property ( its value defines amount of used bits )
  • compressed data is not affected by memory alignment, and is stored in LIFO order
  • it should be mid layer used for serialization in the future

Constructor & Destructor Documentation

aether::compression::packed_reader::packed_reader ( const uint8_t *  blob,
size_t  bitSize,
std::unique_ptr< compression_config config 
)

Member Function Documentation

const compression_config& aether::compression::packed_reader::get_config ( ) const
size_t aether::compression::packed_reader::get_cursor ( ) const
inline
size_t aether::compression::packed_reader::get_size_bits ( ) const
inline
const uint8_t& aether::compression::packed_reader::operator[] ( size_t  i) const
inline
template<typename T >
bool aether::compression::packed_reader::pop ( T &  dst,
size_t  pop_bit_size 
)

Set of methods used to decompress specific properties from bytearray.

bool aether::compression::packed_reader::pop_1_b ( uint8_t &  byte)
bool aether::compression::packed_reader::pop_4_b ( uint32_t &  bytes)
bool aether::compression::packed_reader::pop_4_b_packed ( uint32_t &  bytes,
int32_t  max_val,
int32_t  min_val 
)
bool aether::compression::packed_reader::pop_float_packed ( float &  bytes,
float  max_val,
float  min_val,
uint32_t  precision 
)
bool aether::compression::packed_reader::pop_quat ( net_quat &  quat)
bool aether::compression::packed_reader::pop_velocity ( vec3f &  vel)

Member Data Documentation

const uint8_t* aether::compression::packed_reader::bulk_data
protected
std::unique_ptr<compression_config> aether::compression::packed_reader::config
protected
size_t aether::compression::packed_reader::cursor
protected
size_t aether::compression::packed_reader::size
protected