Changeset b760ac5 for src/documentation


Ignore:
Timestamp:
Dec 13, 2011, 12:02:21 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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)
Message:

Relay can now also relay notifications.

  • NOTE: We do not yet notify the Observables, whose update() we combine, when the Relay is destroyed. They have to signOff before by themselves (or by some other means, e.g. be destroyed before.).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/documentation/patterns/observer.dox

    rd85532 rb760ac5  
    2828 * updating many of its internal sub-observables. This means the update is not passed, if
    2929 * 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
    3082 */
    3183
Note: See TracChangeset for help on using the changeset viewer.