28 buffers_[active_write_index_] =
value;
29 last_written_index_ = active_write_index_;
63 const uint8_t old_state = shared_state_.exchange(active_read_index_, std::memory_order_acq_rel);
67 return buffers_[active_read_index_];
71 std::array<T, 3> buffers_{};
84 std::atomic<uint8_t> shared_state_{0};
Wait-free, Single-Producer Single-Consumer (SPSC) triple buffer.
Definition wait_free_triple_buffer.hpp:17
void set(const T &value)
Publish new data.
Definition wait_free_triple_buffer.hpp:26
T get()
Get the most recently published data.
Definition wait_free_triple_buffer.hpp:56
WaitFreeTripleBuffer(const T &initial_value)
Definition wait_free_triple_buffer.hpp:21
T getLastWritten() const
Get the most recently written value from the writer's side.
Definition wait_free_triple_buffer.hpp:49
WaitFreeTripleBuffer()=default
Definition dynamics_limit.cpp:8
std::array< double, dims > toStdD(const Eigen::Matrix< double, dims, 1 > &vector)
Definition util.hpp:18