35 #ifndef ANA_OBSERVER_OBSERVABLE_H
36 #define ANA_OBSERVER_OBSERVABLE_H
163 mutable bool _changed;
164 mutable bool _updating;
168 std::set<Observer*> _observers;
This class can be subclassed to represent an object that the programmer wants to have observed.
void addObserver(Observer *observer)
Adds an observer to the set of observers for this object.
void setChanged() const
Indicates that this object has changed.
void obsSetChanged(int, bool=true) const
int-based change flags (use enums to address them)
bool hasChanged() const
Tests if this object has changed.
Observable()
Construct an Observable with zero observers.
virtual ~Observable()
does nothing
void obsSetChanged(const std::string &, bool=true) const
string-based change flags
void deleteObservers()
Clears the observer list so that this object no longer has any observers (doesn't call any observer m...
bool obsHasChanged(const std::string &) const
only valid during an Observer::update()
virtual void notifyUnregisterObservers()
Notifies observable destruction to all observers and unregisters them.
void clearChanged() const
Indicates that this object has no longer changed, or that it has already notified all of its observer...
int countObservers() const
Returns the number of observers of this object.
void deleteObserver(Observer *observer)
Deletes an observer from the set of observers of this object.
virtual void notifyObservers(void *arg=0)
If this object has changed, as indicated by the hasChanged method, then notify all of its observers.
bool obsHasChanged(int) const
only valid during an Observer::update()
A class can implement the Observer interface when it wants to be informed of changes in observable ob...