ChimeraTK-DeviceAccess 03.27.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;
20
22 explicit DataConsistencyKey(BaseType value) : _value(value) {}
23
25 explicit operator BaseType() const { return _value; }
26
28 std::strong_ordering operator<=>(const DataConsistencyKey&) const = default;
29 std::strong_ordering operator<=>(BaseType other) const { return operator<=>(DataConsistencyKey(other)); }
30
33 ++_value;
34 return *this;
35 }
36
39 DataConsistencyKey tmp = *this;
40 ++_value;
41 return tmp;
42 }
43
45 BaseType operator+(const DataConsistencyKey& other) const { return _value + other._value; }
46 BaseType operator+(const BaseType& other) const { return _value + other; }
47
48 BaseType operator-(const DataConsistencyKey& other) const { return _value - other._value; }
49 BaseType operator-(const BaseType& other) const { return _value - other; }
50
51 private:
52 BaseType _value;
53 };
54
55 /********************************************************************************************************************/
56
57} // 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.
DataConsistencyKey & operator=(const DataConsistencyKey &other)=default