RTI Connext Modern C++ API Version 7.2.0
dds::core::BytesTopicType Class Reference

Built-in type consisting of a variable-length array of opaque bytes. More...

#include <dds/core/BuiltinTopicTypes.hpp>

Public Member Functions

 BytesTopicType ()
 Creates a sample with an empty array of bytes. More...
 
 BytesTopicType (const std::vector< uint8_t > &the_data)
 Creates a sample with a vector of bytes. More...
 
 operator std::vector< uint8_t > () const
 Automatic conversion to std::vector. More...
 
std::vector< uint8_t > data () const
 Gets the bytes in a std::vector. More...
 
void data (const std::vector< uint8_t > &value)
 Sets the bytes. More...
 
uint8_t & operator[] (uint32_t index)
 Access the bytes by index. More...
 
uint8_t operator[] (uint32_t index) const
 Access the bytes by index. More...
 
int32_t length () const
 Get the number of bytes. More...
 

Detailed Description

Built-in type consisting of a variable-length array of opaque bytes.

See also
Built-in Types

Constructor & Destructor Documentation

◆ BytesTopicType() [1/2]

dds::core::BytesTopicType::BytesTopicType ( )
inline

Creates a sample with an empty array of bytes.

◆ BytesTopicType() [2/2]

dds::core::BytesTopicType::BytesTopicType ( const std::vector< uint8_t > &  the_data)
inline

Creates a sample with a vector of bytes.

Parameters
the_dataThe octets

Note that this constructor is implicit so you can use a std::vector<uint8_t> wherever a BytesTopicType instance is expected

Member Function Documentation

◆ operator std::vector< uint8_t >()

dds::core::BytesTopicType::operator std::vector< uint8_t > ( ) const
inline

Automatic conversion to std::vector.

Returns
A copy of the bytes

◆ data() [1/2]

std::vector< uint8_t > dds::core::BytesTopicType::data ( ) const
inline

Gets the bytes in a std::vector.

Returns
A copy of the bytes

◆ data() [2/2]

void dds::core::BytesTopicType::data ( const std::vector< uint8_t > &  value)
inline

Sets the bytes.

Parameters
valueThe bytes

◆ operator[]() [1/2]

uint8_t & dds::core::BytesTopicType::operator[] ( uint32_t  index)
inline

Access the bytes by index.

References dds::core::Value< D >::delegate().

◆ operator[]() [2/2]

uint8_t dds::core::BytesTopicType::operator[] ( uint32_t  index) const
inline

Access the bytes by index.

References dds::core::Value< D >::delegate().

◆ length()

int32_t dds::core::BytesTopicType::length ( ) const
inline

Get the number of bytes.

References dds::core::Value< D >::delegate().