enum.h File Reference
#include "Preprocessor.h"
#include "trace.h"
+ Include dependency graph for enum.h:

Go to the source code of this file.

Macros

#define _detail_ARMARX_MAKE_ENUM_CONVERTERS(...)   _detail_ARMARX_MAKE_ENUM_CONVERTERS_i(__VA_ARGS__)
 
#define _detail_ARMARX_MAKE_ENUM_CONVERTERS_i(r, data, elem)   case data::elem: return #data "::" #elem;
 
#define ARMARX_MAKE_ENUM_AND_CONVERTERS(name, ...)
 
#define ARMARX_MAKE_ENUM_CONVERTERS(type, ...)
 

Macro Definition Documentation

◆ _detail_ARMARX_MAKE_ENUM_CONVERTERS

#define _detail_ARMARX_MAKE_ENUM_CONVERTERS (   ...)    _detail_ARMARX_MAKE_ENUM_CONVERTERS_i(__VA_ARGS__)

Definition at line 30 of file enum.h.

◆ _detail_ARMARX_MAKE_ENUM_CONVERTERS_i

#define _detail_ARMARX_MAKE_ENUM_CONVERTERS_i (   r,
  data,
  elem 
)    case data::elem: return #data "::" #elem;

Definition at line 31 of file enum.h.

◆ ARMARX_MAKE_ENUM_AND_CONVERTERS

#define ARMARX_MAKE_ENUM_AND_CONVERTERS (   name,
  ... 
)
Value:
enum class name { __VA_ARGS__ }; \
ARMARX_MAKE_ENUM_CONVERTERS(name, __VA_ARGS__)

Definition at line 51 of file enum.h.

◆ ARMARX_MAKE_ENUM_CONVERTERS

#define ARMARX_MAKE_ENUM_CONVERTERS (   type,
  ... 
)
Value:
static_assert(std::is_enum_v<type>, "Parameters to ARMARX_MAKE_ENUM_CONVERTERS must be enum types"); \
inline std::string to_string(type v) \
{ \
using base = std::underlying_type_t<type>; \
switch(v) \
{ \
ARMARX_VARIADIC_FOR_EACH(_detail_ARMARX_MAKE_ENUM_CONVERTERS, type, __VA_ARGS__) \
} \
throw std::invalid_argument{"Unknown enum value " + std::to_string(static_cast<base>(v))}; \
} \
inline std::ostream& operator << (std::ostream& out, type v) \
{ \
return out << to_string(v); \
} \
inline type operator++(type& x) {return x = (type)(((int)(x)+1));} \
inline type operator++(type& x, int) {type y = x; x = (type)(((int)(x)+1)); return y;}

Definition at line 33 of file enum.h.

armarx::to_string
const std::string & to_string(const std::string &s)
Definition: StringHelpers.h:40
_detail_ARMARX_MAKE_ENUM_CONVERTERS
#define _detail_ARMARX_MAKE_ENUM_CONVERTERS(...)
Definition: enum.h:30
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition: CtrlUtil.h:39
armarx::operator<<
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
Definition: PythonApplicationManager.cpp:221