lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lintel::EventBusView Class Reference

#include <EventBus.h>

Inheritance diagram for lintel::EventBusView:
lintel::IEventBus

Public Member Functions

 EventBusView (EventBus &bus)
 
const char * getName () const override
 
EventBusConfig getConfig () const override
 
bool isLockFree () const override
 
bool registerTopic (const std::string &topic) override
 
bool isTopicRegistered (const std::string &topic) const override
 
std::size_t topicCount () const override
 
bool subscribe (const std::string &topic, const std::string &subscriber) override
 
bool unsubscribe (const std::string &topic, const std::string &subscriber) override
 
bool isSubscribed (const std::string &topic, const std::string &subscriber) const override
 
std::size_t numberOfSubscribersOf (const std::string &topic) const override
 
std::size_t subscriberCount () const override
 
bool publish (const Event &event) override
 
bool publishToSubscribers (const Event &event) override
 
std::optional< Event > receive () override
 
std::optional< Event > receiveOf (const std::string &subscriber) override
 
bool isEmpty () const override
 
bool isEmptyOf (const std::string &subscriber) const override
 
std::int64_t sequenceOf () const override
 
std::uint64_t droppedEventsOf () const override
 
void reset () override
 
- Public Member Functions inherited from lintel::IEventBus
virtual ~IEventBus ()=default
 

Detailed Description

Local adapter that exposes a shared memory EventBus through IEventBus.

Constructor & Destructor Documentation

◆ EventBusView()

lintel::EventBusView::EventBusView ( EventBus &  bus)
inlineexplicit

Construct a view around a shared memory bus.

Parameters
busthe shared memory event bus

Member Function Documentation

◆ droppedEventsOf()

std::uint64_t lintel::EventBusView::droppedEventsOf ( ) const
inlineoverridevirtual
Returns
the number of events that were dropped due to full queues

Implements lintel::IEventBus.

◆ getConfig()

EventBusConfig lintel::EventBusView::getConfig ( ) const
inlineoverridevirtual
Returns
the configuration the bus was created with

Implements lintel::IEventBus.

◆ getName()

const char * lintel::EventBusView::getName ( ) const
inlineoverridevirtual
Returns
the name of the bus

Implements lintel::IEventBus.

◆ isEmpty()

bool lintel::EventBusView::isEmpty ( ) const
inlineoverridevirtual
Returns
true if the point-to-point bus queue is empty

Implements lintel::IEventBus.

◆ isEmptyOf()

bool lintel::EventBusView::isEmptyOf ( const std::string &  subscriber) const
inlineoverridevirtual
Parameters
subscriberthe subscriber name
Returns
true if the subscriber queue is empty or unknown

Implements lintel::IEventBus.

◆ isLockFree()

bool lintel::EventBusView::isLockFree ( ) const
inlineoverridevirtual
Returns
true if the underlying queues are lock-free

Implements lintel::IEventBus.

◆ isSubscribed()

bool lintel::EventBusView::isSubscribed ( const std::string &  topic,
const std::string &  subscriber 
) const
inlineoverridevirtual
Parameters
topicthe topic name
subscriberthe subscriber name
Returns
true if the subscriber is subscribed to the topic

Implements lintel::IEventBus.

◆ isTopicRegistered()

bool lintel::EventBusView::isTopicRegistered ( const std::string &  topic) const
inlineoverridevirtual
Parameters
topicthe topic name
Returns
true if the topic is registered

Implements lintel::IEventBus.

◆ numberOfSubscribersOf()

std::size_t lintel::EventBusView::numberOfSubscribersOf ( const std::string &  topic) const
inlineoverridevirtual
Parameters
topicthe topic name
Returns
the number of subscribers of the topic

Implements lintel::IEventBus.

◆ publish()

bool lintel::EventBusView::publish ( const Event &  event)
inlineoverridevirtual

Publish an event into the point-to-point bus queue.

Parameters
eventthe event to publish
Returns
false if the bus queue is full

Implements lintel::IEventBus.

◆ publishToSubscribers()

bool lintel::EventBusView::publishToSubscribers ( const Event &  event)
inlineoverridevirtual

Publish an event to every subscriber of the event topic.

Parameters
eventthe event to publish
Returns
false if no subscriber received the event

Implements lintel::IEventBus.

◆ receive()

std::optional< Event > lintel::EventBusView::receive ( )
inlineoverridevirtual

Receive the next event from the point-to-point bus queue.

Returns
the event or std::nullopt if the queue is empty

Implements lintel::IEventBus.

◆ receiveOf()

std::optional< Event > lintel::EventBusView::receiveOf ( const std::string &  subscriber)
inlineoverridevirtual

Receive the next event of a subscriber queue.

Parameters
subscriberthe subscriber name
Returns
the event or std::nullopt if the queue is empty

Implements lintel::IEventBus.

◆ registerTopic()

bool lintel::EventBusView::registerTopic ( const std::string &  topic)
inlineoverridevirtual

Register a topic on the bus (idempotent).

Parameters
topicthe topic name
Returns
false if the topic table is full

Implements lintel::IEventBus.

◆ reset()

void lintel::EventBusView::reset ( )
inlineoverridevirtual

Drop all queued events on the bus and every subscriber queue.

Implements lintel::IEventBus.

◆ sequenceOf()

std::int64_t lintel::EventBusView::sequenceOf ( ) const
inlineoverridevirtual
Returns
the last assigned sequence number

Implements lintel::IEventBus.

◆ subscribe()

bool lintel::EventBusView::subscribe ( const std::string &  topic,
const std::string &  subscriber 
)
inlineoverridevirtual

Subscribe a named subscriber to a topic.

Parameters
topicthe topic name
subscriberthe subscriber name
Returns
false if the topic does not exist or the table is full

Implements lintel::IEventBus.

◆ subscriberCount()

std::size_t lintel::EventBusView::subscriberCount ( ) const
inlineoverridevirtual
Returns
the number of reserved subscriber slots

Implements lintel::IEventBus.

◆ topicCount()

std::size_t lintel::EventBusView::topicCount ( ) const
inlineoverridevirtual
Returns
the number of registered topics

Implements lintel::IEventBus.

◆ unsubscribe()

bool lintel::EventBusView::unsubscribe ( const std::string &  topic,
const std::string &  subscriber 
)
inlineoverridevirtual

Unsubscribe a named subscriber from a topic.

Parameters
topicthe topic name
subscriberthe subscriber name
Returns
true if the subscriber was removed

Implements lintel::IEventBus.


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