47 #ifndef _MIRA_EXTENSIBLEENUM_H_ 48 #define _MIRA_EXTENSIBLEENUM_H_ 50 #include <type_traits> 52 #include <boost/preprocessor/tuple/to_seq.hpp> 53 #include <boost/preprocessor/seq/for_each.hpp> 55 #include <boost/thread/mutex.hpp> 91 template<
typename T,
typename CountType=
int,
bool UseMutex=false>
94 static void count(CountType& i, CountType& counter)
100 template<
typename T,
typename CountType>
103 static void count(CountType& i, CountType& counter)
105 boost::mutex::scoped_lock lock(mutex);
112 template<
typename T,
typename CountType>
116 template<
typename T,
typename CountType=
int,
bool UseMutex=false>
136 template<
typename T,
typename CountType,
bool UseMutex>
142 template <
typename T,
bool Counting=false,
typename CountType=
int,
bool UseMutex=false>
150 template <
typename T,
typename CountType,
bool UseMutex>
157 static_assert(std::is_integral<CountType>::value,
"Integral required for CountType template param.");
284 template <
typename T,
bool UseID=false,
bool Counting=false,
typename CountType=
int,
bool UseMutex=false>
292 template <
typename T,
bool Counting,
typename CountType,
bool UseMutex>
309 const std::string&
id()
const {
return ID; }
328 #define MIRA_EXTENUM_DECLARE_VALUE(R, ENUMNAME, VALUENAME) \ 329 const static ENUMNAME VALUENAME; 331 #define MIRA_EXTENSIBLE_ENUM_DECLARE(NAME, BASE, VALUES...) \ 332 struct NAME : public mira::detail::ExtEnum_RemoveBrackets<void (BASE)>::Result \ 335 NAME(const std::string& id = "") \ 336 : mira::detail::ExtEnum_RemoveBrackets<void (BASE)>::Result(id) {} \ 338 BOOST_PP_SEQ_FOR_EACH(MIRA_EXTENUM_DECLARE_VALUE, NAME, \ 339 BOOST_PP_TUPLE_TO_SEQ(MIRA_VARIADIC_SIZE(VALUES), (VALUES)) ) \ 342 #define MIRA_EXTENUM_DEFINE_VALUE(R, ENUMNAME, VALUENAME) \ 343 const ENUMNAME ENUMNAME::VALUENAME; 345 #define MIRA_EXTENSIBLE_ENUM_DEFINE(NAME, VALUES...) \ 346 BOOST_PP_SEQ_FOR_EACH(MIRA_EXTENUM_DEFINE_VALUE, NAME, \ 347 BOOST_PP_TUPLE_TO_SEQ(MIRA_VARIADIC_SIZE(VALUES), (VALUES)) ) Serializer for serializing objects in JSON format.
Definition: JSONSerializer.h:93
Tools for handling variadic macros.
bool operator!=(const AutoCountingEnum< T, CountType, UseMutex > &other) const
Definition: ExtensibleEnum.h:121
bool operator==(const AutoCountingEnum< T, CountType, UseMutex > &other) const
Definition: ExtensibleEnum.h:120
static CountType count()
Definition: ExtensibleEnum.h:123
Definition: ExtensibleEnum.h:117
static void count(CountType &i, CountType &counter)
Definition: ExtensibleEnum.h:94
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
CountType i
Definition: ExtensibleEnum.h:132
#define MIRA_SPLIT_REFLECT_MEMBER
Macro that insert a class member reflect() method just splitting reflection into a reflectRead() and ...
Definition: SplitReflect.h:209
Definition: ExtensibleEnum.h:143
static CountType counter
Definition: ExtensibleEnum.h:133
void property(const char *name, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Definition: RecursiveMemberReflector.h:964
static void count(CountType &i, CountType &counter)
Definition: ExtensibleEnum.h:103
Provides MIRA_SPLIT_REFLECT macros.
Definition: ExtensibleEnum.h:293
MIRA_SPLIT_REFLECT_MEMBER void reflectRead(JSONSerializer &r)
only reflectRead(JSONSerializer&) is implemented, to be able to print()
Definition: ExtensibleEnum.h:304
Definition: ExtensibleEnum.h:74
Definition: ExtensibleEnum.h:321
const std::string & id() const
Definition: ExtensibleEnum.h:309
Definition: ExtensibleEnum.h:92
ExtensibleEnum is a base for derived classes that can be extensible 'replacements' for enum types...
Definition: ExtensibleEnum.h:285
bool operator!=(const NoValueEnum< T > &other) const
Definition: ExtensibleEnum.h:78
T Result
Definition: ExtensibleEnum.h:323
bool operator==(const NoValueEnum< T > &other) const
Definition: ExtensibleEnum.h:77
Serializer and Deserializer for JSON format.
Definition: ExtensibleEnum.h:151
static boost::mutex mutex
Definition: ExtensibleEnum.h:109