~ubuntu-branches/ubuntu/wily/aspectc++/wily

« back to all changes in this revision

Viewing changes to AspectC++/tests/PragmaOnceObserver/ClockObserver.ah

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-12-23 10:49:40 UTC
  • Revision ID: james.westby@ubuntu.com-20051223104940-ig4klhoi991zs7km
Tags: upstream-0.99+1.0pre2
ImportĀ upstreamĀ versionĀ 0.99+1.0pre2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef MYDIGITALCLOCK_AH
 
2
#define MYDIGITALCLOCK_AH
 
3
 
 
4
#include "ObserverPattern.ah"
 
5
#include "ClockTimer.h"
 
6
 
 
7
aspect ClockObserver : public ObserverPattern {
 
8
  pointcut subjectChange (Subject &subject) =
 
9
    execution ("void ClockTimer::Tick()") && that (subject);
 
10
  pointcut observers() = "DigitalClock"||"AnalogClock";
 
11
 
 
12
public:
 
13
 
 
14
  advice "ClockTimer" : baseclass (Subject);
 
15
  advice observers () : baseclass (Observer);
 
16
  advice observers () : void update (ObserverPattern::Subject *subject) {
 
17
    Draw ((const ClockTimer &)*subject);
 
18
  }
 
19
 
 
20
  virtual void updateObserver(Subject *subject, Observer *observer) {
 
21
    observer->update (subject);
 
22
  }
 
23
};
 
24
 
 
25
#endif //MYDIGITALCLOCK_AH
 
26