#ifndef CLOCKOBSERVER_AH #define CLOCKOBSERVER_AH #include "ObserverPattern.ah" aspect ClockObserver : public ObserverPattern { pointcut subjectChange (Subject &subject) = execution ("void ClockTimer::Tick()") && that (subject); pointcut observers() = "DigitalClock"||"AnalogClock"; public: advice "ClockTimer" : slice struct : public ObserverPattern::Subject; advice observers () : slice struct : public ObserverPattern::Observer; advice observers () : slice struct { void update (ObserverPattern::Subject *subject) { Draw ((const ClockTimer &)*subject); } }; virtual void updateObserver(Subject *subject, Observer *observer) { observer->update (subject); } }; #endif // CLOCKOBSERVER_AH