BloombergLP::ball::MultiplexObserver

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.

Synopsis

Declared in <ball_multiplexobserver.h>

class MultiplexObserver
    : public Observer

Base Classes

NameDescription
ObserverThis class provides a protocol for receiving and processing log record output.

Member Functions

NameDescription
MultiplexObserver [constructor]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.
~MultiplexObserver [destructor] [virtual]Destroy this multiplexing observer. Note that this method has no effect on the lifetime of observers registered with this observer, if any.
deregisterObserver 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.
numRegisteredObservers Return the number of observers registered with this multiplexing observer.
publish publish overloads
registerObserver 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.
releaseRecords [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.