|
SatCat5
|
Parent class for non-template elements of ChecksumTx.
This class is not used directly.
Definition at line 44 of file io_checksum.h.
#include <io_checksum.h>
Public Member Functions | |
| void | write_abort () override |
| If possible, abort the current partially-written packet. More... | |
| unsigned | byte_count (bool reset=true) override |
| Bytes transferred since the last query. | |
| unsigned | frame_count (bool reset=true) override |
| Frames transferred since the last query. | |
| unsigned | error_count (bool reset=true) override |
| (Optional) Error events since the last query. | |
| void | byte_incr (unsigned incr) |
| Increment any of the internal counters. | |
| void | frame_incr (unsigned incr) |
| void | error_incr (unsigned incr) |
| virtual unsigned | get_write_space () const =0 |
| How many bytes can be written without blocking? More... | |
| 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... | |
| virtual bool | write_finalize () |
| Mark end of frame and release temporary working data. 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; | |
Protected Member Functions | |
| constexpr | ChecksumTxCommon (satcat5::io::Writeable *dst) |
| Only the child class has access to the constructor. | |
| bool | chk_finalize () |
| Reset internal state and return true if the frame is valid. More... | |
| virtual void | chk_reset ()=0 |
| Reset the checksum calculation to its initial state. More... | |
| void | write_overflow () override |
| Optional error handling for write overflow. More... | |
| virtual void | write_next (u8 data)=0 |
| Write the next byte to the underlying buffer or device. More... | |
Protected Attributes | |
| satcat5::io::Writeable *const | m_dst |
| Output object. | |
| bool | m_ovr |
| Overflow flag. | |
| unsigned | m_byte_ct |
| Cumulative byte count. | |
| unsigned | m_err_ct |
| Cumulative error count. | |
| unsigned | m_frm_ct |
| Cumulative frame count. | |
| unsigned | m_frm_len |
| Length of current frame. | |
| friend | LimitedWrite |
| friend | WriteableBroadcast |
| friend | WriteableRedirect |
|
protected |
Reset internal state and return true if the frame is valid.
i.e., If false, do not forward the write_finalize() event.
Definition at line 24 of file io_checksum.cc.
|
protectedpure virtual |
Reset the checksum calculation to its initial state.
Child MUST implement this method, since data type is unknown.
Implemented in satcat5::io::ChecksumTx< T, N >, satcat5::io::ChecksumTx< u16, 2 >, and satcat5::io::ChecksumTx< u32, 4 >.
|
pure virtualinherited |
How many bytes can be written without blocking?
Child objects of io::Writeable MUST override this method.
Implemented in satcat5::port::Mailmap, satcat5::io::PacketBuffer, satcat5::io::MultiWriter, satcat5::io::MultiPacket::Overwriter, satcat5::io::NullWrite, satcat5::io::WriteableRedirect, satcat5::io::LimitedWrite, satcat5::io::ArrayWrite, satcat5::io::WriteableThrottle, satcat5::io::ChecksumRxCommon, satcat5::io::ChecksumTx< T, N >, satcat5::io::ChecksumTx< u16, 2 >, satcat5::io::ChecksumTx< u32, 4 >, satcat5::io::WriteableBroadcastAny, satcat5::io::WriteableBroadcast, satcat5::io::SlipDecoder, satcat5::io::SlipEncoder, satcat5::io::HdlcDecoder, satcat5::io::HdlcEncoder::ByteStuff, satcat5::io::CobsDecoder, satcat5::io::CobsEncoder, satcat5::ccsds_spp::Packetizer, satcat5::io::FileWriter, and satcat5::util::ChatPrinter.
|
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 16 of file io_checksum.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.
|
virtualinherited |
Mark end of frame and release temporary working data.
Child objects of io::Writeable SHOULD override this method to mark frame bounds.
Reimplemented in satcat5::port::Mailmap, satcat5::io::PacketBuffer, satcat5::io::MultiWriterBypass, satcat5::io::MultiWriter, satcat5::io::WriteableRedirect, satcat5::io::ArrayWrite, satcat5::io::WriteableThrottle, satcat5::io::CounterInline, satcat5::io::WriteableBroadcastAny, satcat5::io::WriteableBroadcast, satcat5::eth::SwitchPort, satcat5::eth::ChecksumRx, satcat5::eth::ChecksumTx, satcat5::crc16::XmodemRx, satcat5::crc16::XmodemTx, satcat5::crc16::KermitRx, satcat5::crc16::KermitTx, satcat5::io::SlipEncoder, satcat5::io::HdlcEncoder::ByteStuff, satcat5::io::CobsEncoder, satcat5::coap::Connection, satcat5::test::EthernetInterface, satcat5::io::BufferedTee, satcat5::io::WritePcapInterface, satcat5::io::WritePcap, satcat5::io::FileWriter, and satcat5::util::ChatPrinter.
Definition at line 185 of file io_writeable.cc.
|
protectedpure virtualinherited |
Write the next byte to the underlying buffer or device.
Child objects of io::Writeable MUST override this method.
Implemented 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::ArrayWrite, satcat5::io::CounterInline, satcat5::io::WriteableBroadcast, satcat5::eth::ChecksumRx, satcat5::eth::ChecksumTx, satcat5::crc16::XmodemRx, satcat5::crc16::XmodemTx, satcat5::crc16::KermitRx, satcat5::crc16::KermitTx, satcat5::io::SlipDecoder, satcat5::io::SlipEncoder, satcat5::io::HdlcDecoder, satcat5::io::HdlcEncoder::ByteStuff, satcat5::io::CobsDecoder, satcat5::io::CobsEncoder, satcat5::ccsds_spp::Packetizer, satcat5::io::FileWriter, and satcat5::util::ChatPrinter.
|
overrideprotectedvirtual |
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 12 of file io_checksum.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.