This commit is contained in:
Timur A. Fatkhullin
2024-11-02 00:58:25 +03:00
parent 8e13ad0c3c
commit 2f46b08c8e
4 changed files with 81 additions and 88 deletions

View File

@@ -9,8 +9,14 @@ using namespace adc;
template <typename T>
struct V {
static T getter() { return _v; }
static void setter(const T& v) { _v = v; }
static T getter()
{
return _v;
}
static void setter(const T& v)
{
_v = v;
}
static bool validator(const T& v)
{
@@ -30,7 +36,7 @@ TEST_CASE("[ADC DEVICE ATTRIBUTE]")
double av = -10;
using vv = V<unsigned>;
using attr_t = AdcDeviceAttribute<std::string_view>;
using attr_t = AdcDeviceAttribute<std::string_view, std::string>;
std::string_view id{"ATTR_A"};
@@ -56,4 +62,12 @@ TEST_CASE("[ADC DEVICE ATTRIBUTE]")
std::cout << "ACC_TYPE: " << ar.accessType() << "\n";
std::cout << "ATTR_RO = " << (double)ar << "\n";
auto ar1 = ar;
std::cout << "ATTR1_RO = " << (double)ar1 << "\n";
auto ar2(ar1);
std::cout << "ATTR2_RO = " << (double)ar2 << "\n";
std::cout << "ATTR2_RO_SER = " << ar2.serialize() << "\n";
}