ChimeraTK-DeviceAccess  03.18.00
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/shared_ptr.hpp>
9 
10 #include <map>
11 
12 namespace ChimeraTK {
13 
14  class BackendRegisterCatalogueBase;
15  class const_RegisterCatalogueImplIterator;
16 
17  /********************************************************************************************************************/
18 
21  public:
22  explicit RegisterCatalogue(std::unique_ptr<BackendRegisterCatalogueBase>&& impl);
23 
25  RegisterCatalogue(RegisterCatalogue&& other) noexcept;
28 
30 
36  [[nodiscard]] RegisterInfo getRegister(const RegisterPath& registerPathName) const;
37 
39  [[nodiscard]] bool hasRegister(const RegisterPath& registerPathName) const;
40 
42  [[nodiscard]] size_t getNumberOfRegisters() const;
43 
48  [[nodiscard]] const BackendRegisterCatalogueBase& getImpl() const;
49 
52  public:
53  explicit const_iterator(std::unique_ptr<const_RegisterCatalogueImplIterator> it);
54 
55  const_iterator(const const_iterator& other);
57 
58  const_iterator(const_iterator&& other) noexcept;
59  const_iterator& operator=(const_iterator&& other) noexcept;
60 
67  bool operator==(const const_iterator& rightHandSide) const;
68  bool operator!=(const const_iterator& rightHandSide) const;
69 
70  protected:
71  std::unique_ptr<const_RegisterCatalogueImplIterator> _impl;
72  };
73 
75  [[nodiscard]] const_iterator begin() const;
76  [[nodiscard]] const_iterator end() const;
77 
78  protected:
79  std::unique_ptr<BackendRegisterCatalogueBase> _impl;
80  };
81 
82  /********************************************************************************************************************/
83 
89  public:
90  virtual ~const_RegisterCatalogueImplIterator() = default;
91 
92  virtual void increment() = 0;
93 
94  virtual void decrement() = 0;
95 
96  [[nodiscard]] virtual const BackendRegisterInfoBase* get() = 0;
97 
98  [[nodiscard]] virtual bool isEqual(
99  const std::unique_ptr<const_RegisterCatalogueImplIterator>& rightHandSide) const = 0;
100 
105  [[nodiscard]] virtual std::unique_ptr<const_RegisterCatalogueImplIterator> clone() const = 0;
106  };
107 
108  /********************************************************************************************************************/
109 
110 } /* namespace ChimeraTK */
ChimeraTK::RegisterCatalogue::const_iterator
Const iterator for iterating through the registers in the catalogue.
Definition: RegisterCatalogue.h:51
ChimeraTK::const_RegisterCatalogueImplIterator::decrement
virtual void decrement()=0
ChimeraTK::RegisterCatalogue::const_iterator::operator->
const BackendRegisterInfoBase * operator->()
Definition: RegisterCatalogue.cc:114
ChimeraTK::RegisterCatalogue::_impl
std::unique_ptr< BackendRegisterCatalogueBase > _impl
Definition: RegisterCatalogue.h:79
ChimeraTK::RegisterCatalogue::const_iterator::operator!=
bool operator!=(const const_iterator &rightHandSide) const
Definition: RegisterCatalogue.cc:126
ChimeraTK::const_RegisterCatalogueImplIterator::get
virtual const BackendRegisterInfoBase * get()=0
ChimeraTK::const_RegisterCatalogueImplIterator::isEqual
virtual bool isEqual(const std::unique_ptr< const_RegisterCatalogueImplIterator > &rightHandSide) const =0
ChimeraTK::RegisterCatalogue::hasRegister
bool hasRegister(const RegisterPath &registerPathName) const
Check if register with the given path name exists.
Definition: RegisterCatalogue.cc:49
ChimeraTK::RegisterCatalogue::begin
const_iterator begin() const
Return iterators for iterating through the registers in the catalogue.
Definition: RegisterCatalogue.cc:61
ChimeraTK::RegisterCatalogue::const_iterator::const_iterator
const_iterator(std::unique_ptr< const_RegisterCatalogueImplIterator > it)
Definition: RegisterCatalogue.cc:73
ChimeraTK::const_RegisterCatalogueImplIterator::clone
virtual std::unique_ptr< const_RegisterCatalogueImplIterator > clone() const =0
Create copy of the iterator.
ChimeraTK::RegisterCatalogue::end
const_iterator end() const
Definition: RegisterCatalogue.cc:67
ChimeraTK::RegisterCatalogue::RegisterCatalogue
RegisterCatalogue(std::unique_ptr< BackendRegisterCatalogueBase > &&impl)
Definition: RegisterCatalogue.cc:12
ChimeraTK::RegisterCatalogue
Catalogue of register information.
Definition: RegisterCatalogue.h:20
ChimeraTK::RegisterCatalogue::~RegisterCatalogue
~RegisterCatalogue()
ChimeraTK::RegisterCatalogue::const_iterator::operator--
const_iterator & operator--()
Definition: RegisterCatalogue.cc:93
ChimeraTK::RegisterCatalogue::getNumberOfRegisters
size_t getNumberOfRegisters() const
Get number of registers in the catalogue.
Definition: RegisterCatalogue.cc:55
ChimeraTK::const_RegisterCatalogueImplIterator
Virtual base class for the catalogue const iterator.
Definition: RegisterCatalogue.h:88
ChimeraTK::RegisterCatalogue::getRegister
RegisterInfo getRegister(const RegisterPath &registerPathName) const
Get register information for a given full path name.
Definition: RegisterCatalogue.cc:43
ChimeraTK::RegisterInfo
Definition: RegisterInfo.h:12
ChimeraTK::RegisterCatalogue::const_iterator::_impl
std::unique_ptr< const_RegisterCatalogueImplIterator > _impl
Definition: RegisterCatalogue.h:71
ChimeraTK::RegisterCatalogue::const_iterator::operator=
const_iterator & operator=(const const_iterator &other)
ChimeraTK::RegisterCatalogue::operator=
RegisterCatalogue & operator=(const RegisterCatalogue &other)
Definition: RegisterCatalogue.cc:24
ChimeraTK::const_RegisterCatalogueImplIterator::~const_RegisterCatalogueImplIterator
virtual ~const_RegisterCatalogueImplIterator()=default
ChimeraTK::RegisterCatalogue::const_iterator::operator++
const_iterator & operator++()
Definition: RegisterCatalogue.cc:78
RegisterInfo.h
ChimeraTK::RegisterCatalogue::const_iterator::operator==
bool operator==(const const_iterator &rightHandSide) const
Definition: RegisterCatalogue.cc:120
ChimeraTK::RegisterCatalogue::const_iterator::operator*
const BackendRegisterInfoBase & operator*()
Definition: RegisterCatalogue.cc:108
ChimeraTK::const_RegisterCatalogueImplIterator::increment
virtual void increment()=0
ChimeraTK::RegisterCatalogue::getImpl
const BackendRegisterCatalogueBase & getImpl() const
Return a const reference to the implementation object.
Definition: RegisterCatalogue.cc:132
ChimeraTK::RegisterPath
Class to store a register path name.
Definition: RegisterPath.h:16
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::BackendRegisterInfoBase
DeviceBackend-independent register description.
Definition: BackendRegisterInfoBase.h:16
ChimeraTK::BackendRegisterCatalogueBase
Pure virtual implementation base class for the register catalogue.
Definition: BackendRegisterCatalogue.h:22
RegisterPath.h