mpqc::utility::Observer Class Reference

Documentation

helps to set up messaging between objects via the Observer pattern

Use as a base class for any class that wants to receive messages from Observable objects.

See also
Observable

Public Member Functions

 Observer ()=default
 
template<typename Observee >
 Observer (Observee *observee, std::function< void()> message)
 
 Observer (const Observer &other)=delete
 
Observeroperator= (const Observer &other)=delete
 
 Observer (Observer &&other)=default
 
Observeroperator= (Observer &&other)=default
 
virtual ~Observer ()
 

Protected Member Functions

template<typename Observee >
void register_message (Observee *observee, std::function< void()> message)
 
void clear_messages ()
 

Constructor & Destructor Documentation

◆ Observer() [1/4]

mpqc::utility::Observer::Observer ( )
default

The default ctor

Note
using the default ctor requires you to call register_message manually

◆ Observer() [2/4]

template<typename Observee >
mpqc::utility::Observer::Observer ( Observee *  observee,
std::function< void()>  message 
)
inline

This constructor registers one message

Parameters
observeethe Observee object to send us the message
messagethe message to be sent

◆ Observer() [3/4]

mpqc::utility::Observer::Observer ( const Observer other)
delete

◆ Observer() [4/4]

mpqc::utility::Observer::Observer ( Observer &&  other)
default

◆ ~Observer()

virtual mpqc::utility::Observer::~Observer ( )
inlinevirtual

Member Function Documentation

◆ clear_messages()

void mpqc::utility::Observer::clear_messages ( )
inlineprotected

◆ operator=() [1/2]

Observer& mpqc::utility::Observer::operator= ( const Observer other)
delete

◆ operator=() [2/2]

Observer& mpqc::utility::Observer::operator= ( Observer &&  other)
default

◆ register_message()

template<typename Observee >
void mpqc::utility::Observer::register_message ( Observee *  observee,
std::function< void()>  message 
)
inlineprotected

registers a message with an Observee object, will be called whenever Observee::update() is called on observee

Template Parameters
Observeea class derived from Observable

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