This class implements output methods to externalize fundamental types and their associated type identification data. It stores the accumulated result in network byte order. See the bslx package‐level documentation for the definition of the BDEX OutStream protocol.

Synopsis

Declared in <bslx_testoutstream.h>

class TestOutStream;

Member Functions

Name

Description

TestOutStream [constructor]

Constructors

~TestOutStream [destructor]

Destroy this object.

bdexVersionSelector

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

data

Return the address of the contiguous, non‐modifiable internal memory buffer of this stream. The address will remain valid as long as this array is not destroyed or modified (i.e., the current capacity is not exceeded). The behavior of accessing elements outside the range [ data() .. data() + (length() ‐ 1) ] is undefined.

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.

length

Return the number of bytes in this stream.

makeNextInvalid

Make the next output operation externalize the invalid data indicator, as opposed to the actual type indicator, to this output stream; the data associated with the next output operation is still externalized. Note that the invalid data indicator can be detected by a corresponding TestInStream object.

putArrayFloat32

Write to this stream the one‐byte type indicator for a four‐byte single‐precision floating‐point number, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and 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 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. 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 this stream the one‐byte type indicator for an eight‐byte double‐precision floating‐point number, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and 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 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. 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 this stream the one‐byte type indicator for a two‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive two‐byte, two's complement integers (in network byte order) comprised of the least‐significant two bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt24

Write to this stream the one‐byte type indicator for a three‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive three‐byte, two's complement integers (in network byte order) comprised of the least‐significant three bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt32

Write to this stream the one‐byte type indicator for a four‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive four‐byte, two's complement integers (in network byte order) comprised of the least‐significant four bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt40

Write to this stream the one‐byte type indicator for a five‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive five‐byte, two's complement integers (in network byte order) comprised of the least‐significant five bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt48

Write to this stream the one‐byte type indicator for a six‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive six‐byte, two's complement integers (in network byte order) comprised of the least‐significant six bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt56

Write to this stream the one‐byte type indicator for a seven‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive seven‐byte, two's complement integers (in network byte order) comprised of the least‐significant seven bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt64

Write to this stream the one‐byte type indicator for an eight‐byte integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive eight‐byte, two's complement integers (in network byte order) comprised of the least‐significant eight bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayInt8

putArrayInt8 overloads

putArrayUint16

Write to this stream the one‐byte type indicator for a two‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive two‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant two bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint24

Write to this stream the one‐byte type indicator for a three‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive three‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant three bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint32

Write to this stream the one‐byte type indicator for a four‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive four‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant four bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint40

Write to this stream the one‐byte type indicator for a five‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive five‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant five bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint48

Write to this stream the one‐byte type indicator for a six‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive six‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant six bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint56

Write to this stream the one‐byte type indicator for a seven‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive seven‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant seven bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint64

Write to this stream the one‐byte type indicator for an eight‐byte unsigned integer, the four‐byte, two's complement integer (in network byte order) comprised of the least‐significant four bytes of the specified numValues (in host byte order), and the consecutive eight‐byte, two's complement unsigned integers (in network byte order) comprised of the least‐significant eight bytes of each of the 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= numValues and values has sufficient contents.

putArrayUint8

putArrayUint8 overloads

putFloat32

Write to this stream the one‐byte type indicator for a four‐byte single‐precision floating‐point number and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. Note that for non‐conforming platforms, this operation may be lossy.

putFloat64

Write to this stream the one‐byte type indicator for an eight‐byte double‐precision floating‐point number and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. Note that for non‐conforming platforms, this operation may be lossy.

putInt16

Write to this stream the one‐byte type indicator for a two‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt24

Write to this stream the one‐byte type indicator for a three‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt32

Write to this stream the one‐byte type indicator for a four‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt40

Write to this stream the one‐byte type indicator for a five‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt48

Write to this stream the one‐byte type indicator for a six‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt56

Write to this stream the one‐byte type indicator for a seven‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt64

Write to this stream the one‐byte type indicator for an eight‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putInt8

Write to this stream the one‐byte type indicator for a one‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putLength

If the specified length is less than 128, write to this stream the one‐byte type indicator for a one‐byte integer and the one‐byte integer comprised of the least‐significant one byte of the length; otherwise, write to this stream the one‐byte type indicator for a four‐byte integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator. The behavior is undefined unless 0 <= length.

putString

Write to this stream the one‐byte type indicator for a length (see putLength), the length of the specified value (see putLength), the one‐byte type indicator for an array of one‐byte unsigned integers, 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint16

Write to this stream the one‐byte type indicator for a two‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint24

Write to this stream the one‐byte type indicator for a three‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint32

Write to this stream the one‐byte type indicator for a four‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint40

Write to this stream the one‐byte type indicator for a five‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint48

Write to this stream the one‐byte type indicator for a six‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint56

Write to this stream the one‐byte type indicator for a seven‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint64

Write to this stream the one‐byte type indicator for an eight‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putUint8

Write to this stream the one‐byte type indicator for a one‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

putVersion

Write to this stream the one‐byte type indicator for a one‐byte unsigned integer and 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. If the next output operation has been set to be marked invalid (see makeNextInvalid), reset this marking and emit the invalid indicator instead of the type indicator.

reserveCapacity

Set the internal buffer size of this stream to be at least the specified newCapacity (in bytes).

reset

Remove all content in this stream and validate this stream if it is currently invalid.

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.

Friends

Name

Description

BloombergLP::bslx::operator<<

Write the specified object to the specified output stream in some reasonable (multi‐line) format, and return a reference to stream.

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