#include <bslx_byteinstream.h>
This class provides input methods to unexternalize values, and C-style arrays of values, of the fundamental integral and floating-point types, as well as bsl::string values, using a byte format documented in the bslx_byteoutstream component. In particular, each get method of this class is guaranteed to read stream data written by the corresponding put method of bslx::ByteOutStream.
- Note
- Note that attempting to read beyond the end of a stream will automatically invalidate the stream. See the
bslx package-level documentation for the definition of the BDEX InStream protocol.
See bslx_byteinstream
|
| | ByteInStream () |
| |
| | ByteInStream (const char *buffer, bsl::size_t numBytes) |
| |
| | ByteInStream (const bslstl::StringRef &srcData) |
| |
| | ~ByteInStream () |
| |
| ByteInStream & | getLength (int &length) |
| |
| ByteInStream & | getVersion (int &version) |
| |
| void | invalidate () |
| |
| void | reset () |
| |
| void | reset (const char *buffer, bsl::size_t numBytes) |
| |
| void | reset (const bslstl::StringRef &srcData) |
| |
| ByteInStream & | getInt64 (bsls::Types::Int64 &variable) |
| |
| ByteInStream & | getUint64 (bsls::Types::Uint64 &variable) |
| |
| ByteInStream & | getInt56 (bsls::Types::Int64 &variable) |
| |
| ByteInStream & | getUint56 (bsls::Types::Uint64 &variable) |
| |
| ByteInStream & | getInt48 (bsls::Types::Int64 &variable) |
| |
| ByteInStream & | getUint48 (bsls::Types::Uint64 &variable) |
| |
| ByteInStream & | getInt40 (bsls::Types::Int64 &variable) |
| |
| ByteInStream & | getUint40 (bsls::Types::Uint64 &variable) |
| |
| ByteInStream & | getInt32 (int &variable) |
| |
| ByteInStream & | getUint32 (unsigned int &variable) |
| |
| ByteInStream & | getInt24 (int &variable) |
| |
| ByteInStream & | getUint24 (unsigned int &variable) |
| |
| ByteInStream & | getInt16 (short &variable) |
| |
| ByteInStream & | getUint16 (unsigned short &variable) |
| |
| ByteInStream & | getInt8 (char &variable) |
| |
| ByteInStream & | getInt8 (signed char &variable) |
| |
| ByteInStream & | getUint8 (char &variable) |
| |
| ByteInStream & | getUint8 (unsigned char &variable) |
| |
| ByteInStream & | getFloat64 (double &variable) |
| |
| ByteInStream & | getFloat32 (float &variable) |
| |
| ByteInStream & | getString (bsl::string &variable) |
| |
| ByteInStream & | getArrayInt64 (bsls::Types::Int64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint64 (bsls::Types::Uint64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt56 (bsls::Types::Int64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint56 (bsls::Types::Uint64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt48 (bsls::Types::Int64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint48 (bsls::Types::Uint64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt40 (bsls::Types::Int64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint40 (bsls::Types::Uint64 *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt32 (int *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint32 (unsigned int *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt24 (int *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint24 (unsigned int *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt16 (short *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint16 (unsigned short *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt8 (char *variables, int numVariables) |
| |
| ByteInStream & | getArrayInt8 (signed char *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint8 (char *variables, int numVariables) |
| |
| ByteInStream & | getArrayUint8 (unsigned char *variables, int numVariables) |
| |
| ByteInStream & | getArrayFloat64 (double *variables, int numVariables) |
| |
| ByteInStream & | getArrayFloat32 (float *variables, int numVariables) |
| |
| | operator const void * () const |
| |
| bsl::size_t | cursor () const |
| |
| const char * | data () const |
| |
| bool | isEmpty () const |
| |
| bool | isValid () const |
| |
| bsl::size_t | length () const |
| |
◆ ByteInStream() [1/3]
| bslx::ByteInStream::ByteInStream |
( |
| ) |
|
|
inlineexplicit |
Create an empty input byte stream.
- Note
- Note that the constructed object is useless until a buffer is set with the
reset method.
◆ ByteInStream() [2/3]
| bslx::ByteInStream::ByteInStream |
( |
const char * |
buffer, |
|
|
bsl::size_t |
numBytes |
|
) |
| |
|
inline |
Create an input byte stream containing the specified initial numBytes from the specified buffer.
- Precondition
- The behavior is undefined unless
0 == numBytes if 0 == buffer.
◆ ByteInStream() [3/3]
Create an input byte stream containing the specified srcData.
◆ ~ByteInStream()
| bslx::ByteInStream::~ByteInStream |
( |
| ) |
|
|
inline |
◆ cursor()
| bsl::size_t bslx::ByteInStream::cursor |
( |
| ) |
const |
|
inline |
Return the index of the next byte to be extracted from this stream.
◆ data()
| const char * bslx::ByteInStream::data |
( |
| ) |
const |
|
inline |
Return the address of the contiguous, non-modifiable external memory buffer of this stream. The behavior of accessing elements outside the range [ data() .. data() + (length() - 1) ] is undefined.
◆ getArrayFloat32()
| ByteInStream & bslx::ByteInStream::getArrayFloat32 |
( |
float * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive four-byte IEEE single-precision floating-point numbers (in host byte order) comprised of each of the specified numVariables four-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
◆ getArrayFloat64()
| ByteInStream & bslx::ByteInStream::getArrayFloat64 |
( |
double * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive eight-byte IEEE double-precision floating-point numbers (in host byte order) comprised of each of the specified numVariables eight-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
◆ getArrayInt16()
| ByteInStream & bslx::ByteInStream::getArrayInt16 |
( |
short * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive two-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables two-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt24()
| ByteInStream & bslx::ByteInStream::getArrayInt24 |
( |
int * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive three-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables three-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numValues and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt32()
| ByteInStream & bslx::ByteInStream::getArrayInt32 |
( |
int * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive four-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables four-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt40()
Assign to the specified variables the consecutive five-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables five-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt48()
Assign to the specified variables the consecutive six-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables six-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt56()
Assign to the specified variables the consecutive seven-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables seven-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt64()
Assign to the specified variables the consecutive eight-byte, two's complement integers (in host byte order) comprised of each of the specified numVariables eight-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt8() [1/2]
| ByteInStream & bslx::ByteInStream::getArrayInt8 |
( |
char * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive one-byte, two's complement integers comprised of each of the specified numVariables one-byte sequences of this stream at the current cursor location, update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be sign-extended.
◆ getArrayInt8() [2/2]
| ByteInStream & bslx::ByteInStream::getArrayInt8 |
( |
signed char * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
◆ getArrayUint16()
| ByteInStream & bslx::ByteInStream::getArrayUint16 |
( |
unsigned short * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive two-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables two-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint24()
| ByteInStream & bslx::ByteInStream::getArrayUint24 |
( |
unsigned int * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive three-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables three-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint32()
| ByteInStream & bslx::ByteInStream::getArrayUint32 |
( |
unsigned int * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive four-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables four-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint40()
Assign to the specified variables the consecutive five-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables five-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint48()
Assign to the specified variables the consecutive six-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables six-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint56()
Assign to the specified variables the consecutive seven-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables seven-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint64()
Assign to the specified variables the consecutive eight-byte, two's complement unsigned integers (in host byte order) comprised of each of the specified numVariables eight-byte sequences of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint8() [1/2]
| ByteInStream & bslx::ByteInStream::getArrayUint8 |
( |
char * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
Assign to the specified variables the consecutive one-byte, two's complement unsigned integers comprised of each of the specified numVariables one-byte sequences of this stream at the current cursor location, update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variables is undefined.
- Precondition
- The behavior is undefined unless
0 <= numVariables and variables has sufficient capacity.
- Note
- Note that each of the values will be zero-extended.
◆ getArrayUint8() [2/2]
| ByteInStream & bslx::ByteInStream::getArrayUint8 |
( |
unsigned char * |
variables, |
|
|
int |
numVariables |
|
) |
| |
|
inline |
◆ getFloat32()
| ByteInStream & bslx::ByteInStream::getFloat32 |
( |
float & |
variable | ) |
|
|
inline |
Assign to the specified variable the four-byte IEEE single-precision floating-point number (in host byte order) comprised of the four bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
◆ getFloat64()
| ByteInStream & bslx::ByteInStream::getFloat64 |
( |
double & |
variable | ) |
|
|
inline |
Assign to the specified variable the eight-byte IEEE double-precision floating-point number (in host byte order) comprised of the eight bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
◆ getInt16()
| ByteInStream & bslx::ByteInStream::getInt16 |
( |
short & |
variable | ) |
|
|
inline |
Assign to the specified variable the two-byte, two's complement integer (in host byte order) comprised of the two bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt24()
| ByteInStream & bslx::ByteInStream::getInt24 |
( |
int & |
variable | ) |
|
|
inline |
Assign to the specified variable the three-byte, two's complement integer (in host byte order) comprised of the three bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt32()
| ByteInStream & bslx::ByteInStream::getInt32 |
( |
int & |
variable | ) |
|
|
inline |
Assign to the specified variable the four-byte, two's complement integer (in host byte order) comprised of the four bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt40()
Assign to the specified variable the five-byte, two's complement integer (in host byte order) comprised of the five bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt48()
Assign to the specified variable the six-byte, two's complement integer (in host byte order) comprised of the six bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt56()
Assign to the specified variable the seven-byte, two's complement integer (in host byte order) comprised of the seven bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt64()
Assign to the specified variable the eight-byte, two's complement integer (in host byte order) comprised of the eight bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt8() [1/2]
| ByteInStream & bslx::ByteInStream::getInt8 |
( |
char & |
variable | ) |
|
|
inline |
Assign to the specified variable the one-byte, two's complement integer comprised of the one byte of this stream at the current cursor location, update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be sign-extended.
◆ getInt8() [2/2]
| ByteInStream & bslx::ByteInStream::getInt8 |
( |
signed char & |
variable | ) |
|
|
inline |
◆ getLength()
| ByteInStream & bslx::ByteInStream::getLength |
( |
int & |
length | ) |
|
|
inline |
If the most-significant bit of the one byte of this stream at the current cursor location is set, assign to the specified length the four-byte, two's complement integer (in host byte order) comprised of the four bytes of this stream at the current cursor location (in network byte order) with the most-significant bit unset; otherwise, assign to length the one-byte, two's complement integer comprised of the one byte of this stream at the current cursor location. Update the cursor location and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of length is undefined.
- Note
- Note that the value will be zero-extended.
◆ getString()
Assign to the specified variable the string comprised of the length of the string (see getLength) and the string data (see getUint8), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
◆ getUint16()
| ByteInStream & bslx::ByteInStream::getUint16 |
( |
unsigned short & |
variable | ) |
|
|
inline |
Assign to the specified variable the two-byte, two's complement unsigned integer (in host byte order) comprised of the two bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint24()
| ByteInStream & bslx::ByteInStream::getUint24 |
( |
unsigned int & |
variable | ) |
|
|
inline |
Assign to the specified variable the three-byte, two's complement unsigned integer (in host byte order) comprised of the three bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint32()
| ByteInStream & bslx::ByteInStream::getUint32 |
( |
unsigned int & |
variable | ) |
|
|
inline |
Assign to the specified variable the four-byte, two's complement unsigned integer (in host byte order) comprised of the four bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint40()
Assign to the specified variable the five-byte, two's complement unsigned integer (in host byte order) comprised of the five bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint48()
Assign to the specified variable the six-byte, two's complement unsigned integer (in host byte order) comprised of the six bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint56()
Assign to the specified variable the seven-byte, two's complement unsigned integer (in host byte order) comprised of the seven bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint64()
Assign to the specified variable the eight-byte, two's complement unsigned integer (in host byte order) comprised of the eight bytes of this stream at the current cursor location (in network byte order), update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint8() [1/2]
| ByteInStream & bslx::ByteInStream::getUint8 |
( |
char & |
variable | ) |
|
|
inline |
Assign to the specified variable the one-byte, two's complement unsigned integer comprised of the one byte of this stream at the current cursor location, update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of variable is undefined.
- Note
- Note that the value will be zero-extended.
◆ getUint8() [2/2]
| ByteInStream & bslx::ByteInStream::getUint8 |
( |
unsigned char & |
variable | ) |
|
|
inline |
◆ getVersion()
| ByteInStream & bslx::ByteInStream::getVersion |
( |
int & |
version | ) |
|
|
inline |
Assign to the specified version the one-byte, two's complement unsigned integer comprised of the one byte of this stream at the current cursor location, update the cursor location, and return a reference to this stream. If this stream is initially invalid, this operation has no effect. If this function otherwise fails to extract a valid value, this stream is marked invalid and the value of version is undefined.
- Note
- Note that the value will be zero-extended.
◆ invalidate()
| void bslx::ByteInStream::invalidate |
( |
| ) |
|
|
inline |
Put this input stream in an invalid state. This function has no effect if this stream is already invalid.
- Note
- Note that this function should be called whenever a value extracted from this stream is determined to be invalid, inconsistent, or otherwise incorrect.
◆ isEmpty()
| bool bslx::ByteInStream::isEmpty |
( |
| ) |
const |
|
inline |
Return true if this stream is empty, and false otherwise.
- Note
- Note that this function enables higher-level types to verify that, after successfully reading all expected data, no data remains.
◆ isValid()
| bool bslx::ByteInStream::isValid |
( |
| ) |
const |
|
inline |
Return true if this stream is valid, and false otherwise. An invalid stream is a stream in which insufficient or invalid data was detected during an extraction operation.
- Note
- Note that an empty stream will be valid unless an extraction attempt or explicit invalidation causes it to be otherwise.
◆ length()
| bsl::size_t bslx::ByteInStream::length |
( |
| ) |
const |
|
inline |
Return the total number of bytes stored in the external memory buffer.
◆ operator const void *()
| bslx::ByteInStream::operator const void * |
( |
| ) |
const |
|
inline |
Return a non-zero value if this stream is valid, and 0 otherwise. An invalid stream is a stream for which an input operation was detected to have failed.
◆ reset() [1/3]
| void bslx::ByteInStream::reset |
( |
| ) |
|
|
inline |
Set the index of the next byte to be extracted from this stream to 0 (i.e., the beginning of the stream) and validate this stream if it is currently invalid.
◆ reset() [2/3]
Reset this stream to extract from the specified srcData, set the index of the next byte to be extracted to 0 (i.e., the beginning of the stream), and validate this stream if it is currently invalid.
◆ reset() [3/3]
| void bslx::ByteInStream::reset |
( |
const char * |
buffer, |
|
|
bsl::size_t |
numBytes |
|
) |
| |
|
inline |
Reset this stream to extract from the specified buffer containing the specified numBytes, set the index of the next byte to be extracted to 0 (i.e., the beginning of the stream), and validate this stream if it is currently invalid.
- Precondition
- The behavior is undefined unless
0 == numBytes if 0 == buffer.
◆ operator<<
| bsl::ostream & operator<< |
( |
bsl::ostream & |
stream, |
|
|
const ByteInStream & |
object |
|
) |
| |
|
friend |
Write the specified object to the specified output stream in some reasonable (multi-line) format, and return a reference to stream.
The documentation for this class was generated from the following file: