Poco

template < class C, class N >

class NObserver

File Information

Library: Foundation
Package: Notifications
Header: Poco/NObserver.h

Description

This template class implements an adapter that sits between a NotificationCenter and an object receiving notifications from it. It is quite similar in concept to the RunnableAdapter, but provides some NotificationCenter specific additional methods. See the NotificationCenter class for information on how to use this template class.

This class template is quite similar to the Observer class template. The only difference is that the NObserver expects the callback function to accept a const AutoPtr& instead of a plain pointer as argument, thus simplifying memory management.

Inheritance

Direct Base Classes: AbstractObserver

All Base Classes: AbstractObserver

Member Summary

Member Functions: accepts, clone, disable, equals, notify, operator =

Inherited Functions: accepts, clone, disable, equals, notify, operator =

Types

NotificationPtr

typedef AutoPtr < N > NotificationPtr;

void

typedef void (C::* Callback)(const NotificationPtr &);

Constructors

NObserver inline

NObserver(
    const NObserver & observer
);

NObserver inline

NObserver(
    C & object,
    Callback method
);

Destructor

~NObserver virtual inline

~NObserver();

Member Functions

accepts virtual inline

bool accepts(
    Notification * pNf,
    const char * pName = 0
) const;

clone virtual inline

AbstractObserver * clone() const;

disable virtual inline

void disable();

equals virtual inline

bool equals(
    const AbstractObserver & abstractObserver
) const;

notify virtual inline

void notify(
    Notification * pNf
) const;

operator = inline

NObserver & operator = (
    const NObserver & observer
);

Securely control IoT edge devices from anywhere   Connect a Device