source: pacpusframework/trunk/include/Pacpus/kernel/GenericObserverInterface.h@ 57

Last change on this file since 57 was 31, checked in by sgosseli, 12 years ago

Huge commit: use the new includes style in all the files, add the license header in all the headers, and in some cpp.

File size: 1.4 KB
Line 
1/**
2 *
3 * Distributed under the UTC Heudiascy Pacpus License, Version 1.0.
4 * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved.
5 *
6 * See the LICENSE file for more information or a copy at:
7 * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt
8 *
9 */
10
11#ifndef DEF_PACPUS_GENERIC_OBSERVER_INTERFACE_H
12#define DEF_PACPUS_GENERIC_OBSERVER_INTERFACE_H
13
14namespace pacpus {
15
16/** Base class for te GenericObserverInterface template.
17
18 The purpose of this class is to be able to take generic pointers on
19 GenericObserverInterface<T> class template instances.
20*/
21class GenericObserverBase {
22public:
23 virtual ~GenericObserverBase() {}
24};
25
26/** Template interface for generic observers.
27
28 This is a pure virtual class that should be used as a base to classes
29 wishing to receive notifications from GenericObservable classes.
30*/
31template <typename T>
32class GenericObserverInterface : public GenericObserverBase {
33public:
34 virtual ~GenericObserverInterface() {};
35
36 /** Update function.
37
38 This function is called each time the observables notifies its observers
39 of a change. It must be implemented by all classes obeying the
40 GenericObserverInterface interface.
41
42 @param observable is a pointer to the observed object that was updated.
43 */
44 virtual void update(T* observable) = 0;
45};
46
47} // namespace pacpus
48
49
50#endif // DEF_PACPUS_GENERIC_OBSERVER_INTERFACE_H
Note: See TracBrowser for help on using the repository browser.