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

<<value-type>> Represents a StructType member More...

#include "dds/core/xtypes/MemberType.hpp"

Public Member Functions

 Member (const std::string &name, const DynamicTypeImpl &type)
 Creates a member consisting of a name and a type. More...
 
 Member (const std::string &the_name, DynamicTypeImpl &&the_type)
 <<C++11>> Creates a member consisting of a name and a type. More...
 
const dds::core::stringname () const
 Gets the member name. More...
 
dds::core::stringname ()
 Gets the member name. More...
 
const DynamicTypetype ()
 Gets the member type. More...
 
bool has_id () const
 Indicates it the member has an ID annotation. More...
 
int32_t get_id () const
 Returns the ID annotation of this member. More...
 
bool is_pointer () const
 <<extension>> Indicates if this member is a pointer More...
 
bool is_key () const
 Checks if a member is a key. More...
 
bool is_optional () const
 Checks if a member is optional. More...
 
bool is_bitset () const
 Checks if a member is a bitset. More...
 
bool has_bitbound () const
 Unsupported, always returns false. More...
 
int32_t get_bitbound () const
 Unsupported, always returns 32. More...
 
Membername (const dds::core::string &value)
 Sets the member name. More...
 
Memberkey (bool value)
 Sets the key annotation of a member. More...
 
Memberoptional (bool value)
 Sets the optional annotation of a member. More...
 
Memberid (int32_t value)
 Sets the ID annotation of a member. More...
 
Memberpointer (bool value)
 <<extension>> Makes a member a pointer More...
 

Static Public Attributes

static const int32_t INVALID_ID
 The special ID of a member without the ID annotation. More...
 

Detailed Description

<<value-type>> Represents a StructType member

Encapsulates the name and type of a StructType member along with several IDL annotations (key, optional, bitset, bitbound, id).

Constructor & Destructor Documentation

◆ Member() [1/2]

dds::core::xtypes::Member::Member ( const std::string &  name,
const DynamicTypeImpl &  type 
)

Creates a member consisting of a name and a type.

◆ Member() [2/2]

dds::core::xtypes::Member::Member ( const std::string &  the_name,
DynamicTypeImpl &&  the_type 
)
inline

<<C++11>> Creates a member consisting of a name and a type.

The type is moved.

Member Function Documentation

◆ name() [1/3]

const dds::core::string & dds::core::xtypes::Member::name ( ) const

Gets the member name.

◆ name() [2/3]

dds::core::string & dds::core::xtypes::Member::name ( )

Gets the member name.

◆ type()

const DynamicType & dds::core::xtypes::Member::type ( )

Gets the member type.

◆ has_id()

bool dds::core::xtypes::Member::has_id ( ) const

Indicates it the member has an ID annotation.

True if this member has been annotated explicitly with an ID. False if the has a default-assigned ID.

◆ get_id()

int32_t dds::core::xtypes::Member::get_id ( ) const

Returns the ID annotation of this member.

If has_id() is true, this returns the value of the ID annotation. Otherwise it returns INVALID_ID.

◆ is_pointer()

bool dds::core::xtypes::Member::is_pointer ( ) const

<<extension>> Indicates if this member is a pointer

◆ is_key()

bool dds::core::xtypes::Member::is_key ( ) const

Checks if a member is a key.

This corresponds to the @Key IDL member annotation

◆ is_optional()

bool dds::core::xtypes::Member::is_optional ( ) const

Checks if a member is optional.

This corresponds to the @Optional IDL member annotation

◆ is_bitset()

bool dds::core::xtypes::Member::is_bitset ( ) const

Checks if a member is a bitset.

◆ has_bitbound()

bool dds::core::xtypes::Member::has_bitbound ( ) const

Unsupported, always returns false.

◆ get_bitbound()

int32_t dds::core::xtypes::Member::get_bitbound ( ) const

Unsupported, always returns 32.

◆ name() [3/3]

Member & dds::core::xtypes::Member::name ( const dds::core::string value)

Sets the member name.

◆ key()

Member & dds::core::xtypes::Member::key ( bool  value)

Sets the key annotation of a member.

Postcondition
If optional() was true and key is set to true, optional() becomes false, because a member can't be both a key and optional.

[default] false

◆ optional()

Member & dds::core::xtypes::Member::optional ( bool  value)

Sets the optional annotation of a member.

Postcondition
If key() was true and optional is set to true, key() becomes false, because a member can't be both a key and optional.

[default] false

◆ id()

Member & dds::core::xtypes::Member::id ( int32_t  value)

Sets the ID annotation of a member.

[default] Automatically assigned as the ID of the previous member plus one previous member

◆ pointer()

Member & dds::core::xtypes::Member::pointer ( bool  value)

<<extension>> Makes a member a pointer

[default] false

Member Data Documentation

◆ INVALID_ID

const int32_t dds::core::xtypes::Member::INVALID_ID
static

The special ID of a member without the ID annotation.