BLE: expose representation type and pointer to the inner storage in SafeEnum.

pull/8738/head
Vincent Coubard 2018-11-23 21:25:49 +00:00
parent eda3bfb0e3
commit ce2460a92a
1 changed files with 12 additions and 0 deletions

View File

@ -107,6 +107,10 @@ namespace ble {
*/ */
template<typename Target, typename LayoutType = unsigned int> template<typename Target, typename LayoutType = unsigned int>
struct SafeEnum { struct SafeEnum {
/**
* Type of the representation.
*/
typedef LayoutType representation_t;
/** /**
* Construction of an enumeration value. * Construction of an enumeration value.
@ -197,6 +201,14 @@ struct SafeEnum {
return _value; return _value;
} }
/**
* Return a pointer to the inner storage.
*/
const LayoutType* storage() const
{
return &_value;
}
private: private:
LayoutType _value; LayoutType _value;
}; };