#include <observer.hh>

Public Member Functions | |
| virtual void | attach (observer< observed_subject > &o) |
| Attach a new observer to this subject. | |
| virtual void | detach (observer< observed_subject > &o) |
| Detach a new observer to this subject. | |
| virtual void | notify () |
| Notify all attached observers. | |
Protected Attributes | |
|
std::set< observer < observed_subject > * > | observers_m |
You must declare the subject of the observations with:
class my_observed_sbj : public subject<my_observed_sbj>
Than you should call notify() manually or automatically from every method that changes the subject status.
Only attached observers (cfr. attach() and detach() methods) will be notified.
| void mets::subject< observed_subject >::attach | ( | observer< observed_subject< observed_subject > > & | o | ) | [inline, virtual] |
| void mets::subject< observed_subject >::detach | ( | observer< observed_subject< observed_subject > > & | o | ) | [inline, virtual] |
| void mets::subject< observed_subject >::notify | ( | ) | [inline, virtual] |
Notify all attached observers.
When this method is called every observed_subject::update method is called and "this" subject is passed as a param.
Return to METSlib home page