This class provides output methods to externalize values, and C‐style arrays of values, of the fundamental integral and floating‐point types, as well as bsl::string values. 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::GenericInStream. See the bslx package‐level documentation for the definition of the BDEX OutStream protocol.

Synopsis

Declared in <bslx_genericoutstream.h>

template<class STREAMBUF>
class GenericOutStream;

Member Functions

Name

Description

GenericOutStream [constructor]

Create an output byte stream that writes its output to the specified streamBuf and uses the specified (compile‐time‐defined) versionSelector as needed (see {Versioning}). Note that the versionSelector is expected to be formatted as "YYYYMMDD", a date representation.

~GenericOutStream [destructor]

Destroy this object.

bdexVersionSelector

Return the versionSelector to be used with operator<< for BDEX streaming as per the bslx package‐level documentation.

flush

If this stream is valid, invoke the pubsync method on the underlying stream supplied at construction of this object; otherwise, this function has no effect.

invalidate

Put this output stream in an invalid state. This function has no effect if this stream is already invalid.

isValid

Return true if this stream is valid, and false otherwise. An invalid stream is a stream for which an output operation was detected to have failed or invalidate was called.

putArrayFloat32

Write to the stream supplied at construction the consecutive four‐byte IEEE single‐precision floating‐point numbers (in network byte order) comprised of the most‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents. Note that for non‐conforming platforms, this operation may be lossy.

putArrayFloat64

Write to the stream supplied at construction the consecutive eight‐byte IEEE double‐precision floating‐point numbers (in network byte order) comprised of the most‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents. Note that for non‐conforming platforms, this operation may be lossy.

putArrayInt16

Write to the stream supplied at construction the consecutive two‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt24

Write to the stream supplied at construction the consecutive three‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt32

Write to the stream supplied at construction the consecutive four‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt40

Write to the stream supplied at construction the consecutive five‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt48

Write to the stream supplied at construction the consecutive six‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt56

Write to the stream supplied at construction the consecutive seven‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt64

Write to the stream supplied at construction the consecutive eight‐byte, two's complement integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt8

putArrayInt8 overloads

putArrayUint16

Write to the stream supplied at construction the consecutive two‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint24

Write to the stream supplied at construction the consecutive three‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint32

Write to the stream supplied at construction the consecutive four‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint40

Write to the stream supplied at construction the consecutive five‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint48

Write to the stream supplied at construction the consecutive six‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint56

Write to the stream supplied at construction the consecutive seven‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint64

Write to the stream supplied at construction the consecutive eight‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐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. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint8

putArrayUint8 overloads

putFloat32

Write to the stream supplied at construction the four‐byte IEEE single‐precision floating‐point number (in network byte order) comprised of the most‐significant four bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. Note that for non‐conforming platforms, this operation may be lossy.

putFloat64

Write to the stream supplied at construction the eight‐byte IEEE double‐precision floating‐point number (in network byte order) comprised of the most‐significant eight bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect. Note that for non‐conforming platforms, this operation may be lossy.

putInt16

Write to the stream supplied at construction the two‐byte, two's complement integer (in network byte order) comprised of the least‐significant two bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt24

Write to the stream supplied at construction the three‐byte, two's complement integer (in network byte order) comprised of the least‐significant three bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt32

Write to the stream supplied at construction the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt40

Write to the stream supplied at construction the five‐byte, two's complement integer (in network byte order) comprised of the least‐significant five bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt48

Write to the stream supplied at construction the six‐byte, two's complement integer (in network byte order) comprised of the least‐significant six bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt56

Write to the stream supplied at construction the seven‐byte, two's complement integer (in network byte order) comprised of the least‐significant seven bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt64

Write to the stream supplied at construction the eight‐byte, two's complement integer (in network byte order) comprised of the least‐significant eight bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putInt8

Write to the stream supplied at construction the one‐byte, two's complement integer comprised of the least‐significant one byte of the specified value, and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putLength

If the specified length is less than 128, write to the stream supplied at construction the one‐byte integer comprised of the least‐significant one byte of the length; otherwise, write to the stream the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the length (in host byte order) with the most‐significant bit set. Return a reference to this stream. If this stream is initially invalid, this operation has no effect. The behavior is undefined unless 0 <= length.

putString

Write to the stream supplied at construction the length of the specified value (see putLength) and an array of one‐byte, two's complement unsigned integers comprised of the least‐significant one byte of each character in the value, and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint16

Write to the stream supplied at construction the two‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant two bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint24

Write to the stream supplied at construction the three‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant three bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint32

Write to the stream supplied at construction the four‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant four bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint40

Write to the stream supplied at construction the five‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant five bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint48

Write to the stream supplied at construction the six‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant six bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint56

Write to the stream supplied at construction the seven‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant seven bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint64

Write to the stream supplied at construction the eight‐byte, two's complement unsigned integer (in network byte order) comprised of the least‐significant eight bytes of the specified value (in host byte order), and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putUint8

Write to the stream supplied at construction the one‐byte, two's complement unsigned integer comprised of the least‐significant one byte of the specified value, and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

putVersion

Write to the stream supplied at construction the one‐byte, two's complement unsigned integer comprised of the least‐significant one byte of the specified version, and return a reference to this stream. If this stream is initially invalid, this operation has no effect.

operator void const*

Return a non‐zero value if this stream is valid, and 0 otherwise. An invalid stream is a stream for which an output operation was detected to have failed or invalidate was called.

Non-Member Functions

Name

Description

operator<<

Write the specified value to the specified output stream following the requirements of the BDEX protocol (see the bslx package‐level documentation), and return a reference to stream. The behavior is undefined unless TYPE is BDEX‐compliant.

Created with MrDocs