CoreDX DDS Modern C++ API
Public Member Functions | Related Functions | List of all members
dds::core::xtypes::EnumType Class Reference

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< EnumMembermembers () const
 Access the members of the enum. More...
 
const EnumMembermember (uint32_t id) const
 Access a member of the enum by id. More...
 
const EnumMembermember (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ EnumType() [1/4]

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

Construct an EnumType with the provided name.

◆ EnumType() [2/4]

dds::core::xtypes::EnumType::EnumType ( const std::string &  name,
const std::vector< EnumMember > &  members 
)

Construct an EnumType with the provided name and members.

◆ EnumType() [3/4]

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

Construct an EnumType with the provided name and members.

◆ EnumType() [4/4]

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.

Member Function Documentation

◆ add_member()

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.

◆ bit_bound() [1/2]

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

◆ bit_bound() [2/2]

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

◆ extensibility_kind() [1/2]

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.

◆ extensibility_kind() [2/2]

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.

◆ member() [1/2]

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.

◆ member() [2/2]

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.

◆ members()

std::vector<EnumMember> dds::core::xtypes::EnumType::members ( ) const

Access the members of the enum.


© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.