Base::Subject< _MessageType > Class Template Reference

Subject class Implementation of the well known Observer Design Pattern. More...

#include <Observer.h>

List of all members.

Public Types

typedef _MessageType MessageType
typedef Observer< _MessageType > ObserverType
typedef Subject< _MessageType > SubjectType

Public Member Functions

void Attach (Observer< _MessageType > *ToObserv)
 Attach an Observer Attach an Observer to the list of Observers which get called when Notify is called.
void ClearObserver ()
 Clears the list of all registered observers.
void Detach (Observer< _MessageType > *ToObserv)
 Detach an Observer Detach an Observer from the list of Observers which get called when Notify is called.
Observer< _MessageType > * Get (const char *Name)
 Get an Observer by name Get a observer by name if the observer reimplements the Name() mthode.
void Notify (_MessageType rcReason)
 Notify all Observers Send a message to all Observers attached to this subject.
 Subject ()
 A constructor.
virtual ~Subject ()
 A destructor.

Protected Attributes

std::set< Observer
< _MessageType > * > 
_ObserverSet
 Vector of attached observers.

Detailed Description

template<class _MessageType>
class Base::Subject< _MessageType >

Subject 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:
FCObserver

Definition at line 99 of file Observer.h.


Member Typedef Documentation

template<class _MessageType>
typedef _MessageType Base::Subject< _MessageType >::MessageType

Definition at line 104 of file Observer.h.

template<class _MessageType>
typedef Observer<_MessageType> Base::Subject< _MessageType >::ObserverType

Definition at line 103 of file Observer.h.

template<class _MessageType>
typedef Subject<_MessageType> Base::Subject< _MessageType >::SubjectType

Definition at line 105 of file Observer.h.


Constructor & Destructor Documentation

template<class _MessageType>
Base::Subject< _MessageType >::Subject (  )  [inline]

A constructor.

No special function so far.

Definition at line 111 of file Observer.h.

template<class _MessageType>
virtual Base::Subject< _MessageType >::~Subject (  )  [inline, virtual]

A destructor.

No special function so far.

Definition at line 117 of file Observer.h.


Member Function Documentation

template<class _MessageType>
void Base::Subject< _MessageType >::Attach ( Observer< _MessageType > *  ToObserv  )  [inline]
template<class _MessageType>
void Base::Subject< _MessageType >::ClearObserver (  )  [inline]

Clears the list of all registered observers.

Note:
Using this function in your code may be an indication of design problems.

Definition at line 196 of file Observer.h.

template<class _MessageType>
void Base::Subject< _MessageType >::Detach ( Observer< _MessageType > *  ToObserv  )  [inline]
template<class _MessageType>
Observer<_MessageType>* Base::Subject< _MessageType >::Get ( const char *  Name  )  [inline]

Get an Observer by name Get a observer by name if the observer reimplements the Name() mthode.

See also:
Observer

Definition at line 180 of file Observer.h.

template<class _MessageType>
void Base::Subject< _MessageType >::Notify ( _MessageType  rcReason  )  [inline]

Notify all Observers Send a message to all Observers attached to this subject.

The Message depends on the implementation of a concrete Oberserver and Subject.

See also:
Notify

Definition at line 170 of file Observer.h.

Referenced by InspectionGui::ViewProviderInspection::attach(), MeshGui::ViewProviderMeshCurvature::attach(), InspectionGui::ViewProviderInspection::onChanged(), and InspectionGui::ViewProviderInspection::updateData().


Member Data Documentation

template<class _MessageType>
std::set<Observer <_MessageType> *> Base::Subject< _MessageType >::_ObserverSet [protected]

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

Generated on Wed Nov 23 19:01:48 2011 for FreeCAD by  doxygen 1.6.1