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

Pack a set of values bitwise into a stream. More...

#include <BitPacker.h>

Collaboration diagram for CxxUtils::BitPacker16< STREAM >:

Public Member Functions

 BitPacker16 (STREAM &stream)
 Constructor. More...
 
 BitPacker16 (uint8_t nbits, STREAM &stream)
 Constructor. More...
 
 ~BitPacker16 ()
 Destructor. More...
 
void pack (uint32_t x)
 Pack one value to the stream. More...
 

Private Attributes

uint32_t m_buf
 Buffer for the current words being packed. More...
 
uint8_t m_nbuf
 Number of valid words currently buffered. More...
 
STREAM & m_stream
 The output stream. More...
 

Detailed Description

template<class STREAM>
class CxxUtils::BitPacker16< STREAM >

Pack a set of values bitwise into a stream.

This helper can be used to pack a set of values into 32-bit words and write them to a stream. This is a special case for 16-bit values.

STREAM should support output (operator<<) with uint32_t (satisfied by a ROOT TBuffer).

Definition at line 146 of file BitPacker.h.

Constructor & Destructor Documentation

◆ BitPacker16() [1/2]

template<class STREAM >
CxxUtils::BitPacker16< STREAM >::BitPacker16 ( STREAM &  stream)

Constructor.

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

◆ BitPacker16() [2/2]

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

Constructor.

Parameters
nbitsMust be 16.
streamOutput stream object.

◆ ~BitPacker16()

template<class STREAM >
CxxUtils::BitPacker16< STREAM >::~BitPacker16 ( )

Destructor.

This may flush buffered data to the output stream.

Member Function Documentation

◆ pack()

template<class STREAM >
void CxxUtils::BitPacker16< STREAM >::pack ( uint32_t  x)

Pack one value to the stream.

Parameters
xThe value to pack. The upper bits should all be clear.

Member Data Documentation

◆ m_buf

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

Buffer for the current words being packed.

Definition at line 183 of file BitPacker.h.

◆ m_nbuf

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

Number of valid words currently buffered.

Definition at line 186 of file BitPacker.h.

◆ m_stream

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

The output stream.

Definition at line 189 of file BitPacker.h.


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