Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
DirectHubInterface< T > Class Template Referenceabstract

Interface for a the central part of a hub. More...

#include <DirectHub.hxx>

Inheritance diagram for DirectHubInterface< T >:
Destructable DirectHubImpl< T >

Public Member Functions

virtual Serviceget_service ()=0
 
virtual void register_port (DirectHubPort< T > *port)=0
 Adds a port to this hub.
 
virtual void unregister_port (DirectHubPort< T > *port)=0
 Synchronously removes a port from this hub.
 
virtual void unregister_port (DirectHubPort< T > *port, Notifiable *done)=0
 Asynchronously removes a port from this hub.
 
virtual void enqueue_send (Executable *caller)=0
 Signals that the caller wants to send a message to the hub.
 
virtual MessageAccessor< T > * mutable_message ()=0
 Accessor to fill in the message payload.
 
virtual void do_send ()=0
 Sends a message to the hub.
 

Detailed Description

template<class T>
class DirectHubInterface< T >

Interface for a the central part of a hub.

Definition at line 165 of file DirectHub.hxx.

Member Function Documentation

◆ do_send()

template<class T >
virtual void DirectHubInterface< T >::do_send ( )
pure virtual

Sends a message to the hub.

Before this is called, the message has to be filled in via mutable_message().

Implemented in DirectHubImpl< T >.

◆ enqueue_send()

template<class T >
virtual void DirectHubInterface< T >::enqueue_send ( Executable caller)
pure virtual

Signals that the caller wants to send a message to the hub.

When the hub is ready for that, will execute *caller. This might happen inline within this function call, or on a different executor.

Parameters
callercallback that actually sends the message. It is required to call do_send() inline.

Implemented in DirectHubImpl< T >.

◆ get_service()

template<class T >
virtual Service * DirectHubInterface< T >::get_service ( )
pure virtual
Returns
an executor service.

Implemented in DirectHubImpl< T >.

◆ mutable_message()

template<class T >
virtual MessageAccessor< T > * DirectHubInterface< T >::mutable_message ( )
pure virtual

Accessor to fill in the message payload.

Must be called only from within the callback as invoked by enqueue_send.

Returns
mutable structure to fill in the message. This structure was cleared by the hub before it is returned here.

Implemented in DirectHubImpl< T >.

◆ register_port()

template<class T >
virtual void DirectHubInterface< T >::register_port ( DirectHubPort< T > *  port)
pure virtual

Adds a port to this hub.

This port will be receiving all further messages.

Parameters
portthe downstream port.

Implemented in DirectHubImpl< T >.

◆ unregister_port() [1/2]

template<class T >
virtual void DirectHubInterface< T >::unregister_port ( DirectHubPort< T > *  port)
pure virtual

Synchronously removes a port from this hub.

This port must have been registered previously. Must not be called on the main executor.

Parameters
portthe downstream port.

Implemented in DirectHubImpl< T >.

◆ unregister_port() [2/2]

template<class T >
virtual void DirectHubInterface< T >::unregister_port ( DirectHubPort< T > *  port,
Notifiable done 
)
pure virtual

Asynchronously removes a port from this hub.

This port must have been registered previously.

Parameters
portthe downstream port.
donewill be notified when the removal is complete.

Implemented in DirectHubImpl< T >.


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