diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /qmap/decode_ipc.h | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
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 |
