14#include "arccore/base/Observable.h"
15#include "arccore/base/Observer.h"
30 if (!m_observers.empty())
31 std::cout <<
"** WARNING: Observable p=" <<
this
32 <<
" is destroyed but has n="
33 << m_observers.size() <<
" observer(s) attached\n";
44 if (m_observers.contains(obs))
60 m_observers.removeValue(obs);
69 if (m_observers.empty())
72 o->observerUpdate(
this);
81 return (!m_observers.empty());
103 _detachAllObservers();
121AutoDetachObservable::
122~AutoDetachObservable()
124 _detachAllObservers();
Interface of an observable.
virtual void attachToObservable(IObservable *obs)=0
Attaches to the observable obs.
Base class of an observable.
void attachObserver(IObserver *obs) override
Attaches the observer obs to this observable.
void detachAllObservers() override
Detaches all observers associated with this instance.
bool hasObservers() const override
True if observers are attached to this observable.
void detachObserver(IObserver *obs) override
Detaches the observer obs from this observable.
~Observable() override
Releases resources.
void notifyAllObservers() override
Notifies all observers.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
bool arccoreIsCheck()
True if in check mode.