|
SatCat5
|
Ephemeral Writeable interface for a simple array.
Definition at line 127 of file io_writeable.h.
#include <io_writeable.h>
Public Member Functions | |
| unsigned | get_write_space () const override |
| How many bytes can be written without blocking? More... | |
| void | write_abort () override |
| If possible, abort the current partially-written packet. More... | |
| bool | write_finalize () override |
| Mark end of frame and release temporary working data. More... | |
| void | write_overflow () override |
| Optional error handling for write overflow. More... | |
| const u8 * | buffer () const |
| Read-only access to the working buffer. | |
| unsigned | written_len () const |
| Report total length after write_finalize() is called. | |
| void | write_u8 (u8 data) |
| One of many functions for writing integer/floating point values, see details. More... | |
| virtual void | write_bytes (unsigned nbytes, const void *src) |
| Write 0 or more bytes from a buffer. More... | |
| void | write_str (const char *str) |
| Write the contents of a null-terminated string. More... | |
| template<class T > | |
| void | write_obj (const T &obj) |
Templated wrapper for any object with the following method: void write_to(satcat5::io::Writeable* wr) const; | |
| constexpr | ArrayWrite (void *dst, unsigned len) |
| Create an ArrayWrite object linked to the provided working buffer. More... | |
| constexpr | ArrayWrite (unsigned len, void *dst) |
| Create an ArrayWrite object linked to the provided working buffer. More... | |
Protected Attributes | |
| friend | LimitedWrite |
| friend | WriteableBroadcast |
| friend | WriteableRedirect |
Private Member Functions | |
| void | write_next (u8 data) override |
| Write the next byte to the underlying buffer or device. More... | |
Private Attributes | |
| u8 *const | m_dst |
| const unsigned | m_len |
| bool | m_ovr |
| unsigned | m_wridx |
| unsigned | m_wrlen |
|
inlineconstexpr |
Create an ArrayWrite object linked to the provided working buffer.
For ease of use, constructor accepts dst/length or length/dst.
Definition at line 134 of file io_writeable.h.
|
inlineconstexpr |
Create an ArrayWrite object linked to the provided working buffer.
For ease of use, constructor accepts dst/length or length/dst.
Definition at line 136 of file io_writeable.h.
|
overridevirtual |
How many bytes can be written without blocking?
Child objects of io::Writeable MUST override this method.
Implements satcat5::io::Writeable.
Definition at line 189 of file io_writeable.cc.
|
overridevirtual |
If possible, abort the current partially-written packet.
Child objects of io::Writeable SHOULD override this method if it is practical to prevent in-progress data from being relayed downstream.
Reimplemented from satcat5::io::Writeable.
Definition at line 193 of file io_writeable.cc.
|
virtualinherited |
Write 0 or more bytes from a buffer.
Child objects of io::Writeable MAY override write_bytes as needed for performance.
Reimplemented in satcat5::port::MailmapAligned, satcat5::port::Mailmap, satcat5::io::PacketBuffer, satcat5::io::MultiWriter, satcat5::io::MultiPacket::Overwriter, satcat5::io::NullWrite, satcat5::io::WriteableRedirect, satcat5::io::LimitedWrite, satcat5::io::CounterInline, satcat5::io::WriteableBroadcast, and satcat5::io::FileWriter.
Definition at line 170 of file io_writeable.cc.
|
overridevirtual |
Mark end of frame and release temporary working data.
Child objects of io::Writeable SHOULD override this method to mark frame bounds.
Reimplemented from satcat5::io::Writeable.
Definition at line 199 of file io_writeable.cc.
|
overrideprivatevirtual |
Write the next byte to the underlying buffer or device.
Child objects of io::Writeable MUST override this method.
Implements satcat5::io::Writeable.
Definition at line 211 of file io_writeable.cc.
|
overridevirtual |
Optional error handling for write overflow.
Child objects of io::Writeable MAY override this method for error handling.
Reimplemented from satcat5::io::Writeable.
Definition at line 207 of file io_writeable.cc.
|
inherited |
Write the contents of a null-terminated string.
Note: Null-termination is not copied to the output.
Definition at line 180 of file io_writeable.cc.
|
inherited |
One of many functions for writing integer/floating point values, see details.
Several functions are provided for reading and writing scalar types to/from io::Readable and io::Writeable instances. Since there are many of these that are frequently inherited, they are hidden from documentation. These functions follow a shared template:
read_ or write_ prefix.u for unsigned, s for signed, f for floating-point.l suffix if little-endian, no suffix if big-endian.Example: write_s48l is "Write 48 bits (6 bytes) to this
io::Writeable as a signed value in little-endian order".
Definition at line 20 of file io_writeable.cc.