BDE 4.14.0 Production release
|
#include <ball_multiplexobserver.h>
Public Member Functions | |
MultiplexObserver (bslma::Allocator *basicAllocator=0) | |
~MultiplexObserver () BSLS_KEYWORD_OVERRIDE | |
void | publish (const Record &record, const Context &context) BSLS_KEYWORD_OVERRIDE |
void | publish (const bsl::shared_ptr< const Record > &record, const Context &context) BSLS_KEYWORD_OVERRIDE |
void | releaseRecords () BSLS_KEYWORD_OVERRIDE |
int | registerObserver (Observer *observer) |
int | deregisterObserver (Observer *observer) |
int | numRegisteredObservers () const |
Public Member Functions inherited from ball::Observer | |
virtual | ~Observer () |
Destroy this observer. | |
This class provides a multiplexing implementation of the Observer
protocol. Other concrete observers may be registered with a multiplexing observer (registerObserver
method) and later unregistered (deregisterObserver
method). The publish
method of this class forwards the log records that it receives to the publish
method of each registered observer.
|
inlineexplicit |
Create a multiplexing observer having no registered observers. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
ball::MultiplexObserver::~MultiplexObserver | ( | ) |
Destroy this multiplexing observer. Note that this method has no effect on the lifetime of observers registered with this observer, if any.
int ball::MultiplexObserver::deregisterObserver | ( | Observer * | observer | ) |
Remove the specified observer
from the registry of this multiplexing observer. Return 0 if observer
is non-null and was registered with this multiplexing observer, and a non-zero value (with no effect) otherwise. Henceforth, observer
will no longer receive log records from this multiplexing observer.
|
inline |
Return the number of observers registered with this multiplexing observer.
|
virtual |
Process the specified log record
having the specified publishing context
. This concrete publish implementations processes the record
by forwarding record
and context
to each of the observers registered with this multiplexing observer.
Reimplemented from ball::Observer.
Process the specified log record
having the specified publishing context
by forwarding record
and context
to each of the observers registered with this multiplexing observer.
publish
overload instead. Reimplemented from ball::Observer.
int ball::MultiplexObserver::registerObserver | ( | Observer * | observer | ) |
Add the specified observer
to the registry of this multiplexing observer. Return 0 if observer
is non-null and was not already registered with this multiplexing observer, and a non-zero value (with no effect) otherwise. Henceforth, this multiplexing observer will forward each record it receives through its publish
method, including the record's context, to the publish
method of observer
, until observer
is deregistered. The behavior is undefined unless observer
remains valid until it is deregistered from this multiplexing observer or until this observer is destroyed.
|
virtual |
Discard any shared reference to a Record
object that was supplied to the publish
method, and is held by this observer. This implementation processes releaseRecords
by calling releaseRecords
on each of the registered observers. Note that this operation should be called if resources underlying the previously provided shared pointers must be released.
Reimplemented from ball::Observer.