1 | // %pacpus:license{
|
---|
2 | // This file is part of the PACPUS framework distributed under the
|
---|
3 | // CECILL-C License, Version 1.0.
|
---|
4 | // %pacpus:license}
|
---|
5 | /// @file
|
---|
6 | /// @author Stephane Bonnet <firstname.surname@utc.fr>
|
---|
7 | /// @date October, 2012
|
---|
8 | /// @version $Id: GenericObserverInterface.h 76 2013-01-10 17:05:10Z kurdejma $
|
---|
9 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
|
---|
10 | /// @brief Brief description.
|
---|
11 | ///
|
---|
12 | /// Detailed description.
|
---|
13 |
|
---|
14 | #ifndef DEF_PACPUS_GENERIC_OBSERVER_INTERFACE_H
|
---|
15 | #define DEF_PACPUS_GENERIC_OBSERVER_INTERFACE_H
|
---|
16 |
|
---|
17 | namespace pacpus {
|
---|
18 |
|
---|
19 | /** Base class for te GenericObserverInterface template.
|
---|
20 |
|
---|
21 | The purpose of this class is to be able to take generic pointers on
|
---|
22 | GenericObserverInterface<T> class template instances.
|
---|
23 | */
|
---|
24 | class GenericObserverBase {
|
---|
25 | public:
|
---|
26 | virtual ~GenericObserverBase() {}
|
---|
27 | };
|
---|
28 |
|
---|
29 | /** Template interface for generic observers.
|
---|
30 |
|
---|
31 | This is a pure virtual class that should be used as a base to classes
|
---|
32 | wishing to receive notifications from GenericObservable classes.
|
---|
33 | */
|
---|
34 | template <typename T>
|
---|
35 | class GenericObserverInterface : public GenericObserverBase {
|
---|
36 | public:
|
---|
37 | virtual ~GenericObserverInterface() {};
|
---|
38 |
|
---|
39 | /** Update function.
|
---|
40 |
|
---|
41 | This function is called each time the observables notifies its observers
|
---|
42 | of a change. It must be implemented by all classes obeying the
|
---|
43 | GenericObserverInterface interface.
|
---|
44 |
|
---|
45 | @param observable is a pointer to the observed object that was updated.
|
---|
46 | */
|
---|
47 | virtual void update(T* observable) = 0;
|
---|
48 | };
|
---|
49 |
|
---|
50 | } // namespace pacpus
|
---|
51 |
|
---|
52 |
|
---|
53 | #endif // DEF_PACPUS_GENERIC_OBSERVER_INTERFACE_H |
---|