version 0.4.4
Ikarus::ControlRoutineBase< F, S, Args > Struct Template Reference

Base for all control routines. Defines the message interface that can be broadcasted to listeners. More...

#include <ikarus/controlroutines/controlroutinebase.hh>

Inheritance diagram for Ikarus::ControlRoutineBase< F, S, Args >:
[legend]

Public Types

using State = S
 
using MessageType = ControlMessages
 
using Callback = std::function< void(ControlMessages, const State &)>
 
using Token = std::shared_ptr< Callback >
 

Public Member Functions

Token registerListener (Callback callback)
 This method is used to register a Listener function. More...
 
void unregisterListener (Token token)
 deregisters a specific function More...
 
void notify (ControlMessages message, const State &data)
 This calls all the registered functions. More...
 

Detailed Description

template<typename F, typename S = ControlRoutineStateType<F>, typename... Args>
struct Ikarus::ControlRoutineBase< F, S, Args >
Template Parameters
FType of the differentiable function to solve.
ArgsAdditional custom message signatures, that can be broadcasted

Member Typedef Documentation

◆ Callback

using Ikarus::Broadcaster< ControlMessages , ControlRoutineStateType< F > >::Callback = std::function<void(ControlMessages , const State&)>
inherited

◆ MessageType

◆ State

template<typename F , typename S = ControlRoutineStateType<F>, typename... Args>
using Ikarus::ControlRoutineBase< F, S, Args >::State = S

◆ Token

using Ikarus::Broadcaster< ControlMessages , ControlRoutineStateType< F > >::Token = std::shared_ptr<Callback>
inherited

Member Function Documentation

◆ notify()

void Ikarus::Broadcaster< ControlMessages , ControlRoutineStateType< F > >::notify ( ControlMessages  message,
const State data 
)
inlineinherited

◆ registerListener()

Token Ikarus::Broadcaster< ControlMessages , ControlRoutineStateType< F > >::registerListener ( Callback  callback)
inlineinherited

The function that is passed in is first stored in a shared_ptr. After this, the shared_ptr is added to the vector of listener functions, which leads to a implicit conversion to a weak_ptr. The shared_ptr is then returned to the Listener that has called this function to be stored in a vector of shared_ptr<void> listener.hh.

Parameters
callbackthe callback function
Returns
Token

◆ unregisterListener()

void Ikarus::Broadcaster< ControlMessages , ControlRoutineStateType< F > >::unregisterListener ( Token  token)
inlineinherited

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