[#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&period; Other concrete observers may be registered with a multiplexing observer (`registerObserver` method) and later unregistered (`deregisterObserver` method)&period; The `publish` method of this class forwards the log records that it receives to the `publish` method of each registered observer&period;

== Synopsis

Declared in `&lt;ball&lowbar;multiplexobserver&period;h&gt;`

[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&period;
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/ball/MultiplexObserver/2constructor.adoc[`MultiplexObserver`]         [.small]#[constructor]#
| Create a multiplexing observer having no registered observers&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is 0, the currently installed default allocator is used&period;
| xref:BloombergLP/ball/MultiplexObserver/2destructor.adoc[`&#126;MultiplexObserver`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy this multiplexing observer&period; Note that this method has no effect on the lifetime of observers registered with this observer, if any&period;
| xref:BloombergLP/ball/MultiplexObserver/deregisterObserver.adoc[`deregisterObserver`] 
| Remove the specified `observer` from the registry of this multiplexing observer&period; Return 0 if `observer` is non&hyphen;null and was registered with this multiplexing observer, and a non&hyphen;zero value (with no effect) otherwise&period; Henceforth, `observer` will no longer receive log records from this multiplexing observer&period;
| xref:BloombergLP/ball/MultiplexObserver/numRegisteredObservers.adoc[`numRegisteredObservers`] 
| Return the number of observers registered with this multiplexing observer&period;
| 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&period; Return 0 if `observer` is non&hyphen;null and was not already registered with this multiplexing observer, and a non&hyphen;zero value (with no effect) otherwise&period; Henceforth, this multiplexing observer will forward each record it receives through its `publish` method, including the record&apos;s context, to the `publish` method of `observer`, until `observer` is deregistered&period; The behavior is undefined unless `observer` remains valid until it is deregistered from this multiplexing observer or until this observer is destroyed&period;
| 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&period; This implementation processes `releaseRecords` by calling `releaseRecords` on each of the registered observers&period; Note that this operation should be called if resources underlying the previously provided shared pointers must be released&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
