5#ifndef IO_EVENT_SOURCE_H
6#define IO_EVENT_SOURCE_H
32 digital_out = 0x30f15,
51 : _hash{
hash(src, value) }
52 , _label{ std::move(
label) }
68 uint32_t
hash()
const {
return _hash; }
73 std::string
label()
const {
return _label; }
77 explicit operator uint32_t()
const {
return _hash; }
108 if constexpr (!(std::is_integral_v<T> || std::is_enum_v<T>) ) {
109 static_assert(
false,
"type T is not convertible to uint32_t");
112 uint32_t result{
static_cast<uint32_t
>(value) + 1 };
113 result = (result ^ (result >> 8U)) *
static_cast<uint32_t
>(src);
114 result = (result ^ (result >> 8U)) *
static_cast<uint32_t
>(src);
115 return result ^ (result >> 8U);
event_source()
The class default constructor.
Definition io_event_source.h:60
std::string label() const
Return the (optional) label assigned to this event source at time of object construction.
Definition io_event_source.h:73
bool operator<(const event_source &other) const
operator < to be used when sorting event_source objects
Definition io_event_source.h:96
bool operator!=(const event_source &other) const
Inequality operator, verifies if two event_source objects have different values.
Definition io_event_source.h:90
uint32_t hash() const
Return the cached hash value calculated at construction time.
Definition io_event_source.h:68
bool operator==(const event_source &other) const
Equality operator, verifies if two event_source objects have the same value.
Definition io_event_source.h:84
event_source(source src, T value, std::string label="")
The class constructor.
Definition io_event_source.h:50
source
The source enum contains unique constants to be used in the hash calculation.
Definition io_event_source.h:30
Any entities that belong to the IO library.