ObserverPattern
Public Member Functions | Protected Member Functions | List of all members
Observer::RawContainer< T_Listener > Class Template Reference

A container of listeners, which holds raw pointers. More...

#include <observer.h>

Public Member Functions

void attach (T_Listener *listener)
 Attach listener listener to this container. More...
 
void detach (T_Listener *listener)
 Detach listener listener from this container. More...
 

Protected Member Functions

template<typename... Fn_Args>
void notify (void(T_Listener::*fn)(Fn_Args...), Fn_Args &&... args)
 Call a notification function as specified by the first parameter. More...
 

Detailed Description

template<class T_Listener>
class Observer::RawContainer< T_Listener >

A container of listeners, which holds raw pointers.

This is a collection of pointers to listener objects of a single type, which is defined by the template parameter. The container is to be used in Source class.

Member Function Documentation

◆ attach()

template<class T_Listener >
void Observer::RawContainer< T_Listener >::attach ( T_Listener *  listener)
inline

Attach listener listener to this container.

When attached, notifications are sent to the listener.

◆ detach()

template<class T_Listener >
void Observer::RawContainer< T_Listener >::detach ( T_Listener *  listener)
inline

Detach listener listener from this container.

When detached, notifications aren't sent to the listener anymore.

◆ notify()

template<class T_Listener >
template<typename... Fn_Args>
void Observer::RawContainer< T_Listener >::notify ( void(T_Listener::*)(Fn_Args...)  fn,
Fn_Args &&...  args 
)
inlineprotected

Call a notification function as specified by the first parameter.

All listeners registered in this container are notified. The parameter pack is forwarded to that function.


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