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