RTI Connext Modern C++ API  Version 5.3.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::core::xtypes::UnionMember Class Reference

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

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

Public Types

typedef DDS_Long DiscriminatorType
 The type to represent a union discriminator.
 
typedef std::vector
< DiscriminatorType
LabelSeq
 A sequence of values for the discriminator that select a member.
 

Public Member Functions

 UnionMember (const std::string &name, const DynamicTypeImpl &type, const LabelSeq &labels)
 Creates a union member with a name, type and selected by one or more labels.
 
 UnionMember (const std::string &name, const DynamicTypeImpl &type, DiscriminatorType label)
 Creates a union member with a name, type and selected by a single label.
 
 UnionMember (const std::string &the_name, DynamicTypeImpl &&the_type, const LabelSeq &the_labels)
 <<C++11>> Creates a union member with a name, type and selected by one or more labels.
 
 UnionMember (const std::string &the_name, DynamicTypeImpl &&the_type, DiscriminatorType the_label)
 <<C++11>> Creates a union member with a name, type and selected by a single label.
 
const dds::core::stringname () const
 Gets the member name.
 
dds::core::stringname ()
 Gets the member name.
 
const DynamicTypetype ()
 Gets the member type.
 
bool has_id () const
 Indicates it the member has an ID annotation.
 
int32_t get_id () const
 Returns the ID annotation of this member.
 
bool is_pointer () const
 <<extension>> Indicates if this member is a pointer
 
uint32_t label_count () const
 Gets the number of labels that select this member.
 
LabelSeq labels () const
 Gets a copy of all the labels that select this member.
 
UnionMemberlabels (const LabelSeq &values)
 Sets the labels that select this member.
 
UnionMemberlabel (DiscriminatorType value)
 Sets a single label that selects this member.
 
UnionMembername (const dds::core::string &value)
 Sets the name.
 
UnionMemberid (int32_t value)
 Sets the ID annotation of a member.
 
UnionMemberpointer (bool value)
 <<extension>> Makes a member a pointer
 

Static Public Attributes

static
OMG_DDS_API_CLASS_VARIABLE
DiscriminatorType 
DEFAULT_LABEL
 Special value for the default: union label.
 
static const int32_t INVALID_ID
 The special ID of a member without the ID annotation.
 

Detailed Description

<<value-type>> Represents a UnionType member

Encapsulates the name, type and labels of a UnionType member along with several IDL annotations such as id.

Member Typedef Documentation

typedef DDS_Long dds::core::xtypes::UnionMember::DiscriminatorType

The type to represent a union discriminator.

typedef std::vector<DiscriminatorType> dds::core::xtypes::UnionMember::LabelSeq

A sequence of values for the discriminator that select a member.

Constructor & Destructor Documentation

dds::core::xtypes::UnionMember::UnionMember ( const std::string &  name,
const DynamicTypeImpl &  type,
const LabelSeq labels 
)

Creates a union member with a name, type and selected by one or more labels.

dds::core::xtypes::UnionMember::UnionMember ( const std::string &  name,
const DynamicTypeImpl &  type,
DiscriminatorType  label 
)

Creates a union member with a name, type and selected by a single label.

dds::core::xtypes::UnionMember::UnionMember ( const std::string &  the_name,
DynamicTypeImpl &&  the_type,
const LabelSeq the_labels 
)
inline

<<C++11>> Creates a union member with a name, type and selected by one or more labels.

It moves the type.

dds::core::xtypes::UnionMember::UnionMember ( const std::string &  the_name,
DynamicTypeImpl &&  the_type,
DiscriminatorType  the_label 
)
inline

<<C++11>> Creates a union member with a name, type and selected by a single label.

It moves the type.

Member Function Documentation

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

Gets the member name.

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

Gets the member name.

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

Gets the member type.

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

Indicates it the member has an ID annotation.

Returns
True if this member has been annotated explicitly with an ID; false if the has a default-assigned ID.
int32_t dds::core::xtypes::UnionMember::get_id ( ) const

Returns the ID annotation of this member.

Returns
If has_id() is true, this returns the value of the ID annotation. Otherwise it returns INVALID_ID.
bool dds::core::xtypes::UnionMember::is_pointer ( ) const

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

uint32_t dds::core::xtypes::UnionMember::label_count ( ) const

Gets the number of labels that select this member.

LabelSeq dds::core::xtypes::UnionMember::labels ( ) const

Gets a copy of all the labels that select this member.

UnionMember& dds::core::xtypes::UnionMember::labels ( const LabelSeq values)

Sets the labels that select this member.

UnionMember& dds::core::xtypes::UnionMember::label ( DiscriminatorType  value)

Sets a single label that selects this member.

If more than one label selects this case, use labels(const LabelSeq&)

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

Sets the name.

UnionMember& dds::core::xtypes::UnionMember::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

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

<<extension>> Makes a member a pointer

[default] false

Member Data Documentation

OMG_DDS_API_CLASS_VARIABLE DiscriminatorType dds::core::xtypes::UnionMember::DEFAULT_LABEL
static

Special value for the default: union label.

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

The special ID of a member without the ID annotation.


RTI Connext Modern C++ API Version 5.3.1 Copyright © Mon Feb 19 2018 Real-Time Innovations, Inc