LDMX Software
hcal::utility::Reader Class Reference

Read out 32-bit words from a 8-bit buffer. More...

Public Member Functions

 Reader (const std::vector< uint8_t > &b)
 
 operator bool ()
 
Reader & operator>> (uint32_t &w)
 

Private Member Functions

uint32_t next ()
 

Private Attributes

const std::vector< uint8_t > & buffer_
 
std::size_t i_word_
 

Detailed Description

Read out 32-bit words from a 8-bit buffer.

Definition at line 19 of file HcalRawDecoder.cxx.

Constructor & Destructor Documentation

◆ Reader()

hcal::utility::Reader::Reader ( const std::vector< uint8_t > & b)
inline

Definition at line 31 of file HcalRawDecoder.cxx.

31: buffer_{b}, i_word_{0} {}

Member Function Documentation

◆ next()

uint32_t hcal::utility::Reader::next ( )
inlineprivate

Definition at line 22 of file HcalRawDecoder.cxx.

22 {
23 uint32_t w = buffer_.at(i_word_) | (buffer_.at(i_word_ + 1) << 8) |
24 (buffer_.at(i_word_ + 2) << 16) |
25 (buffer_.at(i_word_ + 3) << 24);
26 i_word_ += 4;
27 return w;
28 }

◆ operator bool()

hcal::utility::Reader::operator bool ( )
inline

Definition at line 32 of file HcalRawDecoder.cxx.

32{ return (i_word_ < buffer_.size()); }

◆ operator>>()

Reader & hcal::utility::Reader::operator>> ( uint32_t & w)
inline

Definition at line 33 of file HcalRawDecoder.cxx.

33 {
34 if (*this) w = next();
35 return *this;
36 }

Member Data Documentation

◆ buffer_

const std::vector<uint8_t>& hcal::utility::Reader::buffer_
private

Definition at line 20 of file HcalRawDecoder.cxx.

◆ i_word_

std::size_t hcal::utility::Reader::i_word_
private

Definition at line 21 of file HcalRawDecoder.cxx.


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