Changeset b760ac5 for src/documentation
- Timestamp:
- Dec 13, 2011, 12:02:21 PM (14 years ago)
- Children:
- 3324cf
- Parents:
- d85532
- git-author:
- Frederik Heber <heber@…> (12/02/11 13:13:44)
- git-committer:
- Frederik Heber <heber@…> (12/13/11 12:02:21)
- File:
-
- 1 edited
-
src/documentation/patterns/observer.dox (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/documentation/patterns/observer.dox
rd85532 rb760ac5 28 28 * updating many of its internal sub-observables. This means the update is not passed, if 29 29 * it is produced while the main-observable itself is within any Observation block. 30 * 31 * \section pattern-observer-howtos Howto 32 * 33 * Below you find various howtos to guide you through how to use the various 34 * observer patterns. 35 * 36 * \section pattern-observer-howtos-observer Observers 37 * 38 * \todo write howto for using an Observer 39 * 40 * \section pattern-observer-howtos-observables Observables 41 * 42 * \todo write howto for using an Observable 43 * 44 * \section pattern-observer-howtos-relay Relays 45 * 46 * Lets us assume that you want to observe all instances of class "foo". 47 * In order to create a Relay you have to do the following: 48 * -# Create a new class "bar" that inherits the Relay pattern. 49 * \code 50 * #include "CodePatterns/Relay.hpp" 51 * class bar : public Relay { 52 * ... 53 * }; 54 * \endcode 55 * -# In the constructor bar::bar() create a Channels object for your Relay and 56 * add a channel for each of foo's channels, use foo's enum for this: 57 * \code 58 * bar::bar() { 59 * Channels *OurChannel = new Channels(); 60 * NotificationChannels.insert( std::make_pair(this, OurChannel) ); 61 * OurChannel->addChannel(foo::Notification1); 62 * OurChannel->addChannel(foo::Notification2); 63 * ... 64 * } 65 * \endcode 66 * -# Someplace else you have add all Observers that need to check on all 67 * instances of "foo" to be signed on. 68 * \code 69 * bar barInstance; 70 * ... someObserverInstance; 71 * barInstance.signOn(someObserverInstance); 72 * \endcode 73 * -# ... or maybe just for a specific channel of foo. 74 * \code 75 * bar barInstance; 76 * ... someObserverInstance; 77 * barInstance.signOn(someObserverInstance, foo::Notification1); 78 * \endcode 79 * 80 * 81 * \date 2011-12-01 30 82 */ 31 83
Note:
See TracChangeset
for help on using the changeset viewer.
