HyperspaceExplorer 0.7.1
Public Member Functions
Observer< Parent > Class Template Reference

An object that is notified by a Subject it is attached to. More...

#include <Observer.h>

List of all members.

Public Member Functions

virtual void update (std::shared_ptr< const Subject< Parent > > changedSubject)=0

Detailed Description

template<class Parent>
class Observer< Parent >

An object that is notified by a Subject it is attached to.

After registering with a Subject, an object of this class is notified of any change of state via the update() method.

This class is an abstract class. The update() method must be implemented.

Any Observer must register with its Subject vi Subject::attach().

Example:

  class MinxObserver: public Observer<Minx> {
    virtual void update(const Subject<Minx> *changedSubject) {
      // do something
    }
  };

  MinxSubject subject;
  shared_ptr< Observer<Minx> > observer(new MinxObserver);
  subject.attach(observer);
  subject.jinx(); // observer->update() is called

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:18 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo