RTI Connext Modern C++ API  Version 5.3.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::core::safe_enum< def, inner > Class Template Reference

<<value-type>> Provides a safe, scoped enumeration based on def::type More...

#include <SafeEnumeration.hpp>

Inherits def.

Public Types

typedef inner inner_enum
 

Public Member Functions

 safe_enum ()
 Default constructor doesn't initialize the underlying enumeration.
 
 safe_enum (inner_enum v)
 Copy constructor.
 
inner_enum underlying () const
 Retrieves the actual enumeration value.
 
bool operator== (const safe_enum &s) const
 Applies operator to underlying enumeration value.
 
bool operator!= (const safe_enum &s) const
 Applies operator to underlying enumeration value.
 
bool operator< (const safe_enum &s) const
 Applies operator to underlying enumeration value.
 
bool operator<= (const safe_enum &s) const
 Applies operator to underlying enumeration value.
 
bool operator> (const safe_enum &s) const
 Applies operator to underlying enumeration value.
 
bool operator>= (const safe_enum &s) const
 Applies operator to underlying enumeration value.
 

Friends

void swap (safe_enum &left, safe_enum &right) OMG_NOEXCEPT
 Swaps to underlying enumeration value.
 

Related Functions

(Note that these are not member functions.)

template<typename def , typename inner >
std::ostream & operator<< (std::ostream &out, const safe_enum< def, inner > &the_enum)
 Applies operator<< to the underlying enum.
 

Detailed Description

template<typename def, typename inner = typename def::type>
class dds::core::safe_enum< def, inner >

<<value-type>> Provides a safe, scoped enumeration based on def::type

The purpose of this class is to provide a C++11-style enum class, where the enumeration constants are scoped.

Template Parameters
defA struct containing the actual enumeration, def::type

See for example dds::core::policy::ReliabilityKind. The actual enumeration is in dds::core::policy::ReliabilityKind_def, but the application only needs to use the former:

ReliabilityKind kind = ReliabilityKind::RELIABLE;

Member Typedef Documentation

template<typename def, typename inner = typename def::type>
typedef inner dds::core::safe_enum< def, inner >::inner_enum

The underlying enum type

Constructor & Destructor Documentation

template<typename def, typename inner = typename def::type>
dds::core::safe_enum< def, inner >::safe_enum ( )
inline

Default constructor doesn't initialize the underlying enumeration.

For consistency with the behavior of C++11 class enum, this constructor doesn't initialize the enumeration.

template<typename def, typename inner = typename def::type>
dds::core::safe_enum< def, inner >::safe_enum ( inner_enum  v)
inline

Copy constructor.

Member Function Documentation

template<typename def, typename inner = typename def::type>
inner_enum dds::core::safe_enum< def, inner >::underlying ( ) const
inline

Retrieves the actual enumeration value.

template<typename def, typename inner = typename def::type>
bool dds::core::safe_enum< def, inner >::operator== ( const safe_enum< def, inner > &  s) const
inline

Applies operator to underlying enumeration value.

template<typename def, typename inner = typename def::type>
bool dds::core::safe_enum< def, inner >::operator!= ( const safe_enum< def, inner > &  s) const
inline

Applies operator to underlying enumeration value.

template<typename def, typename inner = typename def::type>
bool dds::core::safe_enum< def, inner >::operator< ( const safe_enum< def, inner > &  s) const
inline

Applies operator to underlying enumeration value.

template<typename def, typename inner = typename def::type>
bool dds::core::safe_enum< def, inner >::operator<= ( const safe_enum< def, inner > &  s) const
inline

Applies operator to underlying enumeration value.

template<typename def, typename inner = typename def::type>
bool dds::core::safe_enum< def, inner >::operator> ( const safe_enum< def, inner > &  s) const
inline

Applies operator to underlying enumeration value.

template<typename def, typename inner = typename def::type>
bool dds::core::safe_enum< def, inner >::operator>= ( const safe_enum< def, inner > &  s) const
inline

Applies operator to underlying enumeration value.

Friends And Related Function Documentation

template<typename def, typename inner = typename def::type>
void swap ( safe_enum< def, inner > &  left,
safe_enum< def, inner > &  right 
)
friend

Swaps to underlying enumeration value.

template<typename def , typename inner >
std::ostream & operator<< ( std::ostream &  out,
const safe_enum< def, inner > &  the_enum 
)
related

Applies operator<< to the underlying enum.


RTI Connext Modern C++ API Version 5.3.0 Copyright © Sun Jun 25 2017 Real-Time Innovations, Inc