16 #include <nn/pia/common/common_Definitions.h>
32 template <
typename T,
int N>
33 class FixedRingBuffer :
public common::RootObject
48 ~FixedRingBuffer(
void)
66 void PushBack(T value)
68 PIA_ASSERT(!IsFull());
77 void PushBackForce(T value)
88 PIA_ASSERT(!IsEmpty());
98 bool IsFull(
void)
const
107 bool IsEmpty(
void)
const
116 uint32_t GetSize(
void)
const
125 T& operator[](
size_t n)
127 return m_Values[getIndex(n)];
134 const T& operator[](
size_t n)
const
136 return m_Values[getIndex(n)];
145 void Trace(uint64_t flag)
const
153 void pushBack(T value)
155 m_Values[getEndIndex()] = value;
167 void incBeginIndex(
void)
169 m_BeginIndex = (m_BeginIndex + 1) % N;
173 uint32_t getBeginIndex(
void)
const
179 uint32_t getEndIndex(
void)
const
181 return (getBeginIndex() + GetSize()) % N;
185 uint32_t getIndex(
size_t n)
const
188 return (m_BeginIndex + n) % N;
192 uint32_t m_BeginIndex;