due to GCC strange behavior with cast operator AdcDeviceAttribute class is now

has its own full "value holder" implementation without inheritance from
AdcValueHolder
This commit is contained in:
Timur A. Fatkhullin 2024-05-15 02:27:16 +03:00
parent e23fc602be
commit 5dcc57707b
4 changed files with 399 additions and 66 deletions

View File

@ -27,7 +27,7 @@ if (BUILD_TESTS)
add_executable(${VALUEHOLDER_TEST_APP} tests/adc_valueholder_test.cpp) add_executable(${VALUEHOLDER_TEST_APP} tests/adc_valueholder_test.cpp)
set(DEVATTR_TEST_APP adc_devattr_test) set(DEVATTR_TEST_APP adc_devattr_test)
# add_executable(${DEVATTR_TEST_APP} tests/adc_devattr_test.cpp) add_executable(${DEVATTR_TEST_APP} tests/adc_devattr_test.cpp)
if (NOT doctest_FOUND) if (NOT doctest_FOUND)
include(FetchContent) include(FetchContent)

View File

@ -70,8 +70,8 @@ struct adc_func_traits_helper_t<R, Arg, Args...> {
// callable concept and its signature traits // callable concept and its signature traits
template <typename T> template <typename T>
concept adc_is_callable = concept adc_is_callable = std::is_function_v<T> || (std::is_object_v<T> && requires(T) { &T::operator(); });
std::is_function_v<T> || (std::is_object_v<T> && requires(T) { std::is_function_v<decltype(&T::operator())>; }); // std::is_function_v<T> || (std::is_object_v<T> && requires(T) { std::is_function_v<decltype(&T::operator())>; });
template <typename F> template <typename F>
struct adc_func_traits { struct adc_func_traits {

View File

@ -6,15 +6,67 @@
*/ */
#include <system_error>
#include <unordered_map>
#include "../common/adc_value.h" #include "../common/adc_traits.h"
#include "../common/adc_utils.h"
// #include "../common/adc_value.h"
namespace adc namespace adc
{ {
namespace constants
{
static constexpr std::tuple<bool,
char,
short,
int,
long,
long long,
unsigned char,
unsigned short,
unsigned int,
unsigned long,
unsigned long long,
float,
double,
long double>
AdcDefaultTrivialConvTypes{};
} // namespace constants
namespace traits
{
// a callable and it has exactly one argument
template <typename T>
concept adc_is_setter = adc_func_traits<T>::arity == 1;
// a callable with exactly one argument of type VT
template <typename T, typename VT>
concept adc_is_setter_arg = (adc_func_traits<T>::arity == 1) && std::same_as<VT, adc_func_arg1_t<T>>;
// a callable with exactly one argument of type VT and it returns a value of type ST
template <typename T, typename ST, typename VT>
concept adc_is_serializer =
(adc_func_traits<T>::arity == 1) && std::same_as<VT, adc_func_arg1_t<T>> && std::same_as<ST, adc_retval_t<T>>;
} // namespace traits
// error codes // error codes
enum class AdcDeviceAttributeErrorCode : int { ERROR_OK, ERROR_READ_ONLY, ERROR_WRITE_ONLY }; enum class AdcDeviceAttributeErrorCode : int {
ERROR_OK,
ERROR_NO_CONV_FUNC,
ERROR_INTERNAL_TYPE_MISMATCH,
ERROR_READ_ONLY,
ERROR_WRITE_ONLY,
ERROR_INVALID_SERIALIZED_TYPE
};
} // namespace adc } // namespace adc
@ -47,10 +99,16 @@ struct AdcDeviceAttributeErrorCategory : public std::error_category {
switch (err) { switch (err) {
case AdcDeviceAttributeErrorCode::ERROR_OK: case AdcDeviceAttributeErrorCode::ERROR_OK:
return "OK"; return "OK";
case AdcDeviceAttributeErrorCode::ERROR_NO_CONV_FUNC:
return "conversion function is not defined";
case AdcDeviceAttributeErrorCode::ERROR_INTERNAL_TYPE_MISMATCH:
return "try to setup default conversion function for invalid type (internal type mismatch)";
case AdcDeviceAttributeErrorCode::ERROR_READ_ONLY: case AdcDeviceAttributeErrorCode::ERROR_READ_ONLY:
return "device attribute is read-only"; return "device attribute is read-only";
case AdcDeviceAttributeErrorCode::ERROR_WRITE_ONLY: case AdcDeviceAttributeErrorCode::ERROR_WRITE_ONLY:
return "device attribute is write-only"; return "device attribute is write-only";
case AdcDeviceAttributeErrorCode::ERROR_INVALID_SERIALIZED_TYPE:
return "invalid user-passed serialized type";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
@ -71,17 +129,36 @@ inline std::error_code make_error_code(AdcDeviceAttributeErrorCode ec)
template <typename IdentT, typename SerializedT = std::string> template <typename IdentT>
class AdcDeviceAttribute : protected AdcSerializingValueHolder<SerializedT> class AdcDeviceAttribute
{ {
typedef AdcSerializingValueHolder<SerializedT> base_t; protected:
template <typename T> template <typename T>
using ret_value_t = base_t::template ret_value_t<T>; using ret_value_t = std::decay_t<traits::adc_retval_t<T>>;
template <typename VT>
inline static std::unordered_map<const AdcDeviceAttribute*, std::function<VT()>> _getterFunc{};
template <typename VT>
inline static std::unordered_map<const AdcDeviceAttribute*, std::function<void(const VT&)>> _setterFunc{};
template <typename SerializedT>
inline static std::unordered_map<const AdcDeviceAttribute*, std::function<SerializedT()>> _serializerFunc{};
template <typename SerializedT>
inline static std::unordered_map<const AdcDeviceAttribute*, std::function<void(const SerializedT&)>>
_deserializerFunc{};
std::function<void()> _clearFunc;
std::function<void(AdcDeviceAttribute*)> _copyFunc;
std::function<void(AdcDeviceAttribute*)> _moveFunc;
public: public:
typedef IdentT ident_t; typedef IdentT ident_t;
typedef SerializedT serialized_t;
typedef std::string default_serialized_t;
enum AccessType { ReadOnly, WriteOnly, ReadWrite }; enum AccessType { ReadOnly, WriteOnly, ReadWrite };
@ -97,13 +174,13 @@ public:
{ {
} }
template <typename T> template <typename T, typename SerializedT = default_serialized_t>
constexpr static SerializedT DummySerializer(const T&) constexpr static SerializedT DummySerializer(const T&)
{ {
return SerializedT(); return SerializedT();
} }
template <typename T> template <typename T, typename SerializedT = default_serialized_t>
constexpr static T DummyDeserializer(const SerializedT&) constexpr static T DummyDeserializer(const SerializedT&)
{ {
return T(); return T();
@ -112,104 +189,269 @@ public:
/* CONSTRUCTORS AND DESTRUCTOR */ /* CONSTRUCTORS AND DESTRUCTOR */
// general read-write attribute constructor template <std::invocable<> GT,
template <typename... SerValHolderTs> typename ValueT = ret_value_t<GT>,
AdcDeviceAttribute(const IdentT& ident, SerValHolderTs&&... ctor_args) std::invocable<const ValueT&> ST,
: base_t(std::forward<SerValHolderTs>(ctor_args)...), _ident(ident), _accessType(ReadWrite) std::invocable<const ValueT&> SRT =
decltype(utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>),
typename SerializedT = ret_value_t<SRT>,
std::invocable<const SerializedT&> DSRT =
decltype(utils::AdcDefaultValueConverter<>::deserialize<ValueT, SerializedT>)>
AdcDeviceAttribute(GT&& getter,
ST&& setter,
SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>,
DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<ValueT, SerializedT>)
{ {
_getterFunc<ValueT>.emplace(this, std::forward<GT>(getter));
_setterFunc<ValueT>.emplace(this, std::forward<ST>(setter));
_serializerFunc<SerializedT>[this] = [wrapper = traits::adc_pf_wrapper(std::forward<SRT>(serializer)), this]() {
auto& serializer = std::get<0>(wrapper);
auto val = _getterFunc<ValueT>[this]();
return serializer(val);
};
_deserializerFunc<SerializedT>[this] = [wrapper = traits::adc_pf_wrapper(std::forward<DSRT>(deserializer)),
this](const SerializedT& sval) {
auto& deserializer = std::get<0>(wrapper);
ValueT val = deserializer(sval);
_setterFunc<ValueT>[this](val);
};
_clearFunc = [this]() {
_getterFunc<ValueT>.erase(this);
_setterFunc<ValueT>.erase(this);
_serializerFunc<SerializedT>.erase(this);
_deserializerFunc<SerializedT>.erase(this);
};
// copy TO other
_copyFunc = [this](AdcDeviceAttribute* other) {
_getterFunc<ValueT>.emplace(other, _getterFunc<ValueT>[this]);
_setterFunc<ValueT>.emplace(other, _setterFunc<ValueT>[this]);
_serializerFunc<SerializedT>.emplace(other, _serializerFunc<SerializedT>[this]);
_deserializerFunc<SerializedT>.emplace(other, _deserializerFunc<SerializedT>[this]);
};
// move TO other
_moveFunc = [this](AdcDeviceAttribute* other) {
_getterFunc<ValueT>.emplace(other, std::move(_getterFunc<ValueT>[this]));
_setterFunc<ValueT>.emplace(other, std::move(_setterFunc<ValueT>[this]));
_serializerFunc<SerializedT>.emplace(other, std::move(_serializerFunc<SerializedT>[this]));
_deserializerFunc<SerializedT>.emplace(other, std::move(_deserializerFunc<SerializedT>[this]));
};
} }
template <traits::adc_tuple_like<> TupleT,
std::invocable<> GT,
typename ValueT = ret_value_t<GT>,
std::invocable<const ValueT&> ST,
std::invocable<const ValueT&> SRT =
decltype(utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>),
typename SerializedT = ret_value_t<SRT>,
std::invocable<const SerializedT&> DSRT =
decltype(utils::AdcDefaultValueConverter<>::deserialize<ValueT, SerializedT>)>
AdcDeviceAttribute(TupleT&&,
GT&& getter,
ST&& setter,
SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>,
DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<ValueT, SerializedT>)
: AdcDeviceAttribute(std::forward<GT>(getter),
std::forward<ST>(setter),
std::forward<SRT>(serializer),
std::forward<DSRT>(deserializer))
{
AdcDeviceAttribute::setupTrivialConvertFunc<ValueT, std::decay_t<TupleT>>();
}
// read-only attribute constructor // read-only attribute constructor
template <typename GT, template <std::invocable<> GT,
typename VALT = ret_value_t<GT>, typename ValueT = ret_value_t<GT>,
typename SRT = decltype(utils::AdcDefaultValueConverter<>::serialize<SerializedT, VALT>)> std::invocable<const ValueT&> SRT =
decltype(utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>),
typename SerializedT = ret_value_t<SRT>>
AdcDeviceAttribute(const IdentT& ident, AdcDeviceAttribute(const IdentT& ident,
GT&& getter, GT&& getter,
SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<SerializedT, VALT>) SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>)
requires std::invocable<GT> && std::invocable<SRT, const VALT&>
: AdcDeviceAttribute(ident, : AdcDeviceAttribute(ident,
std::forward<GT>(getter), std::forward<GT>(getter),
AdcDeviceAttribute::DummySetter<VALT>, AdcDeviceAttribute::DummySetter<ValueT>,
AdcValueHolder::AdcValueHolderDummyValidator<VALT>,
std::forward<SRT>(serializer), std::forward<SRT>(serializer),
AdcDeviceAttribute::DummyDeserializer<VALT>) AdcDeviceAttribute::DummyDeserializer<ValueT, SerializedT>)
{ {
_accessType = ReadOnly; _accessType = ReadOnly;
} }
template <typename GT, template <traits::adc_tuple_like<> TupleT,
typename VALT = ret_value_t<GT>, std::invocable<> GT,
typename SRT = decltype(utils::AdcDefaultValueConverter<>::serialize<SerializedT, VALT>)> typename ValueT = ret_value_t<GT>,
std::invocable<const ValueT&> SRT =
decltype(utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>),
typename SerializedT = ret_value_t<SRT>>
AdcDeviceAttribute(const IdentT& ident, AdcDeviceAttribute(const IdentT& ident,
traits::adc_tuple_like<> auto&& tpl, TupleT&&,
GT&& getter, GT&& getter,
SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<SerializedT, VALT>) SRT&& serializer = utils::AdcDefaultValueConverter<>::serialize<default_serialized_t, ValueT>)
requires std::invocable<GT> && std::invocable<SRT, const VALT&>
: AdcDeviceAttribute(ident, : AdcDeviceAttribute(ident,
std::forward<decltype(tpl)>(tpl), TupleT{},
std::forward<GT>(getter), std::forward<GT>(getter),
AdcDeviceAttribute::DummySetter<VALT>, AdcDeviceAttribute::DummySetter<ValueT>,
AdcValueHolder::AdcValueHolderDummyValidator<VALT>,
std::forward<SRT>(serializer), std::forward<SRT>(serializer),
AdcDeviceAttribute::DummyDeserializer<VALT>) AdcDeviceAttribute::DummyDeserializer<ValueT, SerializedT>)
{ {
_accessType = ReadOnly; _accessType = ReadOnly;
} }
// write-only attribute constructor // write-only attribute constructor
template <typename ST, template <traits::adc_is_setter<> ST,
typename VALT = std::decay_t<traits::adc_func_arg1_t<ST>>, typename ValueT = std::decay_t<traits::adc_func_arg1_t<ST>>,
typename DSRT = decltype(utils::AdcDefaultValueConverter<>::deserialize<VALT, SerializedT>)> typename DSRT = decltype(utils::AdcDefaultValueConverter<>::deserialize<ValueT, default_serialized_t>),
typename SerializedT = std::decay_t<traits::adc_func_arg1_t<DSRT>>>
AdcDeviceAttribute(const IdentT& ident, AdcDeviceAttribute(const IdentT& ident,
ST&& setter, ST&& setter,
std::predicate<const VALT&> auto&& validator, DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<ValueT, SerializedT>)
DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<VALT, SerializedT>)
requires std::invocable<DSRT, const SerializedT&>
: AdcDeviceAttribute(ident, : AdcDeviceAttribute(ident,
AdcDeviceAttribute::DummyGetter<VALT>, AdcDeviceAttribute::DummyGetter<ValueT>,
std::forward<ST>(setter), std::forward<ST>(setter),
std::forward<decltype(validator)>(validator), AdcDeviceAttribute::DummySerializer<ValueT>,
AdcDeviceAttribute::DummySerializer<VALT>,
std::forward<DSRT>(deserializer)) std::forward<DSRT>(deserializer))
{ {
_accessType = WriteOnly; _accessType = WriteOnly;
} }
template <typename ST, template <traits::adc_tuple_like<> TupleT,
typename VALT = std::decay_t<traits::adc_func_arg1_t<ST>>, traits::adc_is_setter<> ST,
typename DSRT = decltype(utils::AdcDefaultValueConverter<>::deserialize<VALT, SerializedT>)> typename ValueT = std::decay_t<traits::adc_func_arg1_t<ST>>,
typename DSRT = decltype(utils::AdcDefaultValueConverter<>::deserialize<ValueT, default_serialized_t>),
typename SerializedT = std::decay_t<traits::adc_func_arg1_t<DSRT>>>
AdcDeviceAttribute(const IdentT& ident, AdcDeviceAttribute(const IdentT& ident,
traits::adc_tuple_like<> auto&& tpl, TupleT&&,
ST&& setter, ST&& setter,
std::predicate<const VALT&> auto&& validator, DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<ValueT, SerializedT>)
DSRT&& deserializer = utils::AdcDefaultValueConverter<>::deserialize<VALT, SerializedT>)
requires std::invocable<DSRT, const SerializedT&>
: AdcDeviceAttribute(ident, : AdcDeviceAttribute(ident,
std::forward<decltype(tpl)>(tpl), TupleT{},
AdcDeviceAttribute::DummyGetter<VALT>, AdcDeviceAttribute::DummyGetter<ValueT>,
std::forward<ST>(setter), std::forward<ST>(setter),
std::forward<decltype(validator)>(validator), AdcDeviceAttribute::DummySerializer<ValueT>,
AdcDeviceAttribute::DummySerializer<VALT>,
std::forward<DSRT>(deserializer)) std::forward<DSRT>(deserializer))
{ {
_accessType = WriteOnly; _accessType = WriteOnly;
} }
AdcDeviceAttribute(const AdcDeviceAttribute&) = default;
AdcDeviceAttribute(AdcDeviceAttribute&&) = default; AdcDeviceAttribute(const AdcDeviceAttribute& other)
{
_clearFunc();
other._copyFunc(this);
_clearFunc = other._clearFunc;
_copyFunc = other._copyFunc;
_moveFunc = other._moveFunc;
}
AdcDeviceAttribute(AdcDeviceAttribute&& other)
{
_clearFunc();
other._moveFunc(this);
_clearFunc = std::move(other._clearFunc);
_copyFunc = std::move(other._copyFunc);
_moveFunc = std::move(other._moveFunc);
}
virtual ~AdcDeviceAttribute() { _clearFunc(); }
/* PUBLIC METHODS */
virtual ~AdcDeviceAttribute() = default;
IdentT ident() const { return _ident; } IdentT ident() const { return _ident; }
AccessType accessType() const { return _accessType; } AccessType accessType() const { return _accessType; }
template <typename FromFuncT, typename ToFuncT>
AdcDeviceAttribute& addConvertFunc(FromFuncT&& func_from_internal, ToFuncT&& func_to_internal)
requires std::invocable<FromFuncT, const ret_value_t<ToFuncT>&> &&
std::invocable<ToFuncT, const ret_value_t<FromFuncT>&>
{
using value_t = ret_value_t<ToFuncT>; // it must be internal value type
using user_t = ret_value_t<FromFuncT>;
_getterFunc<user_t>[this] = [wrapper = traits::adc_pf_wrapper(std::forward<FromFuncT>(func_from_internal)),
this]() {
auto& getter = _getterFunc<value_t>[this];
if (getter) {
auto val = getter();
return std::get<0>(wrapper)(val); // convert from internal type
}
// invalid conversion function signature
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_INTERNAL_TYPE_MISMATCH);
};
_setterFunc<user_t>[this] = [wrapper = traits::adc_pf_wrapper(std::forward<ToFuncT>(func_to_internal)),
this](const user_t& val) {
value_t value = std::get<0>(wrapper)(val); // convert to internal type
auto& setter = _setterFunc<value_t>[this];
if (setter) {
setter(value);
} else {
// invalid conversion function signature
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_INTERNAL_TYPE_MISMATCH);
}
};
_clearFunc = [prev_clear = _clearFunc, this]() {
prev_clear();
_getterFunc<user_t>.erase(this);
_setterFunc<user_t>.erase(this);
};
// copy TO other
_copyFunc = [prev_copy = _copyFunc, this](AdcDeviceAttribute* other) {
prev_copy(other);
_getterFunc<user_t>.emplace(other, _getterFunc<user_t>[this]);
_setterFunc<user_t>.emplace(other, _setterFunc<user_t>[this]);
};
// move TO other
_moveFunc = [prev_move = _moveFunc, this](AdcDeviceAttribute* other) {
prev_move(other);
_getterFunc<user_t>.emplace(other, std::move(_getterFunc<user_t>[this]));
_setterFunc<user_t>.emplace(other, std::move(_setterFunc<user_t>[this]));
};
return *this;
}
template <typename UT> template <typename UT>
operator UT() const operator UT() const
{ {
@ -217,28 +459,119 @@ public:
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_WRITE_ONLY); throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_WRITE_ONLY);
} }
return base_t::operator UT(); using val_t = std::decay_t<UT>;
auto getter = _getterFunc<val_t>[this];
if (getter) {
return getter();
} }
AdcDeviceAttribute& operator=(const AdcDeviceAttribute&) = default; throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_NO_CONV_FUNC);
AdcDeviceAttribute& operator=(AdcDeviceAttribute&&) = default; }
template <typename UT> template <typename UT>
AdcDeviceAttribute& operator=(UT&& value) AdcDeviceAttribute& operator=(UT&& other)
{ {
if (_accessType == ReadOnly) { if (_accessType == ReadOnly) {
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_READ_ONLY); throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_READ_ONLY);
} }
base_t::operator=(std::forward<UT>(value)); using val_t = std::decay_t<UT>;
auto setter = _setterFunc<val_t>[this];
if (setter) {
setter(std::forward<UT>(other));
} else {
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_NO_CONV_FUNC);
}
return *this; return *this;
} }
AdcDeviceAttribute& operator=(const AdcDeviceAttribute& other)
{
if (&other != this) {
_clearFunc();
other._copyFunc(this);
_clearFunc = other._clearFunc;
_copyFunc = other._copyFunc;
_moveFunc = other._moveFunc;
}
return *this;
}
AdcDeviceAttribute& operator=(AdcDeviceAttribute&& other)
{
if (&other != this) {
_clearFunc();
other._moveFunc(this);
_clearFunc = std::move(other._clearFunc);
_copyFunc = std::move(other._copyFunc);
_moveFunc = std::move(other._moveFunc);
}
return *this;
}
template <typename SerializedT>
SerializedT serialize()
{
using s_t = std::decay_t<SerializedT>;
auto& serializer = _serializerFunc<s_t>[this];
if (serializer) {
return serializer();
}
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_INVALID_SERIALIZED_TYPE);
}
template <typename SerializedT>
void deserialize(const SerializedT& sval)
{
using s_t = std::decay_t<SerializedT>;
auto& deserializer = _deserializerFunc<s_t>[this];
if (deserializer) {
deserializer(sval);
} else {
throw std::system_error(AdcDeviceAttributeErrorCode::ERROR_INVALID_SERIALIZED_TYPE);
}
}
protected: protected:
IdentT _ident; IdentT _ident;
AccessType _accessType; AccessType _accessType;
template <typename VT, size_t I, typename TupleT>
void setupTrivialConvertFuncImpl()
{
if constexpr (I < std::tuple_size_v<TupleT>) {
using elem_t = std::tuple_element_t<I, TupleT>;
if constexpr (!std::is_same_v<VT, elem_t>) {
addConvertFunc([](const VT& v) { return static_cast<elem_t>(v); },
[](const elem_t& v) { return static_cast<VT>(v); });
}
setupTrivialConvertFuncImpl<VT, I + 1, TupleT>();
}
}
template <typename VT, typename TupleT>
void setupTrivialConvertFunc()
{
setupTrivialConvertFuncImpl<VT, 0, TupleT>();
}
}; };
} // namespace adc } // namespace adc

View File

@ -32,7 +32,7 @@ TEST_CASE("[ADC DEVICE ATTRIBUTE]")
using attr_t = AdcDeviceAttribute<std::string_view>; using attr_t = AdcDeviceAttribute<std::string_view>;
attr_t attr("ATTR_A", AdcValueHolder::_defaultTrivialConvTypes, vv::getter, vv::setter, vv::validator); attr_t attr("ATTR_A", adc::constants::AdcDefaultTrivialConvTypes, vv::getter, vv::setter);
attr = 10.7; attr = 10.7;
av = attr; av = attr;
@ -40,7 +40,7 @@ TEST_CASE("[ADC DEVICE ATTRIBUTE]")
std::cout << "ATTR = " << av << "\n"; std::cout << "ATTR = " << av << "\n";
// std::cout << "ATTR = " << (unsigned)attr << "\n"; // std::cout << "ATTR = " << (unsigned)attr << "\n";
attr_t aw("ATTR_WO", AdcValueHolder::_defaultTrivialConvTypes, vv::setter, vv::validator); attr_t aw("ATTR_WO", adc::constants::AdcDefaultTrivialConvTypes, vv::setter);
std::cout << "ACC_TYPE: " << aw.accessType() << "\n"; std::cout << "ACC_TYPE: " << aw.accessType() << "\n";
} }