Changeset 74e0f7 for src/Patterns/unittests/stubs
- Timestamp:
- Sep 1, 2011, 11:07:47 AM (14 years ago)
- Children:
- 9e776f
- Parents:
- 451f17
- git-author:
- Frederik Heber <heber@…> (09/01/11 11:02:49)
- git-committer:
- Frederik Heber <heber@…> (09/01/11 11:07:47)
- Location:
- src/Patterns/unittests/stubs
- Files:
-
- 2 edited
-
ObserverStub.cpp (modified) (3 diffs)
-
ObserverStub.hpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Patterns/unittests/stubs/ObserverStub.cpp
r451f17 r74e0f7 31 31 {}; 32 32 33 UpdateCountObserver::~UpdateCountObserver() 34 {} 35 33 36 void UpdateCountObserver::update(Observable *publisher){ 34 37 updates++; … … 127 130 128 131 NotificationObservable::NotificationObservable() : 129 Observable("NotificationObservable"), 130 notification1(new Notification(this)), 131 notification2(new Notification(this)) 132 {} 133 134 NotificationObservable::~NotificationObservable(){ 135 delete notification1; 136 delete notification2; 132 Observable("NotificationObservable") 133 { 134 NotificationChannels = new Channels(this); 135 NotificationChannels->addChannel(Operation1Notify); 136 NotificationChannels->addChannel(Operation2Notify); 137 } 138 139 NotificationObservable::~NotificationObservable() 140 { 141 delete NotificationChannels; 137 142 } 138 143 139 144 void NotificationObservable::operation1(){ 140 145 OBSERVE; 141 NOTIFY( notification1);146 NOTIFY(Operation1Notify); 142 147 } 143 148 144 149 void NotificationObservable::operation2(){ 145 150 OBSERVE; 146 NOTIFY( notification2);151 NOTIFY(Operation2Notify); 147 152 } 148 153 … … 153 158 requestedNotification(notification), 154 159 wasNotified(false) 160 {} 161 162 NotificationObserver::~NotificationObserver() 155 163 {} 156 164 -
src/Patterns/unittests/stubs/ObserverStub.hpp
r451f17 r74e0f7 15 15 public: 16 16 UpdateCountObserver(); 17 virtual ~UpdateCountObserver(); 18 17 19 void update(Observable *publisher); 18 20 void subjectKilled(Observable *publisher); … … 52 54 public: 53 55 SuperObservable(); 54 ~SuperObservable();56 virtual ~SuperObservable(); 55 57 56 58 void changeMethod(); … … 62 64 public: 63 65 NotificationObservable(); 64 ~NotificationObservable(); 66 virtual ~NotificationObservable(); 67 68 enum NotificationType { 69 Operation1Notify = 0, 70 Operation2Notify = 1 71 }; 65 72 66 73 void operation1(); 67 74 void operation2(); 68 69 Notification_ptr notification1;70 Notification_ptr notification2;71 75 }; 72 76 … … 74 78 public: 75 79 NotificationObserver(Notification_ptr notification); 80 virtual ~NotificationObserver(); 76 81 77 82 void update(Observable*); … … 91 96 92 97 ObservableSet(int _num); 93 ~ObservableSet();98 virtual ~ObservableSet(); 94 99 95 100 iterator begin(); … … 109 114 110 115 ObservableMap(int _num); 111 ~ObservableMap();116 virtual ~ObservableMap(); 112 117 113 118 iterator begin();
Note:
See TracChangeset
for help on using the changeset viewer.
