ChimeraTK-DeviceAccess  03.18.00
RegisterCatalogue.cc
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 
4 #include "RegisterCatalogue.h"
5 
7 
8 namespace ChimeraTK {
9 
10  /********************************************************************************************************************/
11 
12  RegisterCatalogue::RegisterCatalogue(std::unique_ptr<BackendRegisterCatalogueBase>&& impl) : _impl(std::move(impl)) {}
13 
14  /********************************************************************************************************************/
15 
16  RegisterCatalogue::RegisterCatalogue(const RegisterCatalogue& other) : _impl(other._impl->clone()) {}
17 
18  /********************************************************************************************************************/
19 
20  RegisterCatalogue::RegisterCatalogue(RegisterCatalogue&& other) noexcept : _impl(std::move(other._impl)) {}
21 
22  /********************************************************************************************************************/
23 
25  _impl = other._impl->clone();
26  return *this;
27  }
28 
29  /********************************************************************************************************************/
30 
32  _impl = std::move(other._impl);
33  return *this;
34  }
35 
36  /********************************************************************************************************************/
37 
38  // need to declare in .cc file, since the type RegisterCatalogueImpl must be complete
40 
41  /********************************************************************************************************************/
42 
43  RegisterInfo RegisterCatalogue::getRegister(const RegisterPath& registerPathName) const {
44  return _impl->getRegister(registerPathName);
45  }
46 
47  /********************************************************************************************************************/
48 
49  bool RegisterCatalogue::hasRegister(const RegisterPath& registerPathName) const {
50  return _impl->hasRegister(registerPathName);
51  }
52 
53  /********************************************************************************************************************/
54 
56  return _impl->getNumberOfRegisters();
57  }
58 
59  /********************************************************************************************************************/
60 
62  return RegisterCatalogue::const_iterator(_impl->getConstIteratorBegin());
63  }
64 
65  /********************************************************************************************************************/
66 
68  return RegisterCatalogue::const_iterator(_impl->getConstIteratorEnd());
69  }
70 
71  /********************************************************************************************************************/
72 
73  RegisterCatalogue::const_iterator::const_iterator(std::unique_ptr<const_RegisterCatalogueImplIterator> it)
74  : _impl(std::move(it)) {}
75 
76  /********************************************************************************************************************/
77 
79  _impl->increment();
80  return *this;
81  }
82 
83  /********************************************************************************************************************/
84 
87  _impl->increment();
88  return temp;
89  }
90 
91  /********************************************************************************************************************/
92 
94  _impl->decrement();
95  return *this;
96  }
97 
98  /********************************************************************************************************************/
99 
102  _impl->decrement();
103  return temp;
104  }
105 
106  /********************************************************************************************************************/
107 
109  return *(_impl->get());
110  }
111 
112  /********************************************************************************************************************/
113 
115  return _impl->get();
116  }
117 
118  /********************************************************************************************************************/
119 
121  return _impl->isEqual(rightHandSide._impl);
122  }
123 
124  /********************************************************************************************************************/
125 
127  return !_impl->isEqual(rightHandSide._impl);
128  }
129 
130  /********************************************************************************************************************/
131 
133  return *_impl;
134  }
135 
136  /********************************************************************************************************************/
137 } /* namespace ChimeraTK */
ChimeraTK::RegisterCatalogue::const_iterator
Const iterator for iterating through the registers in the catalogue.
Definition: RegisterCatalogue.h:51
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::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
BackendRegisterCatalogue.h
ChimeraTK::RegisterCatalogue::const_iterator::const_iterator
const_iterator(std::unique_ptr< const_RegisterCatalogueImplIterator > it)
Definition: RegisterCatalogue.cc:73
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::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::operator=
RegisterCatalogue & operator=(const RegisterCatalogue &other)
Definition: RegisterCatalogue.cc:24
RegisterCatalogue.h
ChimeraTK::RegisterCatalogue::const_iterator::operator++
const_iterator & operator++()
Definition: RegisterCatalogue.cc:78
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::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