44 FW_ASSERT(m_store ==
nullptr && m_store_size == 0);
51 m_high_water_mark = 0;
55 return m_allocated_size;
59 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
60 FW_ASSERT(m_allocated_size <= m_store_size, static_cast<FwAssertArgType>(m_allocated_size));
61 return m_store_size - m_allocated_size;
65 FW_ASSERT(idx < m_store_size, static_cast<FwAssertArgType>(idx));
66 return (idx + amount) % m_store_size;
70 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
77 FwSizeType idx = advance_idx(m_head_idx, m_allocated_size);
78 for (U32 i = 0; i < size; i++) {
79 FW_ASSERT(idx < m_store_size, static_cast<FwAssertArgType>(idx));
80 m_store[idx] = buffer[i];
81 idx = advance_idx(idx);
83 m_allocated_size += size;
85 m_high_water_mark = (m_high_water_mark > m_allocated_size) ? m_high_water_mark : m_allocated_size;
90 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
91 return peek(reinterpret_cast<U8&>(value), offset);
95 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
97 if ((
sizeof(
U8) + offset) > m_allocated_size) {
100 const FwSizeType idx = advance_idx(m_head_idx, offset);
101 FW_ASSERT(idx < m_store_size, static_cast<FwAssertArgType>(idx));
102 value = m_store[idx];
107 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
109 if ((
sizeof(U32) + offset) > m_allocated_size) {
113 FwSizeType idx = advance_idx(m_head_idx, offset);
116 for (
FwSizeType i = 0; i <
sizeof(U32); i++) {
117 FW_ASSERT(idx < m_store_size, static_cast<FwAssertArgType>(idx));
118 value = (value << 8) | static_cast<U32>(m_store[idx]);
119 idx = advance_idx(idx);
125 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
128 if ((size + offset) > m_allocated_size) {
131 FwSizeType idx = advance_idx(m_head_idx, offset);
134 FW_ASSERT(idx < m_store_size, static_cast<FwAssertArgType>(idx));
135 buffer[i] = m_store[idx];
136 idx = advance_idx(idx);
142 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
144 if (amount > m_allocated_size) {
147 m_head_idx = advance_idx(m_head_idx, amount);
148 m_allocated_size -= amount;
153 FW_ASSERT(m_store !=
nullptr && m_store_size != 0);
158 return m_high_water_mark;
162 m_high_water_mark = 0;
Serialization/Deserialization operation was successful.
Deserialization buffer was empty when trying to read more data.
PlatformSizeType FwSizeType
No room left in the buffer to serialize data.
SerializeStatus
forward declaration for string
FwSizeType get_high_water_mark() const
Fw::SerializeStatus serialize(const U8 *const buffer, const FwSizeType size)
void clear_high_water_mark()
Fw::SerializeStatus rotate(FwSizeType amount)
FwSizeType get_allocated_size() const
uint8_t U8
8-bit unsigned integer
FwSizeType get_capacity() const
Fw::SerializeStatus peek(char &value, FwSizeType offset=0) const
void setup(U8 *const buffer, const FwSizeType size)
FwSizeType get_free_size() const