buffer: Implement "updateReadPtr"
This is a helper function for reading the circular buffer
Tested: Unit tested
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I1c34a40bd279ee601de33669aabfec27a959ec44
diff --git a/include/buffer.hpp b/include/buffer.hpp
index 08d400d..6c42401 100644
--- a/include/buffer.hpp
+++ b/include/buffer.hpp
@@ -80,6 +80,12 @@
* @return cached CircularBufferHeader
*/
virtual struct CircularBufferHeader getCachedBufferHeader() const = 0;
+
+ /**
+ * Write to the bufferHeader and update the read pointer
+ * @param[in] newReadPtr - read pointer to update to
+ */
+ virtual void updateReadPtr(const uint32_t newReadPtr) = 0;
};
/**
@@ -97,6 +103,7 @@
const std::array<uint32_t, 4>& magicNumber) override;
void readBufferHeader() override;
struct CircularBufferHeader getCachedBufferHeader() const override;
+ void updateReadPtr(const uint32_t newReadPtr) override;
private:
std::unique_ptr<DataInterface> dataInterface;