RTI Connext Modern C++ API
Version 6.0.1
|
<<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 () | |
Initializes the enumeration to zero. | |
safe_enum (inner_enum v) | |
Copy constructor. | |
inner_enum | underlying () const |
Retrieves the actual enum 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 the enumeration values. | |
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. | |
<<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.
def | A 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:
A safe_enum
can be converted to and from an integer.
To convert to an integer, use the member function underlying()
:
To convert from an integer, static_cast
it to the member type inner_enum:
typedef inner dds::core::safe_enum< def, inner >::inner_enum |
The underlying enum
type
To convert from an integer, static_cast
it to the member type inner_enum:
|
inline |
Initializes the enumeration to zero.
|
inline |
Copy constructor.
|
inline |
Retrieves the actual enum
value.
|
inline |
Applies operator to underlying enumeration value.
|
inline |
Applies operator to underlying enumeration value.
|
inline |
Applies operator to underlying enumeration value.
|
inline |
Applies operator to underlying enumeration value.
|
inline |
Applies operator to underlying enumeration value.
|
inline |
Applies operator to underlying enumeration value.
|
friend |
Swaps the enumeration values.
|
related |
Applies operator<<
to the underlying enum.