16 #ifndef _SMING_CORE_DATA_BUFFER_CIRCULAR_BUFFER_H_ 17 #define _SMING_CORE_DATA_BUFFER_CIRCULAR_BUFFER_H_ 19 #include "Stream/ReadWriteStream.h" 32 CircularBuffer(
int size) : buffer(new char[size]), readPos(buffer), writePos(buffer), size(size)
62 bool seek(
int len)
override;
84 return String(reinterpret_cast<uint32_t>(&buffer), HEX);
87 size_t write(uint8_t charToWrite)
override;
94 size_t write(
const uint8_t* data,
size_t size)
override;
102 void flush()
override 109 inline char* wrap(
char* ptr)
const 111 return (ptr == buffer + size) ? buffer : ptr;
115 char* buffer =
nullptr;
116 char* readPos =
nullptr;
117 char* writePos =
nullptr;
bool seek(int len) override
Move read cursor.
Memory data stream.
Definition: DataSourceStream.h:24
The string class.
Definition: WString.h:104
int available() override
Return the total length of the stream.
uint16_t readMemoryBlock(char *data, int bufSize) override
Read a block of memory.
size_t room() const
Get the maximum number of bytes for which write() will succeed.
Circular stream class.
Definition: CircularBuffer.h:29
StreamType
Data stream type.
Definition: DataSourceStream.h:22
size_t write(uint8_t charToWrite) override
Writes a single character to output stream.
StreamType getStreamType() const override
Get the stream type.
Definition: CircularBuffer.h:45
String id() const override
Returns unique id of the resource.
Definition: CircularBuffer.h:82
bool isFinished() override
Check if stream is finished.
Definition: CircularBuffer.h:67
Base class for read/write stream.
Definition: ReadWriteStream.h:23