61 if (
auto so =
pobs.lock()) {
91 if (
auto so =
it->lock()) {
122 if (
auto so =
it->lock()) {
125 so->update(
this, data);
126 }
catch (std::exception&
e) {
186template<
typename T1,
typename T2>
190 using F = std::function<
T2(
const T1&)>;
206 if (obs_ !=
nullptr && obs_ !=
srcObs) {
221 if (
auto so =
pobs.lock()) {
std::function< void(const T &)> F
void update(Observable< T > *, const T &t) override
std::list< std::weak_ptr< Observer< T > > > priority_observers_
bool attach(Observer< T > *o)
void detachPriorityObserver(Observer< T > *o)
bool detach(Observer< T > *o)
virtual ~Observable()
~Observable Detach all observers to avoid making them call this observable when destroyed
std::set< Observer< T > * > observers_
size_t getObserversCount()
void attachPriorityObserver(std::shared_ptr< Observer< T > > o)
virtual void attached(Observable< T > *)
virtual void update(Observable< T > *, const T &)=0
virtual void detached(Observable< T > *)
virtual void detached(Observable< T1 > *) override
detached Since a MapSubject is only attached to one Observable, when detached We should detach all of...
~PublishMapSubject()
~PublishMapSubject() Detach all observers to avoid making them call this observable when destroyed
void update(Observable< T1 > *, const T1 &t) override
std::function< T2(const T1 &)> F
virtual void attached(Observable< T1 > *srcObs) override
attached Here we just make sure that the PublishMapSubject is only attached to one Observable at a ti...
void emitSignal(Args... args)
Simple macro to hide class' copy constructor and assignment operator.
#define NON_COPYABLE(ClassName)