pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
DecodeAndBuffer Class Reference

Consume an event packet, decode it, and save to buffer. More...

#include <daq_run.h>

Inheritance diagram for DecodeAndBuffer:
[legend]
Collaboration diagram for DecodeAndBuffer:
[legend]

Public Member Functions

 DecodeAndBuffer (int nevents)
 
const std::vector< pflib::packing::SingleROCEventPacket > & get_buffer () const
 get buffer
 
void set_buffer_size (int nevents)
 Set the buffer size.
 
virtual void write_event (const pflib::packing::SingleROCEventPacket &ep) override
 Save to buffer.
 
virtual void start_run () override
 Check that the buffer was read and flushed since last run.
 
- Public Member Functions inherited from DecodeAndWrite
virtual void consume (std::vector< uint32_t > &event) final
 Decode the input event packet into our pflib::packing::SingleROCEventPacket and then call write_event on it.
 
- Public Member Functions inherited from DAQRunConsumer
virtual void end_run ()
 

Private Attributes

std::vector< pflib::packing::SingleROCEventPacketep_buffer_
 Buffer for event packets.
 

Additional Inherited Members

- Protected Attributes inherited from DecodeAndWrite
mutable::pflib::logging::logger the_log_
 logging for warning messages on empty events
 

Detailed Description

Consume an event packet, decode it, and save to buffer.

The constructor takes an argument of the size of the buffer which should be the number of events being collected in the run(s) where this buffer is used.

The buffer can be read out with get_buffer(). The buffer is cleared upon the start of every run.

Avoid copying this potentially large buffer around by using constant references.

// after daq_run has filled the DecodeAndBuffer object 'buffer'
const auto& events{buffer.get_buffer()};

Member Function Documentation

◆ start_run()

void DecodeAndBuffer::start_run ( )
overridevirtual

Check that the buffer was read and flushed since last run.

Reimplemented from DAQRunConsumer.

◆ write_event()

void DecodeAndBuffer::write_event ( const pflib::packing::SingleROCEventPacket & ep)
overridevirtual

Save to buffer.

Implements DecodeAndWrite.


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