fixes to match new naming scheme
This commit is contained in:
@@ -108,7 +108,7 @@ concept device_command_exec_t = snplib::callable_c<T> && (snplib::func_traits_t<
|
||||
|
||||
template <typename T>
|
||||
concept device_attr_getter_c = std::same_as<T, std::nullptr_t> || requires(T t) {
|
||||
{ t() } -> adc_result_c;
|
||||
{ t() } -> ret_result_c;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -118,16 +118,16 @@ concept device_attr_setter_c =
|
||||
|
||||
|
||||
// deduce value type from getter and setter
|
||||
template <adclib_attr_getter_c GT, adclib_attr_setter_c ST>
|
||||
using adclib_attr_value_deduced_t = std::conditional_t<
|
||||
template <device_attr_getter_c GT, device_attr_setter_c ST>
|
||||
using device_attr_value_deduced_t = std::conditional_t<
|
||||
std::is_null_pointer_v<GT>,
|
||||
std::conditional_t<std::is_null_pointer_v<ST>, void, std::remove_cvref_t<snplib::func_arg1_t<ST>>>,
|
||||
typename std::invoke_result_t<GT>::value_type>;
|
||||
|
||||
|
||||
template <adclib_attr_getter_c GT, device_attr_setter_c ST>
|
||||
struct adclib_is_deduced_void_t {
|
||||
static constexpr bool value = std::is_void_v<adclib_attr_value_deduced_t<GT, ST>>;
|
||||
template <device_attr_getter_c GT, device_attr_setter_c ST>
|
||||
struct is_deduced_void_t {
|
||||
static constexpr bool value = std::is_void_v<device_attr_value_deduced_t<GT, ST>>;
|
||||
};
|
||||
|
||||
// conversional function signature:
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
template <typename GT, typename ST, typename... VTs>
|
||||
void addAttr(ATTR_ID_T id, GT&& getter, ST&& setter, std::tuple<VTs...> = std::tuple<>{})
|
||||
{
|
||||
using v_t = adclib_attr_value_deduced_t<GT, ST>;
|
||||
using v_t = device_attr_value_deduced_t<GT, ST>;
|
||||
static_assert(!std::is_void_v<v_t>, "Getter and setter cannot be nullptr_t at the same time!");
|
||||
|
||||
if constexpr (!std::is_null_pointer_v<GT> && !std::is_null_pointer_v<ST>) {
|
||||
@@ -353,7 +353,7 @@ public:
|
||||
std::tuple<attr_t<VTs>...>{});
|
||||
}
|
||||
|
||||
template <adclib_attr_getter_c GT, device_attr_setter_c ST, typename... FuncTs>
|
||||
template <device_attr_getter_c GT, device_attr_setter_c ST, typename... FuncTs>
|
||||
requires(sizeof...(FuncTs) > 1)
|
||||
void addAttr(ATTR_ID_T id, GT&& getter, ST&& setter, FuncTs&&... cnv_pairs)
|
||||
{
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
|
||||
static_assert(NFUNCS % 2 == 0, "Number of conversional functions must be an even!");
|
||||
|
||||
using v_t = adclib_attr_value_deduced_t<GT, ST>;
|
||||
using v_t = device_attr_value_deduced_t<GT, ST>;
|
||||
static_assert(!std::is_void_v<v_t>, "Getter and setter cannot be nullptr_t at the same time!");
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ public:
|
||||
auto tp = std::forward_as_tuple(std::forward<FuncTs>(cnv_pairs_cap)...);
|
||||
|
||||
// static_assert(
|
||||
// std::disjunction_v<adclib_is_deduced_void_t<std::tuple_element_t<Is * 2,
|
||||
// std::disjunction_v<is_deduced_void_t<std::tuple_element_t<Is * 2,
|
||||
// decltype(tp)>,
|
||||
// std::tuple_element_t<Is * 2 +
|
||||
// 1, decltype(tp)>>...>,
|
||||
@@ -382,7 +382,7 @@ public:
|
||||
using from_fn_t = std::decay_t<std::tuple_element_t<I, TpT>>;
|
||||
using to_fn_t = std::decay_t<std::tuple_element_t<I + 1, TpT>>;
|
||||
|
||||
using u_t = typename adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>::value_type;
|
||||
using u_t = typename device_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>::value_type;
|
||||
|
||||
return [&func_tp](attr_t<v_t> const& attr) mutable -> attr_t<u_t> {
|
||||
return attr_t<u_t>{
|
||||
@@ -406,7 +406,7 @@ public:
|
||||
// using from_fn_t = std::decay_t<std::tuple_element_t<I, tp_t>>;
|
||||
// using to_fn_t = std::decay_t<std::tuple_element_t<I + 1, tp_t>>;
|
||||
|
||||
// using u_t = adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
|
||||
// using u_t = attr_user_deduced_t<v_t, from_fn_t, to_fn_t>;
|
||||
|
||||
// return [func_tp_cap = std::forward<TpT>(func_tp)](attr_t<v_t> const& attr) mutable -> attr_t<u_t> {
|
||||
// using tp_cap_t = decltype(func_tp_cap);
|
||||
@@ -436,7 +436,7 @@ public:
|
||||
using from_fn_t = std::decay_t<std::tuple_element_t<I, TpT>>;
|
||||
using to_fn_t = std::decay_t<std::tuple_element_t<I + 1, TpT>>;
|
||||
|
||||
using u_t = typename adclib_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>::value_type;
|
||||
using u_t = typename device_attr_user_deduced_t<v_t, from_fn_t, to_fn_t>::value_type;
|
||||
|
||||
return [id, this](attr_t<u_t> const&) -> attr_t<v_t> {
|
||||
return _attrs.template get<attr_t<v_t>>(id).value();
|
||||
@@ -455,7 +455,7 @@ public:
|
||||
|
||||
// add attribute of one of arithmetic type
|
||||
template <typename GT, typename ST>
|
||||
requires std::is_arithmetic_v<adclib_attr_value_deduced_t<GT, ST>>
|
||||
requires std::is_arithmetic_v<device_attr_value_deduced_t<GT, ST>>
|
||||
void addArithAttr(ATTR_ID_T id, GT&& getter, ST&& setter)
|
||||
{
|
||||
addAttr(std::move(id), std::forward<GT>(getter), std::forward<ST>(setter), AdcGenericDevice::arithmetic_types);
|
||||
|
||||
Reference in New Issue
Block a user