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);
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) {
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) {
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) {
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;
PlatformUIntType NATIVE_UINT_TYPE
Serialization/Deserialization operation was successful.
NATIVE_UINT_TYPE get_capacity() const
Deserialization buffer was empty when trying to read more data.
void setup(U8 *const buffer, const NATIVE_UINT_TYPE size)
No room left in the buffer to serialize data.
NATIVE_UINT_TYPE get_high_water_mark() const
NATIVE_UINT_TYPE get_allocated_size() const
SerializeStatus
forward declaration for string
void clear_high_water_mark()
Fw::SerializeStatus serialize(const U8 *const buffer, const NATIVE_UINT_TYPE size)
Fw::SerializeStatus rotate(NATIVE_UINT_TYPE amount)
C++-compatible configuration header for fprime configuration.
uint8_t U8
8-bit unsigned integer
NATIVE_UINT_TYPE get_free_size() const
Fw::SerializeStatus peek(char &value, NATIVE_UINT_TYPE offset=0) const