Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_UTILS_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_UTILS_HPP
15 #include <type_traits>
20 #define RTCTK_DEFINE_OPTION(Name, DefaultValue) \
22 template <typename T = DefaultValue> struct Name : T {} \
25 #define RTCTK_APPLY_OPTION_ED(Options, Name) \
27 std::conditional_t<is_present_v<Name<Enabled>, Options...>, Name<Enabled>, \
28 std::conditional_t<is_present_v<Name<Disabled>, Options...>, Name<Disabled>, Name<>>> \
32 #define RTCTK_IS_OPTION(Name, Value) \
34 std::is_base_of_v<Name<Value>, AppliedOptions> \
38 #define RTCTK_ASSERT_OPTION_ED(Name) \
40 static_assert(RTCTK_IS_OPTION(Name, Enabled) or \
41 RTCTK_IS_OPTION(Name, Disabled), \
42 "Option " #Name " must either be Enabled or Disabled") \
52 template <
template <
typename...>
class Base,
typename Derived>
54 template <
typename... Ts>
55 static constexpr std::true_type
test(
const Base<Ts...> *);
56 static constexpr std::false_type
test(...);
57 using type = decltype(
test(std::declval<Derived *>()));
60 template <
template <
typename...>
class Base,
typename Derived>
63 template <
template <
typename...>
class Base,
typename Derived>
69 template <
typename What,
typename...
Args>
71 static constexpr
bool value{(std::is_same_v<What, Args> || ...)};
74 template <
typename What,
typename...
Args>
84 template <
class...
Args>
89 template <
class T,
bool Condition>
94 #endif // RTCTK_COMPONENTFRAMEWORK_UTILS_HPP
typename is_base_of_template_impl< Base, Derived >::type is_base_of_template
Definition: utils.hpp:61
detail::Args Args
Definition: rtcComponentMain.hpp:37
decltype(test(std::declval< Derived * >())) type
Definition: utils.hpp:57
Definition: commandReplier.cpp:20
static constexpr bool value
Definition: utils.hpp:71
Definition: rtcComponent.hpp:38
constexpr empty_base(Args &&...)
Definition: utils.hpp:85
std::conditional_t< Condition, T, empty_base< T > > optional_base
Definition: utils.hpp:90
constexpr bool is_base_of_template_v
Definition: utils.hpp:64
static constexpr std::true_type test(const Base< Ts... > *)
static constexpr std::false_type test(...)
std::false_type Disabled
Definition: utils.hpp:47
constexpr bool is_present_v
Definition: utils.hpp:75
std::true_type Enabled
Definition: utils.hpp:46