15 #include <Fw/Types/BasicTypes.hpp>
16 #include <Fw/Types/Assert.hpp>
35 return m_allocated_size;
39 FW_ASSERT(m_allocated_size <= m_store_size, m_allocated_size);
40 return m_store_size - m_allocated_size;
45 return (idx + amount) % m_store_size;
56 for (U32 i = 0; i < size; i++) {
58 m_store[idx] = buffer[i];
59 idx = advance_idx(idx);
61 m_allocated_size += size;
67 return peek(
reinterpret_cast<U8&
>(value), offset);
72 if ((
sizeof(
U8) + offset) > m_allocated_size) {
83 if ((
sizeof(U32) + offset) > m_allocated_size) {
92 value = (value << 8) | static_cast<U32>(m_store[idx]);
93 idx = advance_idx(idx);
101 if ((size + offset) > m_allocated_size) {
108 buffer[i] = m_store[idx];
109 idx = advance_idx(idx);
116 if (amount > m_allocated_size) {
119 m_head_idx = advance_idx(m_head_idx, amount);
120 m_allocated_size -= amount;
128 #ifdef CIRCULAR_DEBUG
129 void CircularBuffer :: print() {
134 idx = advance_idx(idx);