conduit 0.6.0
Modern C++23 header-only event-dispatching / event-transport library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
conduit::FilteredTransport Class Reference

Wrapper that gates events flowing through an inner transport on both legs. More...

#include <filtered_transport.hpp>

Inheritance diagram for conduit::FilteredTransport:
Inheritance graph
[legend]
Collaboration diagram for conduit::FilteredTransport:
Collaboration graph
[legend]

Public Types

using Predicate = std::function< bool(const EventEnvelopeView &)>
 

Public Member Functions

 FilteredTransport (std::shared_ptr< Transport > inner, Predicate outbound={}, Predicate inbound={})
 
TransportScope scope () const noexcept override
 
void attach (Bus &bus) override
 Attach to a bus.
 
void attach_with_sink (Bus &bus, InboundSink sink) override
 Attach to a bus using a caller-supplied inbound sink.
 
void detach () noexcept override
 
void dispatch (const EventEnvelopeView &v) override
 
void flush () override
 
const std::shared_ptr< Transport > & inner () const noexcept
 
- Public Member Functions inherited from conduit::Transport
 Transport ()=default
 
 Transport (const Transport &)=delete
 
 Transport (Transport &&) noexcept=default
 
Transportoperator= (const Transport &)=delete
 
Transportoperator= (Transport &&) noexcept=default
 
 ~Transport () override=default
 

Additional Inherited Members

- Protected Member Functions inherited from conduit::Transport
void deliver_inbound (const EventEnvelopeView &v) const
 Subclasses call this for inbound delivery instead of touching the bus directly.
 
Busbus () const noexcept
 

Detailed Description

Wrapper that gates events flowing through an inner transport on both legs.

The outbound predicate runs in dispatch() — false suppresses the publish. The inbound predicate runs on the sink installed at attach time — false suppresses delivery to the bus's listeners. Either predicate may be empty, meaning "pass everything." A predicate that throws is treated the same as one that returned false; the envelope is dropped.

scope(), detach(), and flush() simply forward to the inner transport — wrappers don't shift the local/remote scope or own broker connections.

Member Typedef Documentation

◆ Predicate

using conduit::FilteredTransport::Predicate = std::function<bool(const EventEnvelopeView&)>

Constructor & Destructor Documentation

◆ FilteredTransport()

conduit::FilteredTransport::FilteredTransport ( std::shared_ptr< Transport inner,
Predicate  outbound = {},
Predicate  inbound = {} 
)
inlineexplicit

Member Function Documentation

◆ attach()

void conduit::FilteredTransport::attach ( Bus bus)
inlineoverridevirtual

Attach to a bus.

The base implementation builds an inbound sink that forwards to bus.deliver_to_listeners and delegates to attach_with_sink. Subclasses that need to do per-attach work (open connections, subscribe to topics) should override attach_with_sink.

Reimplemented from conduit::Transport.

◆ attach_with_sink()

void conduit::FilteredTransport::attach_with_sink ( Bus bus,
InboundSink  sink 
)
inlineoverridevirtual

Attach to a bus using a caller-supplied inbound sink.

Wrappers use this to intercept the inbound leg without each transport needing to re-implement the hook.

Reimplemented from conduit::Transport.

◆ detach()

void conduit::FilteredTransport::detach ( )
inlineoverridevirtualnoexcept

Reimplemented from conduit::Transport.

◆ dispatch()

void conduit::FilteredTransport::dispatch ( const EventEnvelopeView v)
inlineoverridevirtual

Implements conduit::Transport.

◆ flush()

void conduit::FilteredTransport::flush ( )
inlineoverridevirtual

Reimplemented from conduit::Transport.

◆ inner()

const std::shared_ptr< Transport > & conduit::FilteredTransport::inner ( ) const
inlinenoexcept

◆ scope()

TransportScope conduit::FilteredTransport::scope ( ) const
inlineoverridevirtualnoexcept

Implements conduit::Transport.


The documentation for this class was generated from the following file: