Ignore:
Timestamp:
Dec 13, 2011, 9:46:12 AM (14 years ago)
Author:
Frederik Heber <heber@…>
Children:
75d156
Parents:
549b62
git-author:
Frederik Heber <heber@…> (12/02/11 09:58:19)
git-committer:
Frederik Heber <heber@…> (12/13/11 09:46:12)
Message:

Added Observable::signOn() to get int wrapped in class PriorityLevel.

  • PriorityLevel makes the valid range check.
  • also this is preparatory for using size_t channelno instead of the ref to the notification in signing on to channels.
  • this is required for relaying notifications.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/Observer/Observable.hpp

    r549b62 r8fe1e2  
    1818#include <string>
    1919
     20#include "Range.hpp"
    2021#include "Observer/defs.hpp"
    2122#include "Observer/Observer.hpp"
     
    3536  virtual ~Observable();
    3637
     38  /** This class is only used to distinguish from size_t in the overload.
     39   *
     40   * It encapsulates a const int (the priority level) and checks valid bounds
     41   * in constructor.
     42   *
     43   */
     44  class PriorityLevel {
     45  public:
     46    explicit PriorityLevel(const int i);
     47    ~PriorityLevel();
     48
     49    const int level;
     50  private:
     51    static range<int> ValidRange;
     52  };
     53
    3754  /**
    3855   * Sign an Observer on to this Observable. The Observer will be notified
     
    4663   * ussually no need to order the update sequence.
    4764   */
    48   virtual void signOn(Observer *target, int priority=0) const;
     65  virtual void signOn(Observer *target, PriorityLevel priority = PriorityDefault) const;
    4966
    5067  /**
     
    95112  static ChannelMap NotificationChannels;
    96113
     114  static PriorityLevel PriorityDefault;
     115
    97116private:
    98117  typedef std::multimap<int,Observer*> callees_t;
Note: See TracChangeset for help on using the changeset viewer.