# Poco

# template < class C, class N >

# class Observer

Library: Foundation
Package: Notifications
Header: Poco/Observer.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.

Instead of the Observer class template, you might want to use the NObserver class template, which uses an AutoPtr to pass the Notification to the callback function, thus freeing you from memory management issues.

## 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

### void

typedef void (C::* Callback)(N *);

## Constructors

### Observer

Observer(
const Observer & observer
);

### Observer

Observer(
C & object,
Callback method
);

## Destructor

### ~Observer

~Observer();

## Member Functions

### accepts

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

See also: Poco::AbstractObserver::accepts()

### clone

AbstractObserver * clone() const;

See also: Poco::AbstractObserver::clone()

### disable

void disable();

See also: Poco::AbstractObserver::disable()

### equals

bool equals(
const AbstractObserver & abstractObserver
) const;

See also: Poco::AbstractObserver::equals()

### notify

void notify(
Notification * pNf
) const;

See also: Poco::AbstractObserver::notify()

### operator =

Observer & operator = (
const Observer & observer
);