Port complete CAN-aware risk pipeline to C++

This commit is contained in:
zmv
2026-09-23 19:51:56 +08:00
parent 0f609612a6
commit e1e7fbe2fb
81 changed files with 27329 additions and 6381 deletions
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include "frame_result.hpp"
#include <atomic>
#include <stdexcept>
namespace cms {
// One immutable result variable. Readers neither remove nor acknowledge results.
class LatestResult {
public:
void publish(FrameResultPtr result) {
if(!result)throw std::invalid_argument("Cannot publish a null result");
std::atomic_store_explicit(&latest_,std::move(result),std::memory_order_release);
}
FrameResultPtr load() const {
return std::atomic_load_explicit(&latest_,std::memory_order_acquire);
}
private:
FrameResultPtr latest_;
};
}