solve problem with adc_func_traits
add and use concept adc_is_callable rewrite value holder and device attribute classes with new constructor's arguments resolution scheme
This commit is contained in:
@@ -81,6 +81,26 @@ public:
|
||||
}
|
||||
|
||||
|
||||
template <typename GT,
|
||||
typename VALT = ret_value_t<GT>,
|
||||
typename SRT = decltype(utils::AdcDefaultValueConverter<>::serialize<SerializedT, VALT>)>
|
||||
AdcDeviceAttribute(const IdentT& ident,
|
||||
traits::adc_tuple_like<> auto&& tpl,
|
||||
GT&& getter,
|
||||
SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<SerializedT, VALT>)
|
||||
requires std::invocable<GT> && std::invocable<SRT, const VALT&>
|
||||
: AdcDeviceAttribute(ident,
|
||||
std::forward<decltype(tpl)>(tpl),
|
||||
std::forward<GT>(getter),
|
||||
AdcDeviceAttribute::DummySetter<VALT>,
|
||||
AdcValueHolder::AdcValueHolderDummyValidator<VALT>,
|
||||
std::forward<SRT>(serializer),
|
||||
AdcDeviceAttribute::DummyDeserializer<VALT>)
|
||||
{
|
||||
_accessType = ReadOnly;
|
||||
}
|
||||
|
||||
|
||||
// write-only attribute constructor
|
||||
template <typename ST,
|
||||
typename VALT = std::decay_t<traits::adc_func_arg1_t<ST>>,
|
||||
@@ -101,6 +121,27 @@ public:
|
||||
}
|
||||
|
||||
|
||||
template <typename ST,
|
||||
typename VALT = std::decay_t<traits::adc_func_arg1_t<ST>>,
|
||||
typename DSRT = decltype(utils::AdcDefaultValueConverter<>::deserialize<VALT, SerializedT>)>
|
||||
AdcDeviceAttribute(const IdentT& ident,
|
||||
traits::adc_tuple_like<> auto&& tpl,
|
||||
ST&& setter,
|
||||
std::predicate<const VALT&> auto&& validator,
|
||||
DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<VALT, SerializedT>)
|
||||
requires std::invocable<DSRT, const SerializedT&>
|
||||
: AdcDeviceAttribute(ident,
|
||||
std::forward<decltype(tpl)>(tpl),
|
||||
AdcDeviceAttribute::DummyGetter<VALT>,
|
||||
std::forward<ST>(setter),
|
||||
std::forward<decltype(validator)>(validator),
|
||||
AdcDeviceAttribute::DummySerializer<VALT>,
|
||||
std::forward<DSRT>(deserializer))
|
||||
{
|
||||
_accessType = WriteOnly;
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual ~AdcDeviceAttribute() = default;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user