pflib v3.13.3-1-gf856638
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
SingleECONTCaptureFrame.h
1#pragma once
2#ifndef PFLIB_PACKING_SINGLEECONTCAPTUREFRAME_H
3#define PFLIB_PACKING_SINGLEECONTCAPTUREFRAME_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
19 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("decoding")};
20
21 public:
53 mutable ::pflib::logging::logger the_log_{
54 ::pflib::logging::get("decoding")};
55 static constexpr std::size_t N_STC = 8;
57 std::array<int, N_STC> stc_sums_;
58 int bx_;
59
60 public:
61 void from(std::span<uint32_t> data);
63 int bx() const;
65 int stc_sum(int i_stc) const;
67 int encoded_stc_sum(int i_stc) const;
69 int max_tc(int i_stc) const;
70 };
71
72 SingleECONTCaptureFrame() = default;
73 SingleECONTCaptureFrame(std::span<uint32_t> data);
74 Reader& read(Reader& r);
75 void from(std::span<uint32_t> data);
76 const SingleECONTSample& sample(std::optional<int> i_sample = {}) const;
77 int bx(std::optional<int> i_sample = {}) const;
78 int stc_sum(int i_stc, std::optional<int> i_sample = {}) const;
79 int encoded_stc_sum(int i_stc, std::optional<int> i_sample = {}) const;
80 int max_tc(int i_stc, std::optional<int> i_sample = {}) const;
81 const ECONTCaptureHeader& header() const;
82 int length() const;
83 int version() const;
84 int econ_id() const;
85 int pre_samples() const;
86 std::size_t n_samples() const;
87
88 private:
89 ECONTCaptureHeader header_;
91};
92
93} // namespace pflib::packing
94
95#endif
Reading a raw data stream with some underlying backend.
Definition Reader.h:19
Each ECON-T sample has the following struture, assuming.
Definition SingleECONTCaptureFrame.h:52
int stc_sum(int i_stc) const
decode the 5E+4M encoding into a linearized sum value
Definition SingleECONTCaptureFrame.cxx:36
int encoded_stc_sum(int i_stc) const
the raw value trasmitted by the ECON-T
Definition SingleECONTCaptureFrame.cxx:40
int bx() const
bx counter for this sample of STC sums
Definition SingleECONTCaptureFrame.cxx:34
int max_tc(int i_stc) const
index of the TC within the STC that was the maximum
Definition SingleECONTCaptureFrame.cxx:45
A capture frame has one or more SingleECONTSamples along with two headers written by the firmware tha...
Definition SingleECONTCaptureFrame.h:18
void from(std::span< uint32_t > data)
Definition SingleECONTCaptureFrame.cxx:53
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24