version 0.4.1
Ikarus::IObservable< MessageType > Class Template Reference

Generic observable interface for the Observer design pattern. See [3] for a description of the design pattern. More...

#include <ikarus/utils/observer/observer.hh>

Inheritance diagram for Ikarus::IObservable< MessageType >:
[legend]

Public Member Functions

 IObservable ()
 
virtual ~IObservable ()=default
 
void subscribe (MessageType message, std::shared_ptr< IObserver< MessageType > > observer)
 Subscribe an observer to receive notifications for a specific message type. More...
 
void subscribeAll (std::shared_ptr< IObserver< MessageType > > observer)
 Subscribe an observer to receive notifications for all message types. More...
 
void subscribeAll (std::initializer_list< std::shared_ptr< IObserver< MessageType > > > observers)
 Subscribe multiple observers to receive notifications for all message types. More...
 
void unSubscribe (MessageType message, std::shared_ptr< IObserver< MessageType > > observer)
 Unsubscribe an observer from receiving notifications for a specific message type. More...
 
void unSubscribeAll (std::shared_ptr< IObserver< MessageType > > observer)
 Unsubscribe an observer from receiving notifications for all message types. More...
 
void notify (MessageType message)
 Notify observers about a specific message type. More...
 
template<std::floating_point ScalarType>
void notify (MessageType message, ScalarType val)
 Notify observers about a specific message type with a floating-point value. More...
 
void notify (MessageType message, int val)
 Notify observers about a specific message type with an integer value. More...
 
void notify (MessageType message, const std::string &val)
 Notify observers about a specific message type with a string value. More...
 
void notify (MessageType message, int val1, double val2)
 Notify observers about a specific message type with an integer and a double value. More...
 
void notify (MessageType message, int val1, const std::string &val2)
 Notify observers about a specific message type with an integer value and a string value. More...
 
template<std::floating_point ScalarType>
void notify (MessageType message, Eigen::VectorX< ScalarType > vec)
 Notify observers about a specific message type with an Eigen::VectorX. More...
 
template<typename MT >
void notify (MT message)
 
template<std::floating_point ScalarType>
void notify (MT message, ScalarType val)
 
template<typename MT >
void notify (MT message, int val)
 
template<typename MT >
void notify (MT message, const std::string &val)
 
template<typename MT >
void notify (MT message, int val1, double val2)
 
template<typename MT >
void notify (MT message, int val1, const std::string &val2)
 
template<std::floating_point ScalarType>
void notify (MT message, Eigen::VectorX< ScalarType > vec)
 

Detailed Description

template<typename MessageType>
class Ikarus::IObservable< MessageType >
Template Parameters
MessageTypeThe type of message that the observable can handle.

Constructor & Destructor Documentation

◆ IObservable()

template<typename MessageType >
Ikarus::IObservable< MessageType >::IObservable ( )
inline

◆ ~IObservable()

template<typename MessageType >
virtual Ikarus::IObservable< MessageType >::~IObservable ( )
virtualdefault

Member Function Documentation

◆ notify() [1/14]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::notify ( MessageType  message)
Parameters
messageThe message type to notify about.

◆ notify() [2/14]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::notify ( MessageType  message,
const std::string &  val 
)
Parameters
messageThe message type to notify about.
valThe string value to be sent with the notification.

◆ notify() [3/14]

template<typename MessageType >
template<std::floating_point ScalarType>
void Ikarus::IObservable< MessageType >::notify ( MessageType  message,
Eigen::VectorX< ScalarType >  vec 
)
Template Parameters
ScalarTypeThe type of the elements in the Eigen::VectorX.
Parameters
messageThe message type to notify about.
vecThe Eigen::VectorX to be sent with the notification.

◆ notify() [4/14]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::notify ( MessageType  message,
int  val 
)
Parameters
messageThe message type to notify about.
valThe integer value to be sent with the notification.

◆ notify() [5/14]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::notify ( MessageType  message,
int  val1,
const std::string &  val2 
)
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The string value to be sent with the notification.

◆ notify() [6/14]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::notify ( MessageType  message,
int  val1,
double  val2 
)
Parameters
messageThe message type to notify about.
val1The integer value to be sent with the notification.
val2The double value to be sent with the notification.

◆ notify() [7/14]

template<typename MessageType >
template<std::floating_point ScalarType>
void Ikarus::IObservable< MessageType >::notify ( MessageType  message,
ScalarType  val 
)
Template Parameters
ScalarTypeThe type of the floating-point value.
Parameters
messageThe message type to notify about.
valThe floating-point value to be sent with the notification.

◆ notify() [8/14]

template<typename MessageType >
template<typename MT >
void Ikarus::IObservable< MessageType >::notify ( MT  message)

◆ notify() [9/14]

template<typename MessageType >
template<typename MT >
void Ikarus::IObservable< MessageType >::notify ( MT  message,
const std::string &  val 
)

◆ notify() [10/14]

template<typename MessageType >
template<std::floating_point ScalarType>
void Ikarus::IObservable< MessageType >::notify ( MT  message,
Eigen::VectorX< ScalarType >  vec 
)

◆ notify() [11/14]

template<typename MessageType >
template<typename MT >
void Ikarus::IObservable< MessageType >::notify ( MT  message,
int  val 
)

◆ notify() [12/14]

template<typename MessageType >
template<typename MT >
void Ikarus::IObservable< MessageType >::notify ( MT  message,
int  val1,
const std::string &  val2 
)

◆ notify() [13/14]

template<typename MessageType >
template<typename MT >
void Ikarus::IObservable< MessageType >::notify ( MT  message,
int  val1,
double  val2 
)

◆ notify() [14/14]

template<typename MessageType >
template<std::floating_point ScalarType>
void Ikarus::IObservable< MessageType >::notify ( MT  message,
ScalarType  val 
)

◆ subscribe()

template<typename MessageType >
void Ikarus::IObservable< MT >::subscribe ( MessageType  message,
std::shared_ptr< IObserver< MessageType > >  observer 
)
Parameters
messageThe message type to subscribe to.
observerThe observer to be subscribed.

◆ subscribeAll() [1/2]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::subscribeAll ( std::initializer_list< std::shared_ptr< IObserver< MessageType > > >  observers)
Parameters
observersList of observers to be subscribed.

◆ subscribeAll() [2/2]

template<typename MessageType >
void Ikarus::IObservable< MessageType >::subscribeAll ( std::shared_ptr< IObserver< MessageType > >  observer)
Parameters
observerThe observer to be subscribed.

◆ unSubscribe()

template<typename MessageType >
void Ikarus::IObservable< MT >::unSubscribe ( MessageType  message,
std::shared_ptr< IObserver< MessageType > >  observer 
)
Parameters
messageThe message type to unsubscribe from.
observerThe observer to be unsubscribed.

◆ unSubscribeAll()

template<typename MessageType >
void Ikarus::IObservable< MT >::unSubscribeAll ( std::shared_ptr< IObserver< MessageType > >  observer)
Parameters
observerThe observer to be unsubscribed.

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