SatCat5
io_readable.h File Reference

Detailed Description

"Readable" I/O interface core definitions

The core of all SatCat5 I/O are the "Writeable" interface (io_writeable.h) and "Readable" interface (io_readable.h). These general-purpose virtual interfaces are used by PacketBuffer, generic UARTs, etc. for code reuse.

Definition in file io_readable.h.

#include <satcat5/polling.h>
#include <satcat5/types.h>
Include dependency graph for io_readable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::io::EventListener
 Event-handler interface for newly received data. More...
 
class  satcat5::io::Readable
 Abstract API for reading byte-streams and packets. More...
 
class  satcat5::io::ArrayRead
 Ephemeral Readable interface for a simple array. More...
 
class  satcat5::io::LimitedRead
 Limited read of next N bytes. More...
 
class  satcat5::io::ReadableRedirect
 Wrapper class for forwarding reads to another object. More...
 
class  satcat5::io::NullRead
 Readable object that never produces any data. More...
 
class  satcat5::io::NullSink
 An EventListener object that immediately discards all received data. More...
 

Enumerations

enum class  satcat5::io::CopyMode { STREAM , PACKET , ALWAYS }
 Specify read and write behavior for Readable::copy_and_finalize(). More...
 

Variables

satcat5::io::NullRead satcat5::io::null_read
 Global instances of the basic NullRead and NullSink objects. More...
 
satcat5::io::NullSink satcat5::io::null_sink
 Global instances of the basic NullRead and NullSink objects. More...
 

Enumeration Type Documentation

◆ CopyMode

enum satcat5::io::CopyMode
strong

Specify read and write behavior for Readable::copy_and_finalize().

These options affect when read_finalize() and write_finalize() are called by the Readable::copy_and_finalize() method.

Enumerator
STREAM 

STREAM mode is used for non-packetized data.

  • read_finalize: Never.
  • write_finalize: When data is copied.
PACKET 

PACKET mode (default) preserves packet boundaries.

  • read_finalize: When data is copied and source is depleted.
  • write_finalize: When data is copied and source is depleted.
ALWAYS 

ALWAYS mode ensures write_finalize is always called.

  • read_finalize: When the source is depleted.
  • write_finalize: Every time copy_and_finalize is called.

Definition at line 23 of file io_readable.h.

Variable Documentation

◆ null_read

NullRead satcat5::io::null_read
extern

Global instances of the basic NullRead and NullSink objects.

Use these placeholders instead of null pointers. e.g., Any number of sources may call my_src.set_callback(&satcat5::io::null_sink);

Definition at line 29 of file io_readable.cc.

◆ null_sink

NullSink satcat5::io::null_sink
extern

Global instances of the basic NullRead and NullSink objects.

Use these placeholders instead of null pointers. e.g., Any number of sources may call my_src.set_callback(&satcat5::io::null_sink);

Definition at line 30 of file io_readable.cc.