ros2_control - humble
Public Member Functions | Protected Attributes | List of all members
ign_ros2_control::SafeEnum< ENUM, UNDERLYING > Class Template Reference

This class allows us to handle flags easily, instead of using strings. More...

#include <ign_system_interface.hpp>

Public Member Functions

 SafeEnum (ENUM singleFlag)
 
 SafeEnum (const SafeEnum &original)
 
SafeEnumoperator|= (ENUM addValue)
 
SafeEnum operator| (ENUM addValue)
 
SafeEnumoperator&= (ENUM maskValue)
 
SafeEnum operator& (ENUM maskValue)
 
SafeEnum operator~ ()
 
 operator bool ()
 

Protected Attributes

UNDERLYING mFlags
 

Detailed Description

template<class ENUM, class UNDERLYING = typename std::underlying_type<ENUM>::type>
class ign_ros2_control::SafeEnum< ENUM, UNDERLYING >

This class allows us to handle flags easily, instead of using strings.

For example enum ControlMethod_ { NONE = 0, POSITION = (1 << 0), VELOCITY = (1 << 1), EFFORT = (1 << 2), }; typedef SafeEnum<enum ControlMethod_> ControlMethod;

ControlMethod foo; foo |= POSITION // Foo has the position flag active foo & POSITION -> True // Check if position is active in the flag foo & VELOCITY -> False // Check if velocity is active in the flag


The documentation for this class was generated from the following file: