20 void Writeable::write_u8(u8 data) {
28 void Writeable::write_u16(u16 data) {
35 void Writeable::write_u24(u32 data) {
43 void Writeable::write_u32(u32 data) {
52 void Writeable::write_u48(u64 data) {
63 void Writeable::write_u64(u64 data) {
76 void Writeable::write_u16l(u16 data) {
83 void Writeable::write_u24l(u32 data) {
91 void Writeable::write_u32l(u32 data) {
100 void Writeable::write_u48l(u64 data) {
111 void Writeable::write_u64l(u64 data) {
124 void Writeable::write_s8(s8 data)
125 {
write_u8(reinterpret<s8,u8>(data)); }
127 void Writeable::write_s16(s16 data)
128 { write_u16(reinterpret<s16,u16>(data)); }
130 void Writeable::write_s24(s32 data)
131 { write_u24(reinterpret<s32,u32>(data)); }
133 void Writeable::write_s32(s32 data)
134 { write_u32(reinterpret<s32,u32>(data)); }
136 void Writeable::write_s48(s64 data)
137 { write_u48(reinterpret<s64,u64>(data)); }
139 void Writeable::write_s64(s64 data)
140 { write_u64(reinterpret<s64,u64>(data)); }
142 void Writeable::write_f32(
float data)
143 { write_u32(reinterpret<float,u32>(data)); }
145 void Writeable::write_f64(
double data)
146 { write_u64(reinterpret<double,u64>(data)); }
148 void Writeable::write_s16l(s16 data)
149 { write_u16l(reinterpret<s16,u16>(data)); }
151 void Writeable::write_s24l(s32 data)
152 { write_u24l(reinterpret<s32,u32>(data)); }
154 void Writeable::write_s32l(s32 data)
155 { write_u32l(reinterpret<s32,u32>(data)); }
157 void Writeable::write_s48l(s64 data)
158 { write_u48l(reinterpret<s64,u64>(data)); }
160 void Writeable::write_s64l(s64 data)
161 { write_u64l(reinterpret<s64,u64>(data)); }
163 void Writeable::write_f32l(
float data)
164 { write_u32l(reinterpret<float,u32>(data)); }
166 void Writeable::write_f64l(
double data)
167 { write_u64l(reinterpret<double,u64>(data)); }
171 const u8* src8 =
reinterpret_cast<const u8*
>(src);
181 unsigned nbytes = strlen(str);
190 return m_len - m_wridx;
202 m_wrlen = ok ? m_wridx : 0;
213 m_dst[m_wridx++] = data;
256 {
return m_write_space; }
Ephemeral Writeable interface for a simple array.
bool write_finalize() override
Mark end of frame and release temporary working data.
void write_abort() override
If possible, abort the current partially-written packet.
void write_overflow() override
Optional error handling for write overflow.
void write_next(u8 data) override
Write the next byte to the underlying buffer or device.
unsigned get_write_space() const override
How many bytes can be written without blocking?
Limited write up to N bytes.
void write_next(u8 data) override
Write the next byte to the underlying buffer or device.
void write_bytes(unsigned nbytes, const void *src) override
Write 0 or more bytes from a buffer.
unsigned get_write_space() const override
How many bytes can be written without blocking?
Writeable object that accepts and discards all incoming data.
unsigned get_write_space() const override
How many bytes can be written without blocking?
void write_next(u8 data) override
Write the next byte to the underlying buffer or device.
void write_bytes(unsigned nbytes, const void *src) override
Write 0 or more bytes from a buffer.
Abstract API for writing byte-streams and packets.
virtual unsigned get_write_space() const =0
How many bytes can be written without blocking?
virtual void write_bytes(unsigned nbytes, const void *src)
Write 0 or more bytes from a buffer.
virtual void write_abort()
If possible, abort the current partially-written packet.
void write_u8(u8 data)
One of many functions for writing integer/floating point values, see details.
virtual void write_overflow()
Optional error handling for write overflow.
void write_str(const char *str)
Write the contents of a null-terminated string.
virtual void write_next(u8 data)=0
Write the next byte to the underlying buffer or device.
virtual bool write_finalize()
Mark end of frame and release temporary working data.
Wrapper class for forwarding writes to another object.
void write_next(u8 data) override
Write the next byte to the underlying buffer or device.
unsigned get_write_space() const override
How many bytes can be written without blocking?
void write_overflow() override
Optional error handling for write overflow.
bool write_finalize() override
Mark end of frame and release temporary working data.
void write_bytes(unsigned nbytes, const void *src) override
Write 0 or more bytes from a buffer.
void write_abort() override
If possible, abort the current partially-written packet.
"Writeable" I/O interface core definitions
satcat5::io::NullWrite null_write
Global instance of the basic NullWrite object.
Miscellaneous mathematical utility functions.
T2 reinterpret(T1 x)
In-place byte-for-byte format conversion, aka "type-punning".