ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
RegisterCatalogue.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 "RegisterInfo.h"
6#include "RegisterPath.h"
7
8#include <boost/range/any_range.hpp>
9#include <boost/shared_ptr.hpp>
10
11namespace ChimeraTK {
12
13 class BackendRegisterCatalogueBase;
14 class const_RegisterCatalogueImplIterator;
15
16 /********************************************************************************************************************/
17
21 using HiddenRange = boost::any_range<BackendRegisterInfoBase, boost::forward_traversal_tag,
22 const BackendRegisterInfoBase&, std::ptrdiff_t>;
23
24 /********************************************************************************************************************/
25
28 public:
29 explicit RegisterCatalogue(std::unique_ptr<BackendRegisterCatalogueBase>&& impl);
30
32 RegisterCatalogue(RegisterCatalogue&& other) noexcept;
35
37
43 [[nodiscard]] RegisterInfo getRegister(const RegisterPath& registerPathName) const;
44
46 [[nodiscard]] bool hasRegister(const RegisterPath& registerPathName) const;
47
49 [[nodiscard]] size_t getNumberOfRegisters() const;
50
55 [[nodiscard]] const BackendRegisterCatalogueBase& getImpl() const;
56
60 [[nodiscard]] HiddenRange hiddenRegisters() const;
61
64 public:
65 explicit const_iterator(std::unique_ptr<const_RegisterCatalogueImplIterator> it);
66
67 const_iterator(const const_iterator& other);
69
70 const_iterator(const_iterator&& other) noexcept;
72
79 bool operator==(const const_iterator& rightHandSide) const;
80 bool operator!=(const const_iterator& rightHandSide) const;
81
82 protected:
83 std::unique_ptr<const_RegisterCatalogueImplIterator> _impl;
84 };
85
87 [[nodiscard]] const_iterator begin() const;
88 [[nodiscard]] const_iterator end() const;
89
90 protected:
91 std::unique_ptr<BackendRegisterCatalogueBase> _impl;
92 };
93
94 /********************************************************************************************************************/
95
101 public:
103
104 virtual void increment() = 0;
105
106 virtual void decrement() = 0;
107
108 [[nodiscard]] virtual const BackendRegisterInfoBase* get() = 0;
109
110 [[nodiscard]] virtual bool isEqual(
111 const std::unique_ptr<const_RegisterCatalogueImplIterator>& rightHandSide) const = 0;
112
117 [[nodiscard]] virtual std::unique_ptr<const_RegisterCatalogueImplIterator> clone() const = 0;
118 };
119
120 /********************************************************************************************************************/
121
122} /* namespace ChimeraTK */
Pure virtual implementation base class for the register catalogue.
DeviceBackend-independent register description.
Const iterator for iterating through the registers in the catalogue.
const_iterator & operator=(const_iterator &&other) noexcept
bool operator!=(const const_iterator &rightHandSide) const
std::unique_ptr< const_RegisterCatalogueImplIterator > _impl
const_iterator(const_iterator &&other) noexcept
const BackendRegisterInfoBase * operator->()
bool operator==(const const_iterator &rightHandSide) const
const_iterator & operator=(const const_iterator &other)
const BackendRegisterInfoBase & operator*()
Catalogue of register information.
RegisterInfo getRegister(const RegisterPath &registerPathName) const
Get register information for a given full path name.
std::unique_ptr< BackendRegisterCatalogueBase > _impl
size_t getNumberOfRegisters() const
Get number of registers in the catalogue.
bool hasRegister(const RegisterPath &registerPathName) const
Check if register with the given path name exists.
HiddenRange hiddenRegisters() const
Returns non-owning range of all hidden registers in the catalogue.
RegisterCatalogue & operator=(const RegisterCatalogue &other)
const_iterator begin() const
Return iterators for iterating through the registers in the catalogue.
const BackendRegisterCatalogueBase & getImpl() const
Return a const reference to the implementation object.
Class to store a register path name.
Virtual base class for the catalogue const iterator.
virtual std::unique_ptr< const_RegisterCatalogueImplIterator > clone() const =0
Create copy of the iterator.
virtual bool isEqual(const std::unique_ptr< const_RegisterCatalogueImplIterator > &rightHandSide) const =0
virtual const BackendRegisterInfoBase * get()=0
boost::any_range< BackendRegisterInfoBase, boost::forward_traversal_tag, const BackendRegisterInfoBase &, std::ptrdiff_t > HiddenRange
Forward range with type-erasure, used to get a range of hidden registers.