LDMX Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 ()
 
Readeroperator>> (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 14 of file HcalRawDecoder.cxx.

Constructor & Destructor Documentation

◆ Reader()

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

Definition at line 26 of file HcalRawDecoder.cxx.

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

Member Function Documentation

◆ next()

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

Definition at line 17 of file HcalRawDecoder.cxx.

17 {
18 uint32_t w = buffer_.at(i_word_) | (buffer_.at(i_word_ + 1) << 8) |
19 (buffer_.at(i_word_ + 2) << 16) |
20 (buffer_.at(i_word_ + 3) << 24);
21 i_word_ += 4;
22 return w;
23 }

◆ operator bool()

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

Definition at line 27 of file HcalRawDecoder.cxx.

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

◆ operator>>()

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

Definition at line 28 of file HcalRawDecoder.cxx.

28 {
29 if (*this) w = next();
30 return *this;
31 }

Member Data Documentation

◆ buffer_

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

Definition at line 15 of file HcalRawDecoder.cxx.

◆ i_word_

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

Definition at line 16 of file HcalRawDecoder.cxx.


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