15 #ifndef PFOD_CIRCULAR_LINE_BUFFER_H
16 #define PFOD_CIRCULAR_LINE_BUFFER_H
202 virtual size_t write(uint8_t c)
override;
211 virtual size_t write(
const uint8_t *buffer,
size_t size)
override;
218 size_t startLineCount;
224 size_t lineByteCount;
236 bool findNextLine(
size_t fromPos,
size_t& lineEnd);
246 size_t bytesInRange(
size_t start,
size_t end)
const;
pfodCircularLineBuffer - Line-aware circular buffer for CSV data streaming
void clear()
Clears all data from buffer and resets line counts.
size_t getStartLineCount() const
Gets the current start line number (oldest available line).
size_t addLine(const char *line)
Adds a complete line to the buffer (must include \r terminator).
virtual int peek() override
Reads one byte from current read range without advancing position.
size_t getUsedBytes() const
Gets number of bytes currently used in buffer.
void resetForRead()
Resets read position to beginning of all available data.
size_t getBufferSize() const
Gets the configured buffer size.
size_t getEndLineCount() const
Gets the current end line number (newest line + 1).
size_t getLineCount() const
Gets total number of lines currently in buffer.
~pfodCircularLineBuffer()
Destructor - Cleans up buffer memory.
virtual size_t write(uint8_t c) override
Write single byte to buffer.
size_t getAvailableBytes() const
Gets number of bytes available in buffer.
size_t addLine(const String &line)
Adds a complete line to the buffer (must include \r terminator).
pfodCircularLineBuffer(size_t bufferSize=4096)
Constructor - Initializes empty circular buffer with specified size.
virtual int available() override
Returns number of bytes available to read from current read range.
void debugBufferRange(Print *outPtr)
Prints debug information about buffer state and positions.
virtual size_t write(const uint8_t *buffer, size_t size) override
Write buffer.
void getRange(size_t fromLineCount, BufferRange &range)
Gets buffer range starting from specified line number.
virtual int read() override
Reads one byte from current read range and advances position.
bool isEmpty() const
Checks if buffer is empty.
void setReadRange(const BufferRange &range)
Sets the current read position to a specific buffer range.
void getAllRange(BufferRange &range)
Gets buffer range for all available data.