diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /qmap/decode_ipc.h | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'qmap/decode_ipc.h')
| -rw-r--r-- | qmap/decode_ipc.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/qmap/decode_ipc.h b/qmap/decode_ipc.h new file mode 100644 index 00000000..8b554b33 --- /dev/null +++ b/qmap/decode_ipc.h @@ -0,0 +1,53 @@ +#ifndef QMAP_DECODE_IPC_H +#define QMAP_DECODE_IPC_H + +#include <cstddef> +#include <type_traits> + +namespace qmap_decode_ipc +{ + // Keep row dimensions in sync with qmap_decode_ipc.f90. + constexpr std::size_t shared_memory_size {4096}; + constexpr std::size_t max_rows {50}; + constexpr std::size_t row_size {80}; + constexpr std::size_t live_cq_row_size {8}; + + struct DecodeRows + { + int ndecodes; // Number of populated decode rows in the current cycle. + int ncand; // Number of QMAP candidates found in the current cycle. + int nQDecoderDone; // QMAP completion state: 1 for live data, 2 for disk data. + int nWDecoderBusy; // WSJT-X decoder busy flag: 1 while busy, otherwise 0. + int nWTransmitting; // WSJT-X transmit period while transmitting, otherwise 0. + int kHzRequested; // QMAP dial request in integer kHz; 0 means no request. + char result[max_rows][row_size]; // Formatted QMAP decode rows. + }; + + struct LiveCqRows + { + char result2[max_rows][live_cq_row_size]; + }; + + template<std::size_t Size> + std::size_t text_length (char const (&row)[Size]) noexcept + { + std::size_t length {0}; + while (length < Size && row[length]) ++length; + return length; + } + + static_assert (std::is_standard_layout<DecodeRows>::value, + "QMAP decode IPC data must have a stable layout"); + static_assert (std::is_trivially_copyable<DecodeRows>::value, + "QMAP decode IPC data must support shared-memory copies"); + static_assert (sizeof (int) == 4, + "QMAP decode IPC integers must match Fortran INTEGER storage"); + static_assert (sizeof (DecodeRows) == 6 * sizeof (int) + max_rows * row_size, + "QMAP decode IPC data must not contain padding"); + static_assert (sizeof (DecodeRows) <= shared_memory_size, + "QMAP decode IPC data must fit in shared memory"); + static_assert (sizeof (LiveCqRows) == max_rows * live_cq_row_size, + "QMAP LiveCQ data must not contain padding"); +} + +#endif |
