14#include "arccore/base/Observable.h"
15#include "arccore/base/Observer.h"
32 if (!m_observers.empty())
33 std::cout <<
"** WARNING: Observable p=" <<
this
34 <<
" is destroyed but has n="
35 << m_observers.size() <<
" observer(s) attached\n";
46 if (m_observers.contains(obs))
62 m_observers.removeValue(obs);
71 if (m_observers.empty())
74 o->observerUpdate(
this);
83 return (!m_observers.empty());
105 _detachAllObservers();
123AutoDetachObservable::
124~AutoDetachObservable()
126 _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.