[#BloombergLP-bslx-GenericOutStream]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslx.adoc[bslx]::GenericOutStream
:relfileprefix: ../../
:mrdocs:

This class provides output methods to externalize values, and C&hyphen;style arrays of values, of the fundamental integral and floating&hyphen;point types, as well as `bsl&colon;&colon;string` values&period; In particular, each `put` method of this class is guaranteed to write stream data that can be read by the corresponding `get` method of `bslx&colon;&colon;GenericInStream`&period; See the `bslx` package&hyphen;level documentation for the definition of the BDEX `OutStream` protocol&period;

== Synopsis

Declared in `&lt;bslx&lowbar;genericoutstream&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class STREAMBUF&gt;
class GenericOutStream;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslx/GenericOutStream/2constructor.adoc[`GenericOutStream`]         [.small]#[constructor]#
| Create an output byte stream that writes its output to the specified `streamBuf` and uses the specified (_compile_&hyphen;time&hyphen;defined) `versionSelector` as needed (see &lcub;Versioning&rcub;)&period; Note that the `versionSelector` is expected to be formatted as &quot;YYYYMMDD&quot;, a date representation&period;
| xref:BloombergLP/bslx/GenericOutStream/2destructor.adoc[`&#126;GenericOutStream`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bslx/GenericOutStream/bdexVersionSelector.adoc[`bdexVersionSelector`] 
| Return the `versionSelector` to be used with `operator&lt;&lt;` for BDEX streaming as per the `bslx` package&hyphen;level documentation&period;
| xref:BloombergLP/bslx/GenericOutStream/flush.adoc[`flush`] 
| If this stream is valid, invoke the `pubsync` method on the underlying stream supplied at construction of this object&semi; otherwise, this function has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/invalidate.adoc[`invalidate`] 
| Put this output stream in an invalid state&period; This function has no effect if this stream is already invalid&period;
| xref:BloombergLP/bslx/GenericOutStream/isValid.adoc[`isValid`] 
| Return `true` if this stream is valid, and `false` otherwise&period; An invalid stream is a stream for which an output operation was detected to have failed or `invalidate` was called&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayFloat32.adoc[`putArrayFloat32`] 
| Write to the stream supplied at construction the consecutive four&hyphen;byte IEEE single&hyphen;precision floating&hyphen;point numbers (in network byte order) comprised of the most&hyphen;significant four bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period; Note that for non&hyphen;conforming platforms, this operation may be lossy&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayFloat64.adoc[`putArrayFloat64`] 
| Write to the stream supplied at construction the consecutive eight&hyphen;byte IEEE double&hyphen;precision floating&hyphen;point numbers (in network byte order) comprised of the most&hyphen;significant eight bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period; Note that for non&hyphen;conforming platforms, this operation may be lossy&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt16.adoc[`putArrayInt16`] 
| Write to the stream supplied at construction the consecutive two&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant two bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt24.adoc[`putArrayInt24`] 
| Write to the stream supplied at construction the consecutive three&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant three bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt32.adoc[`putArrayInt32`] 
| Write to the stream supplied at construction the consecutive four&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant four bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt40.adoc[`putArrayInt40`] 
| Write to the stream supplied at construction the consecutive five&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant five bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt48.adoc[`putArrayInt48`] 
| Write to the stream supplied at construction the consecutive six&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant six bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt56.adoc[`putArrayInt56`] 
| Write to the stream supplied at construction the consecutive seven&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant seven bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt64.adoc[`putArrayInt64`] 
| Write to the stream supplied at construction the consecutive eight&hyphen;byte, two&apos;s complement integers (in network byte order) comprised of the least&hyphen;significant eight bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayInt8-02.adoc[`putArrayInt8`] 
| `putArrayInt8` overloads
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint16.adoc[`putArrayUint16`] 
| Write to the stream supplied at construction the consecutive two&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant two bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint24.adoc[`putArrayUint24`] 
| Write to the stream supplied at construction the consecutive three&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant three bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint32.adoc[`putArrayUint32`] 
| Write to the stream supplied at construction the consecutive four&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant four bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint40.adoc[`putArrayUint40`] 
| Write to the stream supplied at construction the consecutive five&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant five bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint48.adoc[`putArrayUint48`] 
| Write to the stream supplied at construction the consecutive six&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant six bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint56.adoc[`putArrayUint56`] 
| Write to the stream supplied at construction the consecutive seven&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant seven bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint64.adoc[`putArrayUint64`] 
| Write to the stream supplied at construction the consecutive eight&hyphen;byte, two&apos;s complement unsigned integers (in network byte order) comprised of the least&hyphen;significant eight bytes of each of the specified `numValues` leading entries in the specified `values` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; numValues` and `values` has sufficient contents&period;
| xref:BloombergLP/bslx/GenericOutStream/putArrayUint8-0c.adoc[`putArrayUint8`] 
| `putArrayUint8` overloads
| xref:BloombergLP/bslx/GenericOutStream/putFloat32.adoc[`putFloat32`] 
| Write to the stream supplied at construction the four&hyphen;byte IEEE single&hyphen;precision floating&hyphen;point number (in network byte order) comprised of the most&hyphen;significant four bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; Note that for non&hyphen;conforming platforms, this operation may be lossy&period;
| xref:BloombergLP/bslx/GenericOutStream/putFloat64.adoc[`putFloat64`] 
| Write to the stream supplied at construction the eight&hyphen;byte IEEE double&hyphen;precision floating&hyphen;point number (in network byte order) comprised of the most&hyphen;significant eight bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; Note that for non&hyphen;conforming platforms, this operation may be lossy&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt16.adoc[`putInt16`] 
| Write to the stream supplied at construction the two&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant two bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt24.adoc[`putInt24`] 
| Write to the stream supplied at construction the three&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant three bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt32.adoc[`putInt32`] 
| Write to the stream supplied at construction the four&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant four bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt40.adoc[`putInt40`] 
| Write to the stream supplied at construction the five&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant five bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt48.adoc[`putInt48`] 
| Write to the stream supplied at construction the six&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant six bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt56.adoc[`putInt56`] 
| Write to the stream supplied at construction the seven&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant seven bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt64.adoc[`putInt64`] 
| Write to the stream supplied at construction the eight&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant eight bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putInt8.adoc[`putInt8`] 
| Write to the stream supplied at construction the one&hyphen;byte, two&apos;s complement integer comprised of the least&hyphen;significant one byte of the specified `value`, and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putLength.adoc[`putLength`] 
| If the specified `length` is less than 128, write to the stream supplied at construction the one&hyphen;byte integer comprised of the least&hyphen;significant one byte of the `length`&semi; otherwise, write to the stream the four&hyphen;byte, two&apos;s complement integer (in network byte order) comprised of the least&hyphen;significant four bytes of the `length` (in host byte order) with the most&hyphen;significant bit set&period; Return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period; The behavior is undefined unless `0 &lt;&equals; length`&period;
| xref:BloombergLP/bslx/GenericOutStream/putString.adoc[`putString`] 
| Write to the stream supplied at construction the length of the specified `value` (see `putLength`) and an array of one&hyphen;byte, two&apos;s complement unsigned integers comprised of the least&hyphen;significant one byte of each character in the `value`, and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint16.adoc[`putUint16`] 
| Write to the stream supplied at construction the two&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant two bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint24.adoc[`putUint24`] 
| Write to the stream supplied at construction the three&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant three bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint32.adoc[`putUint32`] 
| Write to the stream supplied at construction the four&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant four bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint40.adoc[`putUint40`] 
| Write to the stream supplied at construction the five&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant five bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint48.adoc[`putUint48`] 
| Write to the stream supplied at construction the six&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant six bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint56.adoc[`putUint56`] 
| Write to the stream supplied at construction the seven&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant seven bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint64.adoc[`putUint64`] 
| Write to the stream supplied at construction the eight&hyphen;byte, two&apos;s complement unsigned integer (in network byte order) comprised of the least&hyphen;significant eight bytes of the specified `value` (in host byte order), and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putUint8.adoc[`putUint8`] 
| Write to the stream supplied at construction the one&hyphen;byte, two&apos;s complement unsigned integer comprised of the least&hyphen;significant one byte of the specified `value`, and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/putVersion.adoc[`putVersion`] 
| Write to the stream supplied at construction the one&hyphen;byte, two&apos;s complement unsigned integer comprised of the least&hyphen;significant one byte of the specified `version`, and return a reference to this stream&period; If this stream is initially invalid, this operation has no effect&period;
| xref:BloombergLP/bslx/GenericOutStream/2conversion.adoc[`operator void const*`] 
| Return a non&hyphen;zero value if this stream is valid, and 0 otherwise&period; An invalid stream is a stream for which an output operation was detected to have failed or `invalidate` was called&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslx/operator_lshift-0e.adoc[`operator&lt;&lt;`]
| Write the specified `value` to the specified output `stream` following the requirements of the BDEX protocol (see the `bslx` package&hyphen;level documentation), and return a reference to `stream`&period; The behavior is undefined unless `TYPE` is BDEX&hyphen;compliant&period;
|===


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