MNE-CPP  0.1.9
A Framework for Electrophysiology
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
UTILSLIB::Subject Class Reference

The Subject class provides the base class of every subject of the observer design pattern. More...

#include <observerpattern.h>

Public Types

typedef QSharedPointer< SubjectSPtr
 
typedef QSharedPointer< const SubjectConstSPtr
 
typedef QSet< IObserver * > t_Observers
 

Public Member Functions

virtual ~Subject ()
 
void attach (IObserver *pObserver)
 
void detach (IObserver *pObserver)
 
void notify ()
 
t_Observersobservers ()
 
int observerNumDebug ()
 

Static Public Attributes

static bool notifyEnabled = true
 

Protected Member Functions

 Subject ()
 

Detailed Description

The Subject class provides the base class of every subject of the observer design pattern.

DECLARE BASE CLASS SUBJECT

Definition at line 99 of file observerpattern.h.

Inheritance diagram for UTILSLIB::Subject:
Inheritance graph

Member Typedef Documentation

◆ ConstSPtr

typedef QSharedPointer<const Subject> UTILSLIB::Subject::ConstSPtr

Const shared pointer type for Subject.

Definition at line 103 of file observerpattern.h.

◆ SPtr

typedef QSharedPointer<Subject> UTILSLIB::Subject::SPtr

Shared pointer type for Subject.

Definition at line 102 of file observerpattern.h.

◆ t_Observers

Defines a new IObserver set type.

Definition at line 105 of file observerpattern.h.

Constructor & Destructor Documentation

◆ ~Subject()

Subject::~Subject ( )
virtual

Destroys the Subject.

Definition at line 48 of file observerpattern.cpp.

◆ Subject()

UTILSLIB::Subject::Subject ( )
inlineprotected

Constructs a Subject.

Definition at line 173 of file observerpattern.h.

Member Function Documentation

◆ attach()

void Subject::attach ( IObserver pObserver)

Attaches an observer to the subject.

Parameters
[in]pObserverpointer to the observer which should be attached to the subject.

Definition at line 54 of file observerpattern.cpp.

◆ detach()

void Subject::detach ( IObserver pObserver)

Detaches an observer of the subject.

Parameters
[in]pObserverpointer to the observer which should be detached of the subject.

Definition at line 61 of file observerpattern.cpp.

◆ notify()

void Subject::notify ( )

Notifies all attached servers by calling there update method. Is used when subject has updates to provide. This method is enabled when nothifiedEnabled is true.

Definition at line 69 of file observerpattern.cpp.

◆ observerNumDebug()

int UTILSLIB::Subject::observerNumDebug ( )
inline

Returns number of attached observers. ToDo only for debug purpose -> could be removed

Returns
the number of attached observers.

Definition at line 166 of file observerpattern.h.

◆ observers()

Subject::t_Observers & UTILSLIB::Subject::observers ( )
inline

Returns attached observers.

Returns
attached observers.

Definition at line 184 of file observerpattern.h.

Member Data Documentation

◆ notifyEnabled

bool Subject::notifyEnabled = true
static

Holds the status whether notification is enabled. This is used to block notify() to make the observer pattern thread safe. It's working like a mutex. The different is that data aren't stored. -> it's okay when values are queued in their own buffer.

Definition at line 141 of file observerpattern.h.


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