Last change
on this file since 30 was 3, checked in by sgosseli, 12 years ago |
- Add the existing Pacpus files from pacpusdev and pacpuscore.
- Provide a clean build system based on multiple CMake files.
|
File size:
1.1 KB
|
Rev | Line | |
---|
[3] | 1 | #pragma once
|
---|
| 2 | #ifndef __GENERIC_OBSERVER_INTERFACE_H__
|
---|
| 3 | #define __GENERIC_OBSERVER_INTERFACE_H__
|
---|
| 4 |
|
---|
| 5 | namespace pacpus {
|
---|
| 6 |
|
---|
| 7 | /** Base class for te GenericObserverInterface template.
|
---|
| 8 |
|
---|
| 9 | The purpose of this class is to be able to take generic pointers on
|
---|
| 10 | GenericObserverInterface<T> class template instances.
|
---|
| 11 | */
|
---|
| 12 | class GenericObserverBase {
|
---|
| 13 | public:
|
---|
| 14 | virtual ~GenericObserverBase() {}
|
---|
| 15 | };
|
---|
| 16 |
|
---|
| 17 | /** Template interface for generic observers.
|
---|
| 18 |
|
---|
| 19 | This is a pure virtual class that should be used as a base to classes
|
---|
| 20 | wishing to receive notifications from GenericObservable classes.
|
---|
| 21 | */
|
---|
| 22 | template <typename T>
|
---|
| 23 | class GenericObserverInterface : public GenericObserverBase {
|
---|
| 24 | public:
|
---|
| 25 | virtual ~GenericObserverInterface() {};
|
---|
| 26 |
|
---|
| 27 | /** Update function.
|
---|
| 28 |
|
---|
| 29 | This function is called each time the observables notifies its observers
|
---|
| 30 | of a change. It must be implemented by all classes obeying the
|
---|
| 31 | GenericObserverInterface interface.
|
---|
| 32 |
|
---|
| 33 | @param observable is a pointer to the observed object that was updated.
|
---|
| 34 | */
|
---|
| 35 | virtual void update(T* observable) = 0;
|
---|
| 36 | };
|
---|
| 37 |
|
---|
| 38 | } // namespace pacpus
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | #endif |
---|
Note:
See
TracBrowser
for help on using the repository browser.