1 #ifndef ORG_EEROS_CORE_SIGNALBUFFER_HPP_
2 #define ORG_EEROS_CORE_SIGNALBUFFER_HPP_
10 template<
typename T,
int N = 32>
16 std::lock_guard<std::mutex> lock(mtx);
17 if(len == N)
return false;
18 items[(tail + len++) % N] = v;
23 std::lock_guard<std::mutex> lock(mtx);
24 if(len == 0)
return false;
26 tail = (tail + 1) % N;
31 unsigned int length()
const {
return len; }
33 constexpr
int size()
const {
return N; }
43 #endif // ORG_EEROS_CORE_SIGNALBUFFER_HPP_
bool pop(T &v)
Definition: RingBuffer.hpp:22
bool push(T v)
Definition: RingBuffer.hpp:15
int v
Definition: RingBufferTest.cpp:14
Definition: RingBuffer.hpp:11
unsigned int length() const
Definition: RingBuffer.hpp:31
RingBuffer()
Definition: RingBuffer.hpp:13
constexpr int size() const
Definition: RingBuffer.hpp:33