RTI Connext Modern C++ API Version 7.6.0
dds::core::xtypes::EnumType Class Reference

<<value-type>> Represents an IDL enum type More...

#include <dds/core/xtypes/EnumType.hpp>

Inheritance diagram for dds::core::xtypes::EnumType:
dds::core::xtypes::AbstractConstructedType< EnumMember > dds::core::xtypes::DynamicType

Public Member Functions

 EnumType (const std::string &name)
 Creates an empty enum type. More...
 
template<typename Container >
 EnumType (const std::string &the_name, const Container &the_members)
 Creates an enum with the members in a container. More...
 
template<typename MemberIter >
 EnumType (const std::string &the_name, MemberIter begin, MemberIter end)
 Creates a enum with the members in an iterator range. More...
 
 EnumType (const std::string &the_name, std::initializer_list< EnumMember > the_members)
 Creates an enum with the members in an initializer_list. More...
 
MemberIndex find_member_by_ordinal (int32_t ordinal) const
 Gets the index of the member with this ordinal value. More...
 
EnumTypeadd_member (const EnumMember &member)
 Adds a member at the end. More...
 
template<typename Container >
EnumTypeadd_members (const Container &the_members)
 Adds all the members of a container at the end. More...
 
EnumTypeadd_members (std::initializer_list< EnumMember > the_members)
 Adds all the members of an initializer_list at the end. More...
 
template<typename MemberIter >
EnumTypeadd_members (MemberIter begin, MemberIter end)
 Adds all the members in an iterator range at the end. More...
 
- Public Member Functions inherited from dds::core::xtypes::AbstractConstructedType< EnumMember >
dds::core::xtypes::ExtensibilityKind extensibility_kind () const
 Gets the extensibility kind. More...
 
size_t member_count () const
 Gets the number of members. More...
 
const EnumMembermember (MemberIndex index) const
 Gets a member by its index. More...
 
const EnumMembermember (const std::string &name) const
 Gets a member by its name. More...
 
MemberIndex find_member_by_name (const std::string &name) const
 Obtains the member index from its name. More...
 
std::vector< EnumMembermembers () const
 Gets a copy of all the members. More...
 
uint32_t cdr_serialized_sample_max_size (dds::core::policy::DataRepresentationId representation_id=DDS_AUTO_DATA_REPRESENTATION) const
 Gets the maximum serialized size of samples of this type. More...
 
uint32_t cdr_serialized_sample_min_size (dds::core::policy::DataRepresentationId representation_id=DDS_AUTO_DATA_REPRESENTATION) const
 Gets the minimum serialized size of samples of this type. More...
 
uint32_t cdr_serialized_sample_key_max_size (dds::core::policy::DataRepresentationId representation_id=DDS_AUTO_DATA_REPRESENTATION) const
 Gets the maximum serialized size of sample keys of this type. More...
 
- Public Member Functions inherited from dds::core::xtypes::DynamicType
dds::core::xtypes::TypeKind kind () const
 Gets the type kind. More...
 
std::string name () const
 Gets the name. More...
 

Additional Inherited Members

- Public Types inherited from dds::core::xtypes::AbstractConstructedType< EnumMember >
typedef EnumMember Member
 The member type (specified by the subclasses of this class) More...
 
typedef uint32_t MemberIndex
 The member index type. More...
 
- Static Public Attributes inherited from dds::core::xtypes::AbstractConstructedType< EnumMember >
static OMG_DDS_API_CLASS_VARIABLE const MemberIndex INVALID_INDEX
 Indicates that a member doesn't exist. More...
 

Detailed Description

<<value-type>> Represents an IDL enum type

Examples
Foo.hpp.

Constructor & Destructor Documentation

◆ EnumType() [1/4]

dds::core::xtypes::EnumType::EnumType ( const std::string &  name)

Creates an empty enum type.

Members can be added after creation.

Parameters
nameThe name of the type

◆ EnumType() [2/4]

template<typename Container >
dds::core::xtypes::EnumType::EnumType ( const std::string &  the_name,
const Container &  the_members 
)
inline

Creates an enum with the members in a container.

Template Parameters
ContainerA container that provides the member functions begin() and end() to iterate over EnumMember elements.
Parameters
the_nameThe name of the type
the_membersA container with the members for this enum type

◆ EnumType() [3/4]

template<typename MemberIter >
dds::core::xtypes::EnumType::EnumType ( const std::string &  the_name,
MemberIter  begin,
MemberIter  end 
)
inline

Creates a enum with the members in an iterator range.

Template Parameters
MemberIterA forward iterator of EnumMember elements
Parameters
the_nameThe name of the type
beginThe beginning of the range of EnumMembers
endThe end of the range of EnumMembers

◆ EnumType() [4/4]

dds::core::xtypes::EnumType::EnumType ( const std::string &  the_name,
std::initializer_list< EnumMember the_members 
)

Creates an enum with the members in an initializer_list.

Parameters
the_nameThe name of the type
the_membersAn ininitalizer_list of EnumMembers

Member Function Documentation

◆ find_member_by_ordinal()

MemberIndex dds::core::xtypes::EnumType::find_member_by_ordinal ( int32_t  ordinal) const

Gets the index of the member with this ordinal value.

Returns
The index (which can be passed to member(uint32_t) of the member with this ordinal value or INVALID_INDEX if that ordinal doesn't exist

◆ add_member()

EnumType & dds::core::xtypes::EnumType::add_member ( const EnumMember member)

Adds a member at the end.

◆ add_members() [1/3]

template<typename Container >
EnumType & dds::core::xtypes::EnumType::add_members ( const Container &  the_members)
inline

Adds all the members of a container at the end.

◆ add_members() [2/3]

EnumType & dds::core::xtypes::EnumType::add_members ( std::initializer_list< EnumMember the_members)

Adds all the members of an initializer_list at the end.

◆ add_members() [3/3]

template<typename MemberIter >
EnumType & dds::core::xtypes::EnumType::add_members ( MemberIter  begin,
MemberIter  end 
)
inline

Adds all the members in an iterator range at the end.