Syndicate::Data::Bitstream Class Reference

#include <Syndicate/Data/Bitstream.h>

List of all members.

Public Member Functions

 Bitstream (uint8_t const *data, unsigned data_size)
unsigned get (unsigned nb_bits)
void get (unsigned nb_bytes, uint8_t *output)

Private Member Functions

unsigned pop (unsigned nb_bits)
void push (unsigned nb_bits, unsigned buffer)
void reload (unsigned nb_bits=16)

Private Attributes

uint8_t const * _data
unsigned _data_size
unsigned _data_offset
uint32_t _buffer
unsigned _count

Static Private Attributes

static uint16_t const _masks [16]


Detailed Description

Process a buffer of bytes as a bitstream. It is specific to the RNC file format.


Constructor & Destructor Documentation

Syndicate::Data::Bitstream::Bitstream ( uint8_t const *  data,
unsigned  data_size 
)

Instanciate a bitstream on the given data.

Parameters:
[in] data the data
[in] data_size the number of bytes in the data.


Member Function Documentation

unsigned Syndicate::Data::Bitstream::get ( unsigned  nb_bits  ) 

Extract somes bits from the stream.

Parameters:
[in] nb_bits numbers of bits to extract [1;16]
Returns:
the value extracted.

void Syndicate::Data::Bitstream::get ( unsigned  nb_bytes,
uint8_t *  output 
)

Extract somes bytes from the stream. This is different of extracting bits.

Parameters:
[in] nb_bytes numbers of bytes to extract [1;n]
[out] output a pointer to a nb_bytes length buffer to stores the result

unsigned Syndicate::Data::Bitstream::pop ( unsigned  nb_bits  )  [private]

Pop nb bytes from the stream.

Parameters:
[in] nb_bits numbers of bits to extract [1;16]

void Syndicate::Data::Bitstream::push ( unsigned  nb_bits,
unsigned  buffer 
) [private]

Push nb bytes into the stream.

Parameters:
[in] nb_bits numbers of bits to insert [1;16]
[in] buffer add the comment FIXME

void Syndicate::Data::Bitstream::reload ( unsigned  nb_bits = 16  )  [private]

Reload Push nb bytes into the stream.

Parameters:
[in] nb_bits numbers of bits to insert [1;16]


Member Data Documentation

uint16_t const Syndicate::Data::Bitstream::_masks[16] [static, private]

Precomputed table of mask

uint8_t const* Syndicate::Data::Bitstream::_data [private]

A pointer to the data array

unsigned Syndicate::Data::Bitstream::_data_size [private]

The data array size

unsigned Syndicate::Data::Bitstream::_data_offset [private]

The offset of the read pointer in the data array

uint32_t Syndicate::Data::Bitstream::_buffer [private]

The buffer currently processed. The data are processed by batch of 16 bits

unsigned Syndicate::Data::Bitstream::_count [private]

The number of fresh bits in the buffer


The documentation for this class was generated from the following file:
Generated on Sun Sep 30 13:08:36 2007 for libSyndicate by  doxygen 1.5.2