version 0.4.1
Ikarus::GenericListener< M > Class Template Reference

GenericListener class for observing specific messages. This class template implements an listener for a specific message type. More...

#include <ikarus/utils/listener/genericlistener.hh>

Inheritance diagram for Ikarus::GenericListener< M >:
[legend]

Public Types

using Token = std::shared_ptr< void >
 

Public Member Functions

template<typename F >
 GenericListener (Messages message, F &&f)
 Constructor for GenericListener. More...
 
template<typename BC >
GenericListenersubscribeTo (BC &bc)
 
void updateImpl (Messages message)
 
template<typename Broadcaster , typename F >
auto subscribe (Broadcaster &broadcaster, F &&f)
 Function to subscribe to a broadcaster with a given function (either a lambda, std::function or function pointer). More...
 
template<typename Broadcaster , typename Signature , typename F >
requires (not Concepts::PointerOrSmartPointer<Broadcaster>)
auto subscribe (Broadcaster &broadcaster, F &&f)
 Function to subscribe to a broadcaster with a given function (either a lambda, std::function or function pointer). More...
 
void unSubscribeAll ()
 Unsubscribe from all listeners. At the moment unsubscribing can't be done more granularly. More...
 
void unSubscribeLast ()
 Unsubscribe from the last subscribed listener. More...
 
void unSubscribe (Token &&ts)
 

Detailed Description

template<typename M>
class Ikarus::GenericListener< M >
Template Parameters
MThe type of messages to be listend to.

Member Typedef Documentation

◆ Token

using Ikarus::Listener::Token = std::shared_ptr<void>
inherited

Constructor & Destructor Documentation

◆ GenericListener()

template<typename M >
template<typename F >
Ikarus::GenericListener< M >::GenericListener ( Messages  message,
F &&  f 
)
inline

Initializes the listener with a specific message and a function to be executed upon listening.

Template Parameters
FType of the function to be executed.
Parameters
messageThe message to be listend to.
fThe function to be executed with the current step.

Member Function Documentation

◆ subscribe() [1/2]

template<typename Broadcaster , typename F >
auto Ikarus::Listener::subscribe ( Broadcaster broadcaster,
F &&  f 
)
inlineinherited

This function deducts the types of the arguments itself and then forwards it. If there are problems with type deduction use the function below and specify the types of the arguments manually.

Template Parameters
Broadcasterthe type of the Broadcaster (for example a NonlinearSolver or ControlRoutine), can either be a pointer or value.
Fthe type of the function
Parameters
broadcasterthe broadcaster
fthe function
Here is the caller graph for this function:

◆ subscribe() [2/2]

template<typename Broadcaster , typename Signature , typename F >
requires (not Concepts::PointerOrSmartPointer<Broadcaster>)
auto Ikarus::Listener::subscribe ( Broadcaster broadcaster,
F &&  f 
)
inlineinherited
Template Parameters
Broadcasterthe type of the Broadcaster (for example a NonlinearSolver or ControlRoutine), can either be a pointer or value.
Signaturethe exact signature of the function F
Fthe type of the function
Parameters
broadcasterthe broadcaster
fthe function

◆ subscribeTo()

template<typename M >
template<typename BC >
GenericListener & Ikarus::GenericListener< M >::subscribeTo ( BC &  bc)
inline

◆ unSubscribe()

void Ikarus::Listener::unSubscribe ( Token &&  ts)
inlineinherited

◆ unSubscribeAll()

void Ikarus::Listener::unSubscribeAll ( )
inlineinherited

◆ unSubscribeLast()

void Ikarus::Listener::unSubscribeLast ( )
inlineinherited

◆ updateImpl()

template<typename M >
void Ikarus::GenericListener< M >::updateImpl ( Messages  message)
inline
Here is the caller graph for this function:

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