![]() |
ChimeraTK-DeviceAccess 03.25.00
|
Accessor class to read and write registers transparently by using the accessor object like a vector of the type UserType. More...
#include <OneDRegisterAccessor.h>
Inheritance diagram for ChimeraTK::OneDRegisterAccessor< UserType >:
Collaboration diagram for ChimeraTK::OneDRegisterAccessor< UserType >:Public Types | |
| using | iterator = typename std::vector< UserType >::iterator |
| using | const_iterator = typename std::vector< UserType >::const_iterator |
| using | reverse_iterator = typename std::vector< UserType >::reverse_iterator |
| using | const_reverse_iterator = typename std::vector< UserType >::const_reverse_iterator |
Public Types inherited from ChimeraTK::NDRegisterAccessorAbstractor< UserType > | |
| using | value_type = UserType |
Public Member Functions | |
| OneDRegisterAccessor (boost::shared_ptr< NDRegisterAccessor< UserType > > impl) | |
| Create accessor from pointer to implementation. | |
| OneDRegisterAccessor () | |
| Placeholder constructer, to allow late initialisation of the accessor, e.g. | |
| UserType & | operator[] (unsigned int element) |
| Get or set buffer content by [] operator. | |
| unsigned int | getNElements () |
| Return number of elements/samples in the register. | |
| iterator | begin () |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| iterator | end () |
| const_iterator | end () const |
| const_iterator | cend () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | crbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| const_reverse_iterator | crend () const |
| void | swap (std::vector< UserType > &x) noexcept |
| Swap content of (cooked) buffer with std::vector. | |
| OneDRegisterAccessor< UserType > & | operator= (const std::vector< UserType > &x) |
| Copy content of (cooked) buffer from std::vector. | |
| operator const std::vector< UserType > & () | |
| Convert content of (cooked) buffer into std::vector. | |
| UserType * | data () |
| Return a direct pointer to the memory buffer storng the elements. | |
| template<typename COOKED_TYPE > | |
| COOKED_TYPE | getAsCooked (unsigned int sample) |
| Get the cooked values in case the accessor is a raw accessor (which does not do data conversion). | |
| template<typename COOKED_TYPE > | |
| void | setAsCooked (unsigned int sample, COOKED_TYPE value) |
| Set the cooked values in case the accessor is a raw accessor (which does not do data conversion). | |
| void | writeIfDifferent (const std::vector< UserType > &newValue, VersionNumber versionNumber=VersionNumber{nullptr}, DataValidity validity=DataValidity::ok) |
| Convenience function to set and write new value if it differes from the current value. | |
Public Member Functions inherited from ChimeraTK::NDRegisterAccessorAbstractor< UserType > | |
| NDRegisterAccessorAbstractor ()=default | |
| Create an uninitialised abstractor - just for late initialisation. | |
| NDRegisterAccessorAbstractor (const NDRegisterAccessorAbstractor &)=default | |
| Declare that we want the default copy constructor although we delete the assigmnent operator. | |
| void | replace (const NDRegisterAccessorAbstractor< UserType > &newAccessor) |
| Assign a new accessor to this NDRegisterAccessorAbstractor. | |
| void | replace (boost::shared_ptr< NDRegisterAccessor< UserType > > newImpl) |
| Alternative signature of replace() with the same functionality, used when a pointer to the implementation has been obtained directly (instead of a NDRegisterAccessorAbstractor). | |
| const NDRegisterAccessorAbstractor & | operator= (const NDRegisterAccessorAbstractor &rightHandSide) const =delete |
| Prevent copying by operator=, since it will be confusing (operator= may also be overloaded to access the content of the buffer!) | |
| boost::shared_ptr< NDRegisterAccessor< UserType > > | getImpl () |
Public Member Functions inherited from ChimeraTK::TransferElementAbstractor | |
| TransferElementAbstractor (boost::shared_ptr< TransferElement > impl) | |
| Construct from TransferElement implementation. | |
| TransferElementAbstractor ()=default | |
| Create an uninitialised abstractor - just for late initialisation. | |
| const std::string & | getName () const |
| Returns the name that identifies the process variable. | |
| const std::string & | getUnit () const |
| Returns the engineering unit. | |
| const std::string & | getDescription () const |
| Returns the description of this variable/register. | |
| const std::type_info & | getValueType () const |
Returns the std::type_info for the value type of this transfer element. | |
| AccessModeFlags | getAccessModeFlags () const |
| Return the AccessModeFlags for this TransferElement. | |
| void | read () |
| Read the data from the device. | |
| bool | readNonBlocking () |
| Read the next value, if available in the input buffer. | |
| bool | readLatest () |
| Read the latest value, discarding any other update since the last read if present. | |
| ChimeraTK::VersionNumber | getVersionNumber () const |
| Returns the version number that is associated with the last transfer (i.e. | |
| bool | write (ChimeraTK::VersionNumber versionNumber={}) |
| Write the data to device. | |
| bool | writeDestructively (ChimeraTK::VersionNumber versionNumber={}) |
| Just like write(), but allows the implementation to destroy the content of the user buffer in the process. | |
| bool | isReadOnly () const |
| Check if transfer element is read only, i.e. | |
| bool | isReadable () const |
| Check if transfer element is readable. | |
| bool | isWriteable () const |
| Check if transfer element is writeable. | |
| std::vector< boost::shared_ptr< TransferElement > > | getHardwareAccessingElements () |
| Obtain the underlying TransferElements with actual hardware access. | |
| std::list< boost::shared_ptr< TransferElement > > | getInternalElements () |
| Obtain the full list of TransferElements internally used by this TransferElement. | |
| const boost::shared_ptr< TransferElement > & | getHighLevelImplElement () |
| Obtain the highest level implementation TransferElement. | |
| bool | isInitialised () const |
| Return if the accessor is properly initialised. | |
| void | replace (const TransferElementAbstractor &newAccessor) |
| Assign a new accessor to this TransferElementAbstractor. | |
| void | replace (boost::shared_ptr< TransferElement > newImpl) |
| Alternative signature of relace() with the same functionality, used when a pointer to the implementation has been obtained directly (instead of a TransferElementAbstractor). | |
| void | replaceTransferElement (const boost::shared_ptr< TransferElement > &newElement) |
| Search for all underlying TransferElements which are considered identical (see mayReplaceOther()) with the given TransferElement. | |
| void | setPersistentDataStorage (boost::shared_ptr< ChimeraTK::PersistentDataStorage > storage) |
| Associate a persistent data storage object to be updated on each write operation of this ProcessArray. | |
| TransferElementID | getId () const |
| Obtain unique ID for the actual implementation of this TransferElement. | |
| void | setDataValidity (DataValidity valid=DataValidity::ok) |
| Set the current DataValidity for this TransferElement. | |
| DataValidity | dataValidity () const |
| Return current validity of the data. | |
| void | interrupt () |
| Return from a blocking read immediately and throw boost::thread_interrupted. | |
| ReadAnyGroup * | getReadAnyGroup () const |
| Obtain the ReadAnyGroup this TransferElement is part of, or nullptr if not in a ReadAnyGroup. | |
Friends | |
| class | TransferGroup |
Additional Inherited Members | |
Protected Member Functions inherited from ChimeraTK::NDRegisterAccessorAbstractor< UserType > | |
| NDRegisterAccessorAbstractor (boost::shared_ptr< NDRegisterAccessor< UserType > > impl) | |
| NDRegisterAccessor< UserType > * | get () |
| const NDRegisterAccessor< UserType > * | get () const |
Protected Attributes inherited from ChimeraTK::TransferElementAbstractor | |
| boost::shared_ptr< TransferElement > | _impl |
| Untyped pointer to implementation. | |
Accessor class to read and write registers transparently by using the accessor object like a vector of the type UserType.
Conversion to and from the UserType will be handled by a data converter matching the register description in the map (if applicable). Obtain the accessor using the Device::getOneDRegisterAccessor() function.
Note: Transfers between the device and the internal buffer need to be triggered using the read() and write() functions before reading from resp. after writing to the buffer using the operators.
Definition at line 20 of file OneDRegisterAccessor.h.
| using ChimeraTK::OneDRegisterAccessor< UserType >::const_iterator = typename std::vector<UserType>::const_iterator |
Definition at line 55 of file OneDRegisterAccessor.h.
| using ChimeraTK::OneDRegisterAccessor< UserType >::const_reverse_iterator = typename std::vector<UserType>::const_reverse_iterator |
Definition at line 57 of file OneDRegisterAccessor.h.
| using ChimeraTK::OneDRegisterAccessor< UserType >::iterator = typename std::vector<UserType>::iterator |
Definition at line 54 of file OneDRegisterAccessor.h.
| using ChimeraTK::OneDRegisterAccessor< UserType >::reverse_iterator = typename std::vector<UserType>::reverse_iterator |
Definition at line 56 of file OneDRegisterAccessor.h.
| ChimeraTK::OneDRegisterAccessor< UserType >::OneDRegisterAccessor | ( | boost::shared_ptr< NDRegisterAccessor< UserType > > | impl | ) |
Create accessor from pointer to implementation.
Definition at line 129 of file OneDRegisterAccessor.h.
| ChimeraTK::OneDRegisterAccessor< UserType >::OneDRegisterAccessor | ( | ) |
Placeholder constructer, to allow late initialisation of the accessor, e.g.
in the open function.
Definition at line 143 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 58 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 59 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 60 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 63 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 66 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 69 of file OneDRegisterAccessor.h.
|
inline |
Return a direct pointer to the memory buffer storng the elements.
Definition at line 96 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 61 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 62 of file OneDRegisterAccessor.h.
| COOKED_TYPE ChimeraTK::OneDRegisterAccessor< UserType >::getAsCooked | ( | unsigned int | sample | ) |
Get the cooked values in case the accessor is a raw accessor (which does not do data conversion).
This returns the converted data from the use buffer. It does not do any read or write transfer.
Definition at line 186 of file OneDRegisterAccessor.h.
|
inline |
Return number of elements/samples in the register.
Definition at line 51 of file OneDRegisterAccessor.h.
|
inline |
Convert content of (cooked) buffer into std::vector.
Implicit conversion is allowed so one can pass a OneDRegisterAccessor directly when a std::vector is expected.
Definition at line 87 of file OneDRegisterAccessor.h.
| OneDRegisterAccessor< UserType > & ChimeraTK::OneDRegisterAccessor< UserType >::operator= | ( | const std::vector< UserType > & | x | ) |
Copy content of (cooked) buffer from std::vector.
Definition at line 170 of file OneDRegisterAccessor.h.
|
inline |
Get or set buffer content by [] operator.
Definition at line 46 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 64 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 65 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 67 of file OneDRegisterAccessor.h.
|
inline |
Definition at line 68 of file OneDRegisterAccessor.h.
| void ChimeraTK::OneDRegisterAccessor< UserType >::setAsCooked | ( | unsigned int | sample, |
| COOKED_TYPE | value | ||
| ) |
Set the cooked values in case the accessor is a raw accessor (which does not do data conversion).
This converts to raw and writes the data to the user buffer. It does not do any read or write transfer.
Definition at line 198 of file OneDRegisterAccessor.h.
|
noexcept |
Swap content of (cooked) buffer with std::vector.
Definition at line 154 of file OneDRegisterAccessor.h.
| void ChimeraTK::OneDRegisterAccessor< UserType >::writeIfDifferent | ( | const std::vector< UserType > & | newValue, |
| VersionNumber | versionNumber = VersionNumber{nullptr}, |
||
| DataValidity | validity = DataValidity::ok |
||
| ) |
Convenience function to set and write new value if it differes from the current value.
The given version number is only used in case the value differs. If versionNumber == {nullptr}, a new version number is generated only if the write actually takes place.
Definition at line 210 of file OneDRegisterAccessor.h.
|
friend |
Definition at line 120 of file OneDRegisterAccessor.h.