CoreDX DDS Modern C++ API
|
Create a dynamic enum type. More...
Inherits dds::core::xtypes::TDynamicType< DELEGATE >.
Public Member Functions | |
EnumType (const std::string &name) | |
Construct an EnumType with the provided name. More... | |
EnumType (const std::string &name, const std::vector< EnumMember > &members) | |
Construct an EnumType with the provided name and members. More... | |
template<typename MemberIter > | |
EnumType (const std::string &name, const MemberIter &begin, const MemberIter &end) | |
Construct an EnumType with the provided name and members. More... | |
EnumType (const std::string &name, std::initializer_list< EnumMember > members) | |
Construct an EnumType with the provided name and members. More... | |
std::vector< EnumMember > | members () const |
Access the members of the enum. More... | |
const EnumMember & | member (uint32_t id) const |
Access a member of the enum by id. More... | |
const EnumMember & | member (const std::string &name) const |
Access a member of the enum by name. More... | |
EnumType | add_member (const EnumMember &member) |
Add a member to the union. More... | |
EnumType | bit_bound (uint32_t v) |
Assign the bit bound (size) of the enum type. More... | |
uint32_t | bit_bound () const |
Access the bit bound (size) of the enum type. More... | |
EnumType | extensibility_kind (dds::core::xtypes::ExtensibilityKind kind) |
Set the extensibility kind of the enum. More... | |
dds::core::xtypes::ExtensibilityKind | extensibility_kind () const |
Access the extensibility kind of the structure. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
bool | isFinal (const EnumType< T > &s) |
Test if the EnumType has FINAL extensibliity. | |
template<typename T > | |
bool | isExtensible (const EnumType< T > &s) |
Test if the EnumType has EXTENSIBLE extensibliity. | |
template<typename T > | |
bool | isMutable (const EnumType< T > &s) |
Test if the EnumType has MUTABLE extensibliity. | |
Create a dynamic enum type.
If the members don't have Id associated explicitly, then their ID will be the same as the ordinal position on the members vector.
dds::core::xtypes::EnumType::EnumType | ( | const std::string & | name | ) |
Construct an EnumType with the provided name.
dds::core::xtypes::EnumType::EnumType | ( | const std::string & | name, |
const std::vector< EnumMember > & | members | ||
) |
Construct an EnumType with the provided name and members.
dds::core::xtypes::EnumType::EnumType | ( | const std::string & | name, |
const MemberIter & | begin, | ||
const MemberIter & | end | ||
) |
Construct an EnumType with the provided name and members.
dds::core::xtypes::EnumType::EnumType | ( | const std::string & | name, |
std::initializer_list< EnumMember > | members | ||
) |
Construct an EnumType with the provided name and members.
The EnumMembers are provided as an initializer list.
EnumType dds::core::xtypes::EnumType::add_member | ( | const EnumMember & | member | ) |
Add a member to the union.
May throw dds::core::PreconditionNotMetError() if there is a collision between this new member and an existing member. The collision can be due to a matching ID or name.
EnumType dds::core::xtypes::EnumType::bit_bound | ( | uint32_t | v | ) |
Assign the bit bound (size) of the enum type.
The default is 32 bits. Use this instead of applying the BitBoundAnnotation
uint32_t dds::core::xtypes::EnumType::bit_bound | ( | ) | const |
Access the bit bound (size) of the enum type.
The default is 32 bits. Use this instead of checking for the BitBoundAnnotation
EnumType dds::core::xtypes::EnumType::extensibility_kind | ( | dds::core::xtypes::ExtensibilityKind | kind | ) |
Set the extensibility kind of the enum.
Use instead of applying an ExtensibilityAnnotation.
dds::core::xtypes::ExtensibilityKind dds::core::xtypes::EnumType::extensibility_kind | ( | ) | const |
Access the extensibility kind of the structure.
Use this instead of checking for the ExtensibilityAnnotation.
const EnumMember& dds::core::xtypes::EnumType::member | ( | uint32_t | id | ) | const |
Access a member of the enum by id.
May throw dds::core::PreconditionNotMetError() if no member is found with the specified name.
const EnumMember& dds::core::xtypes::EnumType::member | ( | const std::string & | name | ) | const |
Access a member of the enum by name.
May throw dds::core::PreconditionNotMetError() if no member is found with the specified name.
std::vector<EnumMember> dds::core::xtypes::EnumType::members | ( | ) | const |
Access the members of the enum.