16 : m_size(size), m_index(-1), m_ports(ports), m_src(src), m_dst(dst)
21 #if SATCAT5_ALLOW_DELETION
33 for (
unsigned a = 0 ; a < m_size ; ++a) {
34 Readable* src = (a == idx) ? m_src : 0;
36 m_ports[a].
attach(src, dst);
42 if (m_index < m_size) m_ports[m_index].
read_notify();
47 #if SATCAT5_ALLOW_DELETION
50 for (
unsigned a = 0 ; a < m_size ; ++a) {
70 Readable* src = (idx < m_size) ? m_src[idx] : 0;
76 Readable* ref = (m_index < m_size) ? m_src[m_index] : 0;
89 for (
unsigned a = 0 ; a < m_size ; ++a) {
90 if (m_src[a] == src) m_src[a] = 0;
Event-handler interface for newly received data.
Multiplexer connecting a port to one of several controllers.
void data_rcvd(satcat5::io::Readable *src) override
The data_rcvd() callback is polled whenever data is available.
void data_unlink(satcat5::io::Readable *src) override
Unlink this EventListener from the designated source, because the designated Readable object is being...
void select(unsigned idx)
Select the active controller index, or UINT_MAX for none.
~MuxDown() SATCAT5_OPTIONAL_DTOR
Constructor and destructor should only be called by children.
Helper object used inside io::MuxDown.
void attach(Readable *src, Writeable *dst)
Update the redirect configuration to attach or detach this port.
Multiplexer connecting a controller to one of several ports.
void port_set(unsigned idx, Readable *src, Writeable *dst)
Designate the read and write interfaces for the Nth port.
void data_unlink(satcat5::io::Readable *src) override
Unlink this EventListener from the designated source, because the designated Readable object is being...
void data_rcvd(satcat5::io::Readable *src) override
The data_rcvd() callback is polled whenever data is available.
~MuxUp() SATCAT5_OPTIONAL_DTOR
Constructor and destructor should only be called by children.
void select(unsigned idx)
Select the active port index, or UINT_MAX for none.
Abstract API for reading byte-streams and packets.
void read_notify()
Attempt notification by calling m_callback->data_rcvd().
virtual void read_finalize()
Consume any remaining bytes in this frame, if applicable.
virtual bool read_consume(unsigned nbytes)
Read and discard 0 or more bytes.
virtual void set_callback(satcat5::io::EventListener *callback)
Update registered callback for data_rcvd() events.
virtual unsigned get_read_ready() const =0
How many bytes can be read without blocking?
Abstract API for writing byte-streams and packets.
Multiplexers for selecting one of several I/O interfaces.
satcat5::io::NullWrite null_write
Global instance of the basic NullWrite object.