Gazebo Common

API Reference

7.4.0
EnumIface.hh File Reference
#include <iterator>
#include <string>
#include <vector>
#include <algorithm>
#include <gz/common/Export.hh>
#include <gz/common/Util.hh>

Go to the source code of this file.

Classes

class  EnumIface< T >
 Enum interface. Use this interface to convert an enum to a string, and set an enum from a string. More...
 
class  EnumIterator< Enum >
 An iterator over enum types. More...
 

Namespaces

namespace  gz
 Forward declarations for the common classes.
 
namespace  gz::common
 

Macros

#define GZ_ENUM(name, enumType, begin, end, ...)   static auto name = gzEnum(begin, end, {__VA_ARGS__});
 A macro that allows an enum to have an iterator and string conversion.
 

Functions

template<typename T >
static constexpr EnumIface< T > gzEnum (T _enumBegin, T _enumEnd, const std::vector< std::string > &_enumVals)
 A template that allows an enum to have an iterator and string conversion.
 
template<typename Enum >
bool operator!= (EnumIterator< Enum > _e1, EnumIterator< Enum > _e2)
 Inequality operator.
 
template<typename Enum >
bool operator== (EnumIterator< Enum > _e1, EnumIterator< Enum > _e2)
 Equality operator.
 

Macro Definition Documentation

◆ GZ_ENUM

#define GZ_ENUM (   name,
  enumType,
  begin,
  end,
  ... 
)    static auto name = gzEnum(begin, end, {__VA_ARGS__});

A macro that allows an enum to have an iterator and string conversion.

Parameters
[in]nameEnumIface instance name.
[in]enumTypeEnum type
[in]beginEnum value that marks the beginning of the enum values.
[in]endEnum value that marks the end of the enum values.
[in]...A list of strings, one for each enum value.
See also
EnumIface
EnumIterator