RTI Connext Modern C++ API
Version 5.2.0
|
<<value-type>> Represents and IDL union
type
More...
#include <dds/core/xtypes/UnionType.hpp>
Public Types | |
typedef UnionMember::DiscriminatorType | DiscriminatorType |
The type used to set and get discriminator (label) values. | |
Public Types inherited from dds::core::xtypes::AbstractConstructedType< UnionMember > | |
typedef UnionMember | Member |
The member type (specified by the subclasses of this class) | |
typedef uint32_t | MemberIndex |
The meber index type. | |
Public Member Functions | |
UnionType (const std::string &name, const DynamicTypeImpl &discriminator_type) | |
Creates an empty union. | |
template<typename Container > | |
UnionType (const std::string &name, const DynamicTypeImpl &discriminator_type, const Container &members) | |
Creates a union with the members in a container. | |
template<typename MemberIter > | |
UnionType (const std::string &name, const DynamicTypeImpl &discriminator_type, MemberIter begin, MemberIter end) | |
Creates a union with the members in an iterator range. | |
UnionType (const std::string &name, const DynamicTypeImpl &discriminator_type, std::initializer_list< UnionMember > members) | |
Creates a union with the members in an initializer_list. | |
const DynamicTypeImpl & | discriminator () const |
Gets the type of the discriminator. | |
MemberIndex | find_member_by_label (DiscriminatorType label) const |
Gets the index of the member selected by a label. | |
MemberIndex | find_member_by_id (uint32_t id) const |
Gets the index of the member with a specific member ID. | |
UnionType & | add_member (const UnionMember &member) |
Add a member to the end of this union. | |
template<typename Container > | |
UnionType & | add_members (const Container &members) |
Adds all the members of a container at the end. | |
UnionType & | add_members (std::initializer_list< UnionMember > members) |
Adds all the members of an initializer_list at the end. | |
template<typename MemberIter > | |
UnionType & | add_members (MemberIter begin, MemberIter end) |
Adds all the members in an iterator range at the end. | |
UnionType & | add_member (UnionMember &&member) |
Adds a member, moving it, at the end. | |
Public Member Functions inherited from dds::core::xtypes::AbstractConstructedType< UnionMember > | |
dds::core::xtypes::ExtensibilityKind | extensibility_kind () const |
Gets the extensibility kind. | |
size_t | member_count () const |
Gets the number of members. | |
const UnionMember & | member (MemberIndex index) const |
Gets a member by its index. | |
const UnionMember & | member (const std::string &name) const |
Gets a member by its name. | |
MemberIndex | find_member_by_name (const std::string &name) const |
Obtains the member index from its name. | |
std::vector< UnionMember > | members () const |
Gets a copy of all the members. | |
Public Member Functions inherited from dds::core::xtypes::DynamicType | |
dds::core::xtypes::TypeKind | kind () const |
Gets the type kind. | |
std::string | name () const |
Gets the name. | |
Additional Inherited Members | |
Static Public Attributes inherited from dds::core::xtypes::AbstractConstructedType< UnionMember > | |
static OMG_DDS_API_CLASS_VARIABLE const MemberIndex | INVALID_INDEX |
Indicates that a member doesn't exist. | |
Related Functions inherited from dds::core::xtypes::DynamicType | |
bool | is_primitive_type (const DynamicType &t) |
Determines if a DynamicType is a PrimitiveType. | |
bool | is_constructed_type (const DynamicType &t) |
Determines if a DynamicType is a constructed type. | |
bool | is_collection_type (const DynamicType &t) |
Determines if a DynamicType is a CollectionType. | |
bool | is_aggregation_type (const DynamicType &t) |
Determines if a DynamicType is an aggregation type. | |
void | print_idl (const DynamicType &type, unsigned int indent=0) |
<<extension>> Prints the IDL representation of this type to the standard output | |
<<value-type>> Represents and IDL union
type
typedef UnionMember::DiscriminatorType dds::core::xtypes::UnionType::DiscriminatorType |
The type used to set and get discriminator (label) values.
Note that this is different from discriminator(), which represents the discriminator type as defined in IDL.
|
inline |
Creates an empty union.
Members can be added after creation.
name | The name of the type |
discriminator_type | The type of the discriminator |
|
inline |
Creates a union with the members in a container.
Container | A container that provides the member functions begin() and end() to iterate over UnionMember elements. |
|
inline |
Creates a union with the members in an iterator range.
MemberIter | A forward iterator of UnionMember elements |
name | The name of the type |
discriminator_type | The type of the discriminator |
begin | The beginning of the range of UnionMembers |
end | The end of the range of UnionMembers |
|
inline |
Creates a union with the members in an initializer_list.
name | The name of the type |
discriminator_type | The type of the discriminator |
members | An ininitalizer_list of UnionMembers |
const DynamicTypeImpl& dds::core::xtypes::UnionType::discriminator | ( | ) | const |
Gets the type of the discriminator.
MemberIndex dds::core::xtypes::UnionType::find_member_by_label | ( | DiscriminatorType | label | ) | const |
Gets the index of the member selected by a label.
The result of this function can be passed to member(uint32_t).
MemberIndex dds::core::xtypes::UnionType::find_member_by_id | ( | uint32_t | id | ) | const |
Gets the index of the member with a specific member ID.
The result of this function can be passed to member(uint32_t).
UnionType& dds::core::xtypes::UnionType::add_member | ( | const UnionMember & | member | ) |
Add a member to the end of this union.
|
inline |
Adds all the members of a container at the end.
|
inline |
Adds all the members of an initializer_list at the end.
|
inline |
Adds all the members in an iterator range at the end.
|
inline |
Adds a member, moving it, at the end.