ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
DataConsistencyKey.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include <compare>
6#include <cstdint>
7
8namespace ChimeraTK::async {
9
10 /********************************************************************************************************************/
11
13 public:
15 using BaseType = uint64_t;
16
18 DataConsistencyKey(const DataConsistencyKey& other) = default;
19
21 explicit DataConsistencyKey(BaseType value) : _value(value) {}
22
24 explicit operator BaseType() const { return _value; }
25
27 std::strong_ordering operator<=>(const DataConsistencyKey&) const = default;
28 std::strong_ordering operator<=>(BaseType other) const { return operator<=>(DataConsistencyKey(other)); }
29
32 ++_value;
33 return *this;
34 }
35
38 DataConsistencyKey tmp = *this;
39 ++_value;
40 return tmp;
41 }
42
44 BaseType operator+(const DataConsistencyKey& other) const { return _value + other._value; }
45 BaseType operator+(const BaseType& other) const { return _value + other; }
46
47 BaseType operator-(const DataConsistencyKey& other) const { return _value - other._value; }
48 BaseType operator-(const BaseType& other) const { return _value - other; }
49
50 private:
51 BaseType _value;
52 };
53
54 /********************************************************************************************************************/
55
56} // namespace ChimeraTK::async
BaseType operator+(const BaseType &other) const
BaseType operator-(const DataConsistencyKey &other) const
BaseType operator-(const BaseType &other) const
DataConsistencyKey(const DataConsistencyKey &other)=default
Copy constructor.
uint64_t BaseType
Numeric data type for the key. Must be a valid UserType for the register accessors.
BaseType operator+(const DataConsistencyKey &other) const
Addition operators.
DataConsistencyKey & operator++()
Increment operator.
DataConsistencyKey operator++(int)
Postfix increment operator.
DataConsistencyKey(BaseType value)
Construct from numeric value.
std::strong_ordering operator<=>(BaseType other) const
std::strong_ordering operator<=>(const DataConsistencyKey &) const =default
Comparison operators.