OpenLexocad  27.1
Base::Observer< _MessageType > Class Template Referenceabstract

#include <Observer.h>

Public Member Functions

 Observer ()
 
virtual ~Observer ()
 
virtual void onChange (Subject< _MessageType > *rCaller, _MessageType rcReason)=0
 
virtual void onDestroy (Subject< _MessageType > &)
 
virtual const char * name (void)
 
void setObserverPriority (int priority)
 
int getObserverPriority () const
 
void setAttached (Subject< _MessageType > *t)
 
void setDetached (Subject< _MessageType > *t)
 

Public Attributes

long __deadVal = 0xBADEAFFE
 

Detailed Description

template<class _MessageType>
class Base::Observer< _MessageType >

Observer class Implementation of the well known Observer Design Pattern. The observed object, which inherit FCSubject, will call all its observers in case of changes. A observer class has to Attach itself to the observed object.

See also
FCSubject

Constructor & Destructor Documentation

◆ Observer()

template<class _MessageType>
Base::Observer< _MessageType >::Observer ( )
inline

A constructor. No special function so far.

◆ ~Observer()

template<class _MessageType>
virtual Base::Observer< _MessageType >::~Observer ( )
inlinevirtual

A destructor. No special function so far.

Member Function Documentation

◆ getObserverPriority()

template<class _MessageType>
int Base::Observer< _MessageType >::getObserverPriority ( ) const
inline

◆ name()

template<class _MessageType>
virtual const char* Base::Observer< _MessageType >::name ( void  )
inlinevirtual

This method can be reimplemented from the concrete Observer and returns the name of the observer. Needed to use the Get method of the Subject.

◆ onChange()

template<class _MessageType>
virtual void Base::Observer< _MessageType >::onChange ( Subject< _MessageType > *  rCaller,
_MessageType  rcReason 
)
pure virtual

This method need to be reimplemented from the concrete Observer and get called by the observed class

Parameters
pCallera reference to the calling object

◆ onDestroy()

template<class _MessageType>
virtual void Base::Observer< _MessageType >::onDestroy ( Subject< _MessageType > &  )
inlinevirtual

This method need to be reimplemented from the concrete Observer and get called by the observed class

Parameters
pCallera reference to the calling object

◆ setAttached()

template<class _MessageType>
void Base::Observer< _MessageType >::setAttached ( Subject< _MessageType > *  t)
inline

◆ setDetached()

template<class _MessageType>
void Base::Observer< _MessageType >::setDetached ( Subject< _MessageType > *  t)
inline

◆ setObserverPriority()

template<class _MessageType>
void Base::Observer< _MessageType >::setObserverPriority ( int  priority)
inline

Observers with higher priority will be called first. Default priority is 1.

Member Data Documentation

◆ __deadVal

template<class _MessageType>
long Base::Observer< _MessageType >::__deadVal = 0xBADEAFFE

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