pflib v3.15.1-5-ge6391b0
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
TrigPathCaptureFrame.h
1#pragma once
2#ifndef PFLIB_PACKING_TRIGPATHCAPTUREFRAME_H
3#define PFLIB_PACKING_TRIGPATHCAPTUREFRAME_H
4
5#include <optional>
6
7#include "pflib/logging/Logging.h"
8#include "pflib/packing/ECONTCaptureHeader.h"
9#include "pflib/packing/Reader.h"
10
11namespace pflib::packing {
12
22template <class SingleECONTSample>
24 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("decoding")};
25
26 public:
27 TrigPathCaptureFrame() = default;
28 TrigPathCaptureFrame(std::span<uint32_t> data);
29 Reader& read(Reader& r);
38 void from(std::span<uint32_t> data);
45 const SingleECONTSample& sample(std::optional<int> i_sample = {}) const;
47 const ECONTCaptureHeader& header() const;
49 int length() const { return header().length(); }
50
51 private:
52 ECONTCaptureHeader header_;
54};
55
56template <class SingleECONTSample>
57std::ostream& operator<<(std::ostream& o,
58 const TrigPathCaptureFrame<SingleECONTSample>& self) {
59 o << self.header() << '\n';
60 for (int i_sample{0}; i_sample < self.header().n_samples(); i_sample++) {
61 o << (i_sample == self.header().pre_samples() ? '*' : ' ')
62 << self.sample(i_sample) << '\n';
63 }
64 return o;
65}
66
67} // namespace pflib::packing
68
69#endif
The econt_buffer_manager firmware block inserts a pair of headers with the same format for the data c...
Definition ECONTCaptureHeader.h:17
Reading a raw data stream with some underlying backend.
Definition Reader.h:19
This represents the capture block in the ZCU trigpath firmware.
Definition TrigPathCaptureFrame.h:23
const ECONTCaptureHeader & header() const
get access to header
Definition TrigPathCaptureFrame.cxx:63
int length() const
get the total length of this frame
Definition TrigPathCaptureFrame.h:49
const SingleECONTSample & sample(std::optional< int > i_sample={}) const
get a sample at a specific index
Definition TrigPathCaptureFrame.cxx:58
void from(std::span< uint32_t > data)
parse the header and then pass parsing onto the samples
Definition TrigPathCaptureFrame.cxx:33
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24