17 #include <pia/common/common_definitions.h> 34 template <
typename T,
int N>
35 class FixedRingBuffer :
public common::RootObject
50 ~FixedRingBuffer(
void)
68 void PushBack(T value)
70 PIA_ASSERT(!IsFull());
79 void PushBackForce(T value)
90 PIA_ASSERT(!IsEmpty());
100 bool IsFull(
void)
const 109 bool IsEmpty(
void)
const 118 size_t GetSize(
void)
const 127 T& operator[](
size_t n)
129 return m_Values[getIndex(n)];
136 const T& operator[](
size_t n)
const 138 return m_Values[getIndex(n)];
147 void Trace(u64 flag)
const 155 void pushBack(T value)
157 m_Values[getEndIndex()] = value;
169 void incBeginIndex(
void)
171 m_BeginIndex = (m_BeginIndex + 1) % N;
175 size_t getBeginIndex(
void)
const 181 size_t getEndIndex(
void)
const 183 return (getBeginIndex() + GetSize()) % N;
187 size_t getIndex(
size_t n)
const 190 return (m_BeginIndex + n) % N;