ATLAS Offline Software
Loading...
Searching...
No Matches
CxxUtils::BitPacker8< STREAM > Class Template Reference

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

#include <BitPacker.h>

Collaboration diagram for CxxUtils::BitPacker8< STREAM >:

Public Member Functions

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

Private Attributes

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

Detailed Description

template<class STREAM>
class CxxUtils::BitPacker8< 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 8-bit values.

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

Definition at line 90 of file BitPacker.h.

Constructor & Destructor Documentation

◆ BitPacker8() [1/2]

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

Constructor.

Parameters
streamOutput stream object.

◆ BitPacker8() [2/2]

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

Constructor.

Parameters
nbitsMust be 8.
streamOutput stream object.

◆ ~BitPacker8()

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

Destructor.

This may flush buffered data to the output stream.

Member Function Documentation

◆ pack()

template<class STREAM>
void CxxUtils::BitPacker8< 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::BitPacker8< STREAM >::m_buf
private

Buffer for the current words being packed.

Definition at line 126 of file BitPacker.h.

◆ m_nbuf

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

Number of valid bits currently buffered.

Definition at line 129 of file BitPacker.h.

◆ m_stream

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

The output stream.

Definition at line 132 of file BitPacker.h.


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