Changeset 1c291d for src/CodePatterns/Observer/Notification.hpp
- Timestamp:
- Mar 18, 2013, 6:29:41 PM (13 years ago)
- Children:
- 3f30cc
- Parents:
- b9273a
- git-author:
- Frederik Heber <heber@…> (03/18/13 18:22:47)
- git-committer:
- Frederik Heber <heber@…> (03/18/13 18:29:41)
- File:
-
- 1 edited
-
src/CodePatterns/Observer/Notification.hpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodePatterns/Observer/Notification.hpp
rb9273a r1c291d 16 16 #include <set> 17 17 18 class Channels; 18 19 class Observable; 19 20 class Observer; … … 26 27 * with the usual OBSERVE() macro to generate both the specific and 27 28 * the global message of change. 29 * 30 * \note Notification::subjectKilled() needs to be called by owning Channels. 31 * We use the passed on Observable instance to let Observers that have only 32 * signed on to single channel know when their observable has died. 28 33 */ 29 34 class Notification { 30 //!> grant Observable access to notifyAll()31 friend class Observable;32 //!> grant Relay access to notifyAll()33 friend class Relay;34 35 public: 35 36 Notification(size_t _channelno); … … 43 44 void removeObserver(Observer *target); 44 45 46 private: 47 //!> grant Observable access to notifyAll() and subjectKilled() 48 friend class Observable; 49 //!> grant Channels access to notifyAll() and subjectKilled() 50 friend class Channels; 51 //!> grant Relay access to notifyAll() 52 friend class Relay; 53 45 54 void notifyAll(Observable * const publisher); 55 56 /** Informs channel subscribers about dstor call. 57 * 58 * This is meant to be called from Observable only. 59 * Channels and Notifications are strictly attached to an Observable. Hence, 60 * it makes no sense to inform them on their own. Especially, neither has 61 * any knowledge on the publisher. 62 * 63 * \param *publisher Observable about to be destroyed 64 */ 65 void subjectKilled(Observable * const publisher); 66 46 67 private: 47 std::set<Observer*> targets; 68 typedef std::set<Observer*> targets_t; 69 targets_t targets; 48 70 const size_t channelno; 49 71 };
Note:
See TracChangeset
for help on using the changeset viewer.
