ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CxxUtils::BitUnpacker< STREAM > Class Template Reference

Helper to unpack a set of values bitwise from a stream. More...

#include <BitUnpacker.h>

Collaboration diagram for CxxUtils::BitUnpacker< STREAM >:

Public Member Functions

 BitUnpacker (uint8_t nbits, STREAM &stream)
 Constructor. More...
 
uint32_t unpack ()
 Unpack one value from the stream. More...
 

Private Attributes

uint32_t m_buf
 Buffer for the current word being unpacked. More...
 
uint8_t m_nbuf
 Number of valid bits currently buffered. More...
 
uint8_t m_nbits
 Number of bits to use for each item. More...
 
STREAM & m_stream
 The input stream. More...
 
uint32_t m_mask
 Mask with the low m_nbits bits set. More...
 

Detailed Description

template<class STREAM>
class CxxUtils::BitUnpacker< STREAM >

Helper to unpack a set of values bitwise from a stream.

This helper can be used to unpack a set of values from a stream and return them as a set of 32-bit words. The number of bits taken by each value is configurable.

STREAM should support input (operator>>) with uint32_t (satisfied by a ROOT TBuffer).

Definition at line 38 of file BitUnpacker.h.

Constructor & Destructor Documentation

◆ BitUnpacker()

template<class STREAM >
CxxUtils::BitUnpacker< STREAM >::BitUnpacker ( uint8_t  nbits,
STREAM &  stream 
)

Constructor.

Parameters
nbitsNumber of bits per item to use in the packed representation.
streamInput stream object.

Member Function Documentation

◆ unpack()

template<class STREAM >
uint32_t CxxUtils::BitUnpacker< STREAM >::unpack ( )

Unpack one value from the stream.

Member Data Documentation

◆ m_buf

template<class STREAM >
uint32_t CxxUtils::BitUnpacker< STREAM >::m_buf
private

Buffer for the current word being unpacked.

Definition at line 57 of file BitUnpacker.h.

◆ m_mask

template<class STREAM >
uint32_t CxxUtils::BitUnpacker< STREAM >::m_mask
private

Mask with the low m_nbits bits set.

Definition at line 69 of file BitUnpacker.h.

◆ m_nbits

template<class STREAM >
uint8_t CxxUtils::BitUnpacker< STREAM >::m_nbits
private

Number of bits to use for each item.

Definition at line 63 of file BitUnpacker.h.

◆ m_nbuf

template<class STREAM >
uint8_t CxxUtils::BitUnpacker< STREAM >::m_nbuf
private

Number of valid bits currently buffered.

Definition at line 60 of file BitUnpacker.h.

◆ m_stream

template<class STREAM >
STREAM& CxxUtils::BitUnpacker< STREAM >::m_stream
private

The input stream.

Definition at line 66 of file BitUnpacker.h.


The documentation for this class was generated from the following file: