ChimeraTK-DeviceAccess
03.18.00
|
Register accessor for accessing single word or 1D array registers internally of a DummyBackend implementation. More...
#include <DummyBackend.h>
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. More... | |
DummyRegisterAccessor (const DummyRegisterAccessor &)=default | |
void | operator= (const DummyRegisterAccessor &rightHandSide) const =delete |
remove assignment operator since it will be confusing */ More... | |
proxies::DummyRegisterElement< T > | operator[] (unsigned int index) |
Get or set register content by [] operator. More... | |
unsigned int | getNumberOfElements () |
return number of elements More... | |
DummyBackend & | getBackend () const |
Return the backend. More... | |
const RegisterPath & | getRegisterPath () const |
Return the register path. More... | |
void | setWriteCallback (const std::function< void()> &writeCallback) |
Set callback function which is called when the register is written to (through the normal Device interface) More... | |
const NumericAddressedRegisterInfo & | getRegisterInfo () |
std::unique_lock< std::mutex > | getBufferLock () |
Get a lock to safely modify the buffer in a multi-treaded environment. More... | |
Protected Member Functions | |
int32_t * | getElement (unsigned int index) |
return element More... | |
proxies::DummyRegisterElement< T > | getProxy (int index) |
return a proxy object More... | |
Protected Attributes | |
DummyBackend * | _dev |
pointer to VirtualDevice More... | |
NumericAddressedRegisterInfo | registerInfo |
register map information More... | |
RegisterPath | _path |
path of the register More... | |
FixedPointConverter | fpc |
fixed point converter More... | |
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 20 of file DummyBackend.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 138 of file DummyRegisterAccessor.h.
|
default |
|
inline |
Return the backend.
Definition at line 164 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 183 of file DummyRegisterAccessor.h.
|
inlineprotected |
return element
Definition at line 199 of file DummyRegisterAccessor.h.
|
inline |
return number of elements
Definition at line 158 of file DummyRegisterAccessor.h.
|
inlineprotected |
return a proxy object
Definition at line 204 of file DummyRegisterAccessor.h.
|
inline |
Definition at line 178 of file DummyRegisterAccessor.h.
|
inline |
Return the register path.
Definition at line 167 of file DummyRegisterAccessor.h.
|
delete |
remove assignment operator since it will be confusing */
|
inline |
Get or set register content by [] operator.
Definition at line 155 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 170 of file DummyRegisterAccessor.h.
|
protected |
pointer to VirtualDevice
Definition at line 187 of file DummyRegisterAccessor.h.
|
protected |
path of the register
Definition at line 193 of file DummyRegisterAccessor.h.
|
protected |
fixed point converter
Definition at line 196 of file DummyRegisterAccessor.h.
|
protected |
register map information
Definition at line 190 of file DummyRegisterAccessor.h.