Abstract class for an output character stream that offers string and number formating.
More...
Abstract class for an output character stream that offers string and number formating.
Do you want to implement your own output stream? For example with a custom USART driver? But the standard output stream std::ostream or {fmt} fmt::format_to() use too much FLASH memory? This streaming interface serves as a minimal implementation for streams with a small footprint. Derive from this class and use its number and string formatings that let you do stuff like:
void endl(OStream &stream)
Writes a new line character to the stream followed by a call to OStream::flush()
Definition OStream.hpp:198
void newl(OStream &stream)
Writes a new line character to the stream.
Definition OStream.hpp:183
Virtual methods that the user has to overload:
virtual void put(
char c);
virtual void flush()=0
Overload this method to force flush the buffer.
virtual void put(char c)=0
Overload this method to write a character to the stream.
The other methods will use them but it is best to also overload:
virtual void write(
const char* str,
size_t len)
virtual void write(const char *str, size_t len)
Writes a string to the stream.
Definition OStream.cpp:32
as well for best performance.