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

Built-in type consisting of a single character string. More...

#include <dds/core/BuiltinTopicTypes.hpp>

Public Member Functions

 StringTopicType ()
 Creates a sample containing an empty string. More...
 
 StringTopicType (const dds::core::string &the_data)
 Creates a sample from a dds::core::string. More...
 
 StringTopicType (const std::string &the_data)
 Creates a sample from a std::string. More...
 
 StringTopicType (const char *the_data)
 Creates an instance from a char*. More...
 
 operator std::string () const
 Automatic conversion to std::string. More...
 
 operator dds::core::string & ()
 Automatic conversion to dds::core::string. More...
 
 operator const dds::core::string & () const
 Automatic conversion to dds::core::string. More...
 
const dds::core::stringdata () const
 Gets the string. More...
 
dds::core::stringdata ()
 Gets the string. More...
 
void data (const dds::core::string &value)
 Sets the string. More...
 

Detailed Description

Built-in type consisting of a single character string.

See also
Built-in Types

Constructor & Destructor Documentation

◆ StringTopicType() [1/4]

dds::core::StringTopicType::StringTopicType ( )
inline

Creates a sample containing an empty string.

◆ StringTopicType() [2/4]

dds::core::StringTopicType::StringTopicType ( const dds::core::string the_data)
inline

Creates a sample from a dds::core::string.

Note that this constructor is implicit so you can use a dds::core::string wherever a StringTopicType instance is expected

◆ StringTopicType() [3/4]

dds::core::StringTopicType::StringTopicType ( const std::string &  the_data)
inline

Creates a sample from a std::string.

Note that this constructor is implicit so you can use an std::string wherever a StringTopicType instance is expected, for example:

std::string str = "Hello World!";
writer.write(str);
<<reference-type>> Allows an application to publish data for a dds::topic::Topic
Definition: TDataWriter.hpp:58
basic_string< char, rti::core::memory::OsapiAllocator< char > > string
A string convertible to std::string and with similar functionality.
Definition: String.hpp:266
Parameters
the_dataThe string to be copied to create this instance

◆ StringTopicType() [4/4]

dds::core::StringTopicType::StringTopicType ( const char *  the_data)
inline

Creates an instance from a char*.

Note that this constructor is implicit so you can use an char* wherever a StringTopicType instance is expected, for example:

writer.write("Hello, World!");
Parameters
the_dataThe string to be copied to create this instance

Member Function Documentation

◆ operator std::string()

dds::core::StringTopicType::operator std::string ( ) const
inline

Automatic conversion to std::string.

Returns
A copy of the string

◆ operator dds::core::string &()

dds::core::StringTopicType::operator dds::core::string & ( )
inline

Automatic conversion to dds::core::string.

Returns
A reference to the string

◆ operator const dds::core::string &()

dds::core::StringTopicType::operator const dds::core::string & ( ) const
inline

Automatic conversion to dds::core::string.

Returns
A const-reference to the string

◆ data() [1/3]

const dds::core::string & dds::core::StringTopicType::data ( ) const
inline

Gets the string.

Returns
A const-reference to the string

◆ data() [2/3]

dds::core::string & dds::core::StringTopicType::data ( )
inline

Gets the string.

Returns
A reference to the string

◆ data() [3/3]

void dds::core::StringTopicType::data ( const dds::core::string value)
inline

Sets the string.

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