Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Classes | Namespaces
signal_consumer.hpp File Reference

SignalConsumer — JSON serialisation thread for relativistic signals. More...

#include "spsc_ring.hpp"
#include "stream_signal.hpp"
#include <atomic>
#include <cstdint>
#include <cstdio>
#include <thread>

Go to the source code of this file.

Classes

struct  srfm::stream::SignalConsumerCounters
 Diagnostic counters for the signal consumer thread. More...
 
class  srfm::stream::SignalConsumer
 JSON output thread owner. Non-copyable, non-movable. More...
 

Namespaces

namespace  srfm
 
namespace  srfm::stream
 

Detailed Description

SignalConsumer — JSON serialisation thread for relativistic signals.

Module: include/srfm/stream/ Owner: AGT-10 (Builder) — 2026-03-01

Responsibility

Pop StreamRelativisticSignal objects from the output ring and write one JSON line per signal to a configurable output stream (default: stdout). Flush the output every FLUSH_INTERVAL signals to amortise syscall cost.

Output format (one line per signal):

{"bar": 42, "beta": 0.4200, "gamma": 1.2309, "regime": "TIMELIKE", "signal": 0.8700}

Guarantees

• Batched I/O: flushes every FLUSH_INTERVAL (default 100) signals, not per signal. • Non-throwing: the serialisation loop never throws. • Final flush: stop() performs a final flush before joining the thread. • Configurable sink: constructor accepts any FILE* for testability.

NOT Responsible For

• Signal computation (SignalProcessor) • Routing or fanout (one sink only)

Definition in file signal_consumer.hpp.