![]() |
ChimeraTK-DeviceAccess 03.25.00
|
Register accessor for accessing single word or 1D array registers internally of a DummyBackend implementation. More...
#include <DummyRegisterAccessor.h>
Inheritance diagram for ChimeraTK::DummyRegisterAccessor< T >:
Collaboration diagram for ChimeraTK::DummyRegisterAccessor< T >:Public Member Functions | |
| DummyRegisterAccessor (DummyBackend *dev, std::string const &module, std::string const &name) | |
| Constructor should normally be called in the constructor of the DummyBackend implementation. | |
| DummyRegisterAccessor (const DummyRegisterAccessor &)=default | |
| void | operator= (const DummyRegisterAccessor &rightHandSide) const =delete |
| remove assignment operator since it will be confusing */ | |
| proxies::DummyRegisterElement< T > | operator[] (unsigned int index) |
| Get or set register content by [] operator. | |
| unsigned int | getNumberOfElements () |
| return number of elements | |
| DummyBackend & | getBackend () const |
| Return the backend. | |
| const RegisterPath & | getRegisterPath () const |
| Return the register path. | |
| void | setWriteCallback (const std::function< void()> &writeCallback) |
| Set callback function which is called when the register is written to (through the normal Device interface) | |
| const NumericAddressedRegisterInfo & | getRegisterInfo () |
| std::unique_lock< std::mutex > | getBufferLock () |
| Get a lock to safely modify the buffer in a multi-treaded environment. | |
Public Member Functions inherited from ChimeraTK::proxies::DummyRegisterElement< T > | |
| DummyRegisterElement (FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > *_fpc, int _nbytes, int32_t *_buffer) | |
| operator T () const | |
| Implicit type conversion to user type T. | |
| DummyRegisterElement< T > & | operator= (T rhs) |
| assignment operator | |
| DummyRegisterElement< T > | operator++ () |
| pre-increment operator | |
| DummyRegisterElement< T > | operator-- () |
| pre-decrement operator | |
| T | operator++ (int) |
| post-increment operator | |
| T | operator-- (int) |
| post-decrement operator | |
Protected Member Functions | |
| int32_t * | getElement (unsigned int index) |
| return element | |
| proxies::DummyRegisterElement< T > | getProxy (int index) |
| return a proxy object | |
Protected Member Functions inherited from ChimeraTK::proxies::DummyRegisterElement< T > | |
| DummyRegisterElement () | |
| constructor when used as a base class in DummyRegister | |
Protected Attributes | |
| DummyBackend * | _dev |
| pointer to VirtualDevice | |
| NumericAddressedRegisterInfo | registerInfo |
| register map information | |
| RegisterPath | _path |
| path of the register | |
| FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > | fpc |
| fixed point converter | |
Protected Attributes inherited from ChimeraTK::proxies::DummyRegisterElement< T > | |
| FixedPointConverter< DEPRECATED_FIXEDPOINT_DEFAULT > * | fpcptr |
| fixed point converter to be used for this element | |
| int | nbytes |
| number of bytes per word | |
| int32_t * | buffer |
| raw buffer of this element | |
Register accessor for accessing single word or 1D array registers internally of a DummyBackend implementation.
This accessor should be used to access the dummy registers through the "backdoor" when unit-testing e.g. a library or when implementing a device in the VirtualLab framework. A simple access is provided through the operators and implicit type conversions. The [] operator will return a temporary proxy class, which deals with converting read and write operations of a single word of the register. The temporary proxy implements all needed operators and the implicit type conversion to the type T, so it can be used as it were a variable of the type T in most places.
This class inherits from the DummyRegisterElement proxy, to avoid reimplementing the same interface again. It is thus possible to access through the DummyRegister class directly the first element of the register, without using the [0] operator.
Definition at line 133 of file DummyRegisterAccessor.h.
|
inline |
Constructor should normally be called in the constructor of the DummyBackend implementation.
dev must be the pointer to the DummyBackend to be accessed. A raw pointer is needed, as used inside the DummyBackend itself. module and name denominate the register entry in the map file.
Definition at line 139 of file DummyRegisterAccessor.h.
|
default |
|
inline |
Return the backend.
Definition at line 165 of file DummyRegisterAccessor.h.
|
inline |
Get a lock to safely modify the buffer in a multi-treaded environment.
You have to release it as soon as possible because it will block all other functionality of the Dummy and all application threads which use it.
Definition at line 184 of file DummyRegisterAccessor.h.
|
inlineprotected |
return element
Definition at line 200 of file DummyRegisterAccessor.h.
|
inline |
return number of elements
Definition at line 159 of file DummyRegisterAccessor.h.
|
inlineprotected |
return a proxy object
Definition at line 205 of file DummyRegisterAccessor.h.
|
inline |
Definition at line 179 of file DummyRegisterAccessor.h.
|
inline |
Return the register path.
Definition at line 168 of file DummyRegisterAccessor.h.
|
delete |
remove assignment operator since it will be confusing */
|
inline |
Get or set register content by [] operator.
Definition at line 156 of file DummyRegisterAccessor.h.
|
inline |
Set callback function which is called when the register is written to (through the normal Device interface)
Definition at line 171 of file DummyRegisterAccessor.h.
|
protected |
pointer to VirtualDevice
Definition at line 188 of file DummyRegisterAccessor.h.
|
protected |
path of the register
Definition at line 194 of file DummyRegisterAccessor.h.
|
protected |
fixed point converter
Definition at line 197 of file DummyRegisterAccessor.h.
|
protected |
register map information
Definition at line 191 of file DummyRegisterAccessor.h.