[#BloombergLP-ball-MultiplexObserver] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::MultiplexObserver :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class MultiplexObserver : public xref:BloombergLP/ball/Observer.adoc[Observer] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/ball/Observer.adoc[Observer]` | This class provides a protocol for receiving and processing log record output. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/ball/MultiplexObserver/2constructor.adoc[`MultiplexObserver`] [.small]#[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. | xref:BloombergLP/ball/MultiplexObserver/2destructor.adoc[`~MultiplexObserver`] [.small]#[destructor]# [.small]#[virtual]# | Destroy this multiplexing observer. Note that this method has no effect on the lifetime of observers registered with this observer, if any. | xref:BloombergLP/ball/MultiplexObserver/deregisterObserver.adoc[`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. | xref:BloombergLP/ball/MultiplexObserver/numRegisteredObservers.adoc[`numRegisteredObservers`] | Return the number of observers registered with this multiplexing observer. | xref:BloombergLP/ball/MultiplexObserver/publish-0e.adoc[`publish`] | `publish` overloads | xref:BloombergLP/ball/MultiplexObserver/registerObserver.adoc[`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. | xref:BloombergLP/ball/MultiplexObserver/releaseRecords.adoc[`releaseRecords`] [.small]#[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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#