22 #ifndef ULTIMA4_CORE_OBSERVABLE_H 23 #define ULTIMA4_CORE_OBSERVABLE_H 25 #include "ultima/ultima4/core/observer.h" 26 #include "ultima/shared/std/containers.h" 44 template <
class O,
class A = NoArg *>
51 i =
Common::find(_observers.begin(), _observers.end(), o);
52 if (i == _observers.end())
53 _observers.push_back(o);
56 int countObservers()
const {
57 return _observers.size();
62 i =
Common::find(_observers.begin(), _observers.end(), o);
63 if (i != _observers.end())
67 void deleteObservers() {
71 bool hasChanged()
const {
75 void notifyObservers(A arg) {
87 for (i = tmp.
begin(); i != tmp.
end(); i++) {
89 observer->update(static_cast<O>(
this), arg);
Definition: observer.h:37
iterator end()
Definition: array.h:379
iterator begin()
Definition: array.h:374
In find(In first, In last, const T &v)
Definition: algorithm.h:225
Definition: detection.h:27
Definition: observable.h:45
Definition: containers.h:38