Network output stream message container. (TCP). More...
#include <stream-message.hpp>
Public Member Functions | |
| OutStreamMessage (uint8_t *buffer, size_t bufferSize, size_t messageSize, uint8_t lengthSize) noexcept | |
| Creates a new output stream message. (TCP). | |
| OutStreamMessage (std::vector< uint8_t > &buffer, size_t messageSize, uint8_t lengthSize) noexcept | |
| Creates a new output stream message. (TCP). | |
| OutStreamMessage () noexcept=default | |
| Creates a new empty output stream message. | |
| const uint8_t * | getBuffer () const noexcept |
| Returns stream message buffer. | |
| size_t | getSize () const noexcept |
| Returns stream message size in bytes. | |
| bool | write (const void *data, size_t count) noexcept |
| Writes data to the stream message and advances offset. | |
| bool | write (uint8_t value) noexcept |
| Writes 8-bit unsigned integer value to the stream message and advances offset. | |
| bool | write (uint16_t value) noexcept |
| Writes 16-bit unsigned integer value to the stream message and advances offset. | |
| bool | write (uint32_t value) noexcept |
| Writes 32-bit unsigned integer value to the stream message and advances offset. | |
| bool | write (uint64_t value) noexcept |
| Writes 64-bit unsigned integer value to the stream message and advances offset. | |
| bool | write (int8_t value) noexcept |
| Writes 8-bit signed integer value to the stream message and advances offset. | |
| bool | write (int16_t value) noexcept |
| Writes 16-bit signed integer value to the stream message and advances offset. | |
| bool | write (int32_t value) noexcept |
| Writes 32-bit signed integer value to the stream message and advances offset. | |
| bool | write (int64_t value) noexcept |
| Writes 64-bit signed integer value to the stream message and advances offset. | |
| bool | write (float value) noexcept |
| Writes 32-bit signed integer value to the stream message and advances offset. | |
| bool | write (double value) noexcept |
| Writes 64-bit signed integer value to the stream message and advances offset. | |
| bool | write (std::string_view value, uint8_t lengthSize) noexcept |
| Writes string to the stream message and advances offset. | |
| bool | write (bool value) noexcept |
| Writes boolean value to the stream message and advances offset. | |
| bool | write (const void *data, size_t dataSize, uint8_t lengthSize) noexcept |
| Writes data to the stream message and advances offset. | |
| template<class T> | |
| bool | write (const std::vector< T > &data, uint8_t lengthSize) noexcept |
| Writes vector data to the stream message and advances offset. | |
| template<class T, size_t N> | |
| bool | write (const std::array< T, N > &data, uint8_t lengthSize) noexcept |
| Writes array data to the stream message and advances offset. | |
| const uint8_t * | getEnd () const noexcept |
| Returns stream message end pointer. | |
| bool | isComplete () const noexcept |
| Returns true if stream message is not empty and complete, otherwise false. | |
| size_t | getLeft () const noexcept |
| Returns stream message byte count left to read or write. | |
| bool | read (const void *&data, size_t count) noexcept |
| Reads data from the stream message and advances offset. | |
| bool | read (uint8_t &value) noexcept |
| Reads 8-bit unsigned integer value from the stream message and advances offset. | |
| bool | read (uint16_t &value) noexcept |
| Reads 16-bit unsigned integer value from the stream message and advances offset. | |
| bool | read (uint32_t &value) noexcept |
| Reads 32-bit unsigned integer value from the stream message and advances offset. | |
| bool | read (uint64_t &value) noexcept |
| Reads 64-bit unsigned integer value from the stream message and advances offset. | |
| bool | read (int8_t &value) noexcept |
| Reads 8-bit signed integer value from the stream message and advances offset. | |
| bool | read (int16_t &value) noexcept |
| Reads 16-bit signed integer value from the stream message and advances offset. | |
| bool | read (int32_t &value) noexcept |
| Reads 32-bit signed integer value from the stream message and advances offset. | |
| bool | read (int64_t &value) noexcept |
| Reads 64-bit signed integer value from the stream message and advances offset. | |
| bool | read (float &value) noexcept |
| Reads 32-bit floating point value from the stream message and advances offset. | |
| bool | read (double &value) noexcept |
| Reads 64-bit floating point value from the stream message and advances offset. | |
| bool | read (std::string_view &value, uint8_t lengthSize) noexcept |
| Reads string from the stream message and advances offset. | |
| bool | read (std::string &value, uint8_t lengthSize) noexcept |
| Reads string from the stream message and advances offset. | |
| bool | read (bool &value) noexcept |
| Reads boolean value from the stream message and advances offset. | |
| bool | read (const void *&data, size_t &dataSize, uint8_t lengthSize) noexcept |
| Reads data from the stream message and advances offset. | |
| template<class T> | |
| bool | read (std::vector< T > &data, uint8_t lengthSize) noexcept |
| Reads vector data from the stream message and advances offset. | |
Data Fields | |
| uint8_t * | iter |
Static Public Attributes | |
| static constexpr uint8_t | maxLengthSize = STREAM_MESSAGE_MAX_LENGTH_SIZE |
| Maximum size of the stream message length in bytes. | |
| static constexpr uint16_t | maxDatagramSize = MAX_DATAGRAM_MESSAGE_SIZE |
| Safe maximum UDP datagram size in bytes. (Includes IP and VPN overhead). | |
Protected Attributes | |
| uint8_t * | buffer = nullptr |
| size_t | size = 0 |
| uint8_t * | end |
Network output stream message container. (TCP).
See the stream-message.h
|
inlinenoexcept |
Creates a new output stream message. (TCP).
See the createStreamMessage().
| [in,out] | buffer | message data buffer |
| bufferSize | message buffer size in bytes | |
| messageSize | message size in bytes | |
| lengthSize | message header length size in bytes |
|
inlinenoexcept |
Creates a new output stream message. (TCP).
See the createStreamMessage().
| [in,out] | buffer | message data buffer |
| messageSize | message size in bytes | |
| lengthSize | message header size in bytes |
|
inlinenoexcept |
Writes data to the stream message and advances offset.
See the writeStreamMessage().
| [in] | data | message data to write |
| count | message byte count to write |
|
inlinenoexcept |
Writes 8-bit unsigned integer value to the stream message and advances offset.
See the writeStreamMessageUint8().
| value | unsigned integer value to write |
|
inlinenoexcept |
Writes 16-bit unsigned integer value to the stream message and advances offset.
See the writeStreamMessageUint16().
| value | unsigned integer value to write |
|
inlinenoexcept |
Writes 32-bit unsigned integer value to the stream message and advances offset.
See the writeStreamMessageUint32().
| value | unsigned integer value to write |
|
inlinenoexcept |
Writes 64-bit unsigned integer value to the stream message and advances offset.
See the writeStreamMessageUint64().
| value | unsigned integer value to write |
|
inlinenoexcept |
Writes 8-bit signed integer value to the stream message and advances offset.
See the writeStreamMessageInt8().
| value | signed integer value to write |
|
inlinenoexcept |
Writes 16-bit signed integer value to the stream message and advances offset.
See the writeStreamMessageInt16().
| value | signed integer value to write |
|
inlinenoexcept |
Writes 32-bit signed integer value to the stream message and advances offset.
See the writeStreamMessageInt32().
| value | signed integer value to write |
|
inlinenoexcept |
Writes 64-bit signed integer value to the stream message and advances offset.
See the writeStreamMessageInt64().
| value | signed integer value to write |
|
inlinenoexcept |
Writes 32-bit signed integer value to the stream message and advances offset.
See the writeStreamMessageFloat32().
| value | floating point value to write |
|
inlinenoexcept |
Writes 64-bit signed integer value to the stream message and advances offset.
See the writeStreamMessageFloat64().
| value | floating point value to write |
|
inlinenoexcept |
Writes string to the stream message and advances offset.
See the writeStreamMessageData().
| value | message string to write |
| lengthSize | length of the string size in bytes |
|
inlinenoexcept |
Writes boolean value to the stream message and advances offset.
See the writeStreamMessageBool().
| value | boolean value to write |
Writes data to the stream message and advances offset.
See the writeStreamMessageData().
| [in] | data | message data to write |
| dataSize | size of the data in bytes | |
| lengthSize | length of the data size in bytes |
|
inlinenoexcept |
Writes vector data to the stream message and advances offset.
See the writeStreamMessageData().
| T | type of the vector data |
| [in] | data | message data vector to write |
| lengthSize | length of the data size in bytes |
|
inlinenoexcept |
Writes array data to the stream message and advances offset.
See the writeStreamMessageData().
| T | type of the array data |
| S | size of the array |
| [in] | data | message data array to write |
| lengthSize | length of the data size in bytes |
|
inlinenoexceptinherited |
Returns true if stream message is not empty and complete, otherwise false.
See the isStreamMessageComplete().
|
inlinenoexceptinherited |
Returns stream message byte count left to read or write.
See the getStreamMessageLeft().
|
inlinenoexceptinherited |
Reads data from the stream message and advances offset.
See the readStreamMessage().
| [out] | data | reference to the message data |
| count | message byte count to read |
|
inlinenoexceptinherited |
Reads 8-bit unsigned integer value from the stream message and advances offset.
See the readStreamMessageUint8().
| [out] | value | reference to the unsigned integer value |
|
inlinenoexceptinherited |
Reads 16-bit unsigned integer value from the stream message and advances offset.
See the readStreamMessageUint16().
| [out] | value | reference to the unsigned integer value |
|
inlinenoexceptinherited |
Reads 32-bit unsigned integer value from the stream message and advances offset.
See the readStreamMessageUint32().
| [out] | value | reference to the unsigned integer value |
|
inlinenoexceptinherited |
Reads 64-bit unsigned integer value from the stream message and advances offset.
See the readStreamMessageUint64().
| [out] | value | reference to the unsigned integer value |
|
inlinenoexceptinherited |
Reads 8-bit signed integer value from the stream message and advances offset.
See the readStreamMessageInt8().
| [out] | value | reference to the signed integer value |
|
inlinenoexceptinherited |
Reads 16-bit signed integer value from the stream message and advances offset.
See the readStreamMessageInt16().
| [out] | value | reference to the signed integer value |
|
inlinenoexceptinherited |
Reads 32-bit signed integer value from the stream message and advances offset.
See the readStreamMessageInt32().
| [out] | value | reference to the signed integer value |
|
inlinenoexceptinherited |
Reads 64-bit signed integer value from the stream message and advances offset.
See the readStreamMessageInt64().
| [out] | value | reference to the signed integer value |
|
inlinenoexceptinherited |
Reads 32-bit floating point value from the stream message and advances offset.
See the readStreamMessageFloat32().
| [out] | value | reference to the floating point value |
|
inlinenoexceptinherited |
Reads 64-bit floating point value from the stream message and advances offset.
See the readStreamMessageFloat64().
| [out] | value | reference to the floating point value |
|
inlinenoexceptinherited |
Reads string from the stream message and advances offset.
See the readStreamMessageData().
| [out] | value | reference to the message string |
| lengthSize | length of the string size in bytes |
|
inlinenoexceptinherited |
Reads string from the stream message and advances offset.
See the readStreamMessageData().
| [out] | value | reference to the message string |
| lengthSize | length of the string size in bytes |
|
inlinenoexceptinherited |
Reads boolean value from the stream message and advances offset.
See the readStreamMessageBool().
| [out] | value | reference to the boolean value |
Reads data from the stream message and advances offset.
See the readStreamMessageData().
| [out] | data | reference to the message data |
| [out] | dataSize | reference to the data size in bytes |
| lengthSize | length of the data size in bytes |
|
inlinenoexceptinherited |
Reads vector data from the stream message and advances offset.
See the readStreamMessageData().
| T | type of the vector data |
| [out] | data | reference to the message data vector |
| lengthSize | length of the data size in bytes |