| Last change
 on this file since c362a4 was             9b8fa4, checked in by Frederik Heber <heber@…>, 14 years ago | 
        
          | 
Huge update of file structure to place installation header files into right folder.
 The problem ist that we desire use as include "CodePatterns/...". For this to
work, especially with the new Observer subfolder structure, it has been
necessary to place all header files away from their source files into a
distinct folder called CodePatterns. This emulates the later, after make
install present structure.
essentially all source and header files had to be changed to adapt the
include.
all Makefile.am's had to be changed.
nobase_ ... was removed such that header files are installed flat and not
creating their subfolder along the process.
We placed Observer into its own convenience library and own folder Observer
away from Patterns.
 
Some other changes:
 FIX: MemDebug.hpp inclusion has been removed in all stubs.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            1.1 KB | 
      
      
| Line |  | 
|---|
| 1 | /* | 
|---|
| 2 | * Notification.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Dec 1, 2011 | 
|---|
| 5 | *      Author: heber | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef NOTIFICATION_HPP_ | 
|---|
| 9 | #define NOTIFICATION_HPP_ | 
|---|
| 10 |  | 
|---|
| 11 | // include config.h | 
|---|
| 12 | #ifdef HAVE_CONFIG_H | 
|---|
| 13 | #include <config.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 | #include <set> | 
|---|
| 17 |  | 
|---|
| 18 | class Observable; | 
|---|
| 19 | class Observer; | 
|---|
| 20 | class Relay; | 
|---|
| 21 |  | 
|---|
| 22 | /** Notifications are sort of news channels of an Observable. | 
|---|
| 23 | * Via the NOTIFY() macro updates can be transmitted in a specific channel. | 
|---|
| 24 | * Observers can subscribe to Notification in much the same way as they can to | 
|---|
| 25 | * the Observable itself. Usually, Notifications are used along | 
|---|
| 26 | * with the usual OBSERVE() macro to generate both the specific and | 
|---|
| 27 | * the global message of change. | 
|---|
| 28 | */ | 
|---|
| 29 | class Notification { | 
|---|
| 30 | //!> grant Observable access to notifyAll() | 
|---|
| 31 | friend class Observable; | 
|---|
| 32 | //!> grant Relay access to notifyAll() | 
|---|
| 33 | friend class Relay; | 
|---|
| 34 | public: | 
|---|
| 35 | Notification(size_t _channelno); | 
|---|
| 36 | virtual ~Notification(); | 
|---|
| 37 |  | 
|---|
| 38 | size_t getChannelNo() const { return channelno; } | 
|---|
| 39 |  | 
|---|
| 40 | protected: | 
|---|
| 41 |  | 
|---|
| 42 | void addObserver(Observer *target); | 
|---|
| 43 | void removeObserver(Observer *target); | 
|---|
| 44 |  | 
|---|
| 45 | void notifyAll(Observable * const publisher); | 
|---|
| 46 | private: | 
|---|
| 47 | std::set<Observer*> targets; | 
|---|
| 48 | const size_t channelno; | 
|---|
| 49 | }; | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | #endif /* NOTIFICATION_HPP_ */ | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.