FreeCAD C++
Public Member Functions | List of all members
Base::Observer< _MessageType > Class Template Referenceabstract

#include <Base/Observer.h>

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

Public Member Functions

 Observer ()
 
virtual ~Observer ()
 
virtual void OnChange (Subject< _MessageType > &rCaller, _MessageType rcReason)=0
 
virtual void OnDestroy (Subject< _MessageType > &rCaller)
 
virtual const char * Name (void)
 

Constructor & Destructor Documentation

◆ Observer()

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

A constructor. No special function so far.

◆ ~Observer()

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

A destructor. No special function so far.

Member Function Documentation

◆ Name()

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

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
rCallera reference to the calling object
rcReason

Implemented in Gui::MacroManager, MeshGui::ViewProviderMeshCurvature, and InspectionGui::ViewProviderInspection.

◆ OnDestroy()

template<class _MessageType>
virtual void Base::Observer< _MessageType >::OnDestroy ( Subject< _MessageType > &  rCaller)
virtual

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

Parameters
rCallera reference to the calling object