...
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <ranges>
|
||||
#include <system_error>
|
||||
|
||||
#include "adc_device_concepts.h"
|
||||
|
||||
namespace adc
|
||||
{
|
||||
|
||||
@@ -33,7 +35,10 @@ namespace adc
|
||||
struct AdcGenericDeviceErrorCategory : public std::error_category {
|
||||
AdcGenericDeviceErrorCategory() : std::error_category() {}
|
||||
|
||||
const char* name() const noexcept { return "ADC_GENERIC_DEVICE"; }
|
||||
const char* name() const noexcept
|
||||
{
|
||||
return "ADC_GENERIC_DEVICE";
|
||||
}
|
||||
|
||||
std::string message(int ec) const
|
||||
{
|
||||
@@ -66,32 +71,7 @@ inline std::error_code make_error_code(AdcGenericDeviceErrorCode ec)
|
||||
|
||||
|
||||
|
||||
namespace traits
|
||||
{
|
||||
|
||||
// ADC device attribute concept
|
||||
template <typename T>
|
||||
concept adc_device_attr_c = requires {
|
||||
typename T::ident_t;
|
||||
&T::ident;
|
||||
&T::serialize;
|
||||
&T::deserialize;
|
||||
// std::declval<T>().operator int();
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
concept adc_device_cmd_c = requires {
|
||||
typename T::ident_t;
|
||||
&T::ident;
|
||||
&T::operator();
|
||||
};
|
||||
|
||||
|
||||
} // namespace traits
|
||||
|
||||
|
||||
template <typename IdentT, traits::adc_device_attr_c AttributeT, traits::adc_device_cmd_c CommandT>
|
||||
template <typename IdentT, interfaces::adc_device_attr_c AttributeT, interfaces::adc_device_cmd_c CommandT>
|
||||
class AdcGenericDevice
|
||||
{
|
||||
public:
|
||||
@@ -110,7 +90,10 @@ public:
|
||||
|
||||
/* PUBLIC METHODS */
|
||||
|
||||
IdentT ident() const { return _ident; }
|
||||
IdentT ident() const
|
||||
{
|
||||
return _ident;
|
||||
}
|
||||
|
||||
AdcGenericDevice& operator()(const cmd_ident_t& cmd_ident)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user