Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
VoidObserver Class Reference

Simple observer class (for void functions/slots). More...

#include <ObserverPattern.h>

Inheritance diagram for VoidObserver:
Observer

Public Member Functions

void setSlot (const std::function< void()> &func)
 Sets the function/slot for the oberver. More...
 
void update () override
 Calls the function/slot. More...
 
 VoidObserver ()
 
 ~VoidObserver ()
 
- Public Member Functions inherited from Observer
virtual void update ()=0
 
virtual ~Observer ()
 

Private Attributes

std::function< void()> m_slot
 

Detailed Description

Simple observer class (for void functions/slots).

This is used to update when a change has been made on an observerable.

Definition at line 56 of file ObserverPattern.h.

Constructor & Destructor Documentation

◆ VoidObserver()

VoidObserver::VoidObserver ( )
inline

Definition at line 58 of file ObserverPattern.h.

◆ ~VoidObserver()

VoidObserver::~VoidObserver ( )
inline

Definition at line 59 of file ObserverPattern.h.

Member Function Documentation

◆ setSlot()

void VoidObserver::setSlot ( const std::function< void()> &  func)
inline

Sets the function/slot for the oberver.

Parameters
func,:the void function we want to call when the observer sends a notify signal

Definition at line 65 of file ObserverPattern.h.

References m_slot.

◆ update()

void VoidObserver::update ( )
inlineoverridevirtual

Calls the function/slot.

Implements Observer.

Definition at line 69 of file ObserverPattern.h.

References m_slot.

Member Data Documentation

◆ m_slot

std::function<void()> VoidObserver::m_slot
private

Definition at line 72 of file ObserverPattern.h.

Referenced by setSlot(), and update().


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