ChimeraTK-DeviceAccess
03.18.00
|
Accessor class to read and write scalar registers transparently by using the accessor object like a variable of the type UserType. More...
#include <ScalarRegisterAccessor.h>
Public Member Functions | |
ScalarRegisterAccessor (boost::shared_ptr< NDRegisterAccessor< UserType >> impl) | |
Create instance from pointer to implementation. More... | |
ScalarRegisterAccessor () | |
Placeholder constructor, to allow late initialisation of the accessor, e.g. More... | |
operator UserType & () | |
Implicit type conversion to UserType& to access the value as a reference. More... | |
operator const UserType & () const | |
Implicit type conversion to const UserType& to access the const reference. More... | |
template<typename OTHER_TAG > | |
operator ScalarRegisterAccessor< UserType, OTHER_TAG > & () | |
Allow free conversion between different TAG template arguments (which is merely used to avoid code duplication in the template specialisation for ChimeraTK::Boolean). More... | |
template<typename OTHER_TAG > | |
operator const ScalarRegisterAccessor< UserType, OTHER_TAG > & () const | |
Allow free conversion between different TAG template arguments (which is merely used to avoid code duplication in the template specialisation for ChimeraTK::Boolean). More... | |
ScalarRegisterAccessor & | operator= (UserType rightHandSide) |
Assignment operator, assigns the first element. More... | |
ScalarRegisterAccessor & | operator++ () |
Pre-increment operator for the first element. More... | |
ScalarRegisterAccessor & | operator-- () |
Pre-decrement operator for the first element. More... | |
UserType | operator++ (int) |
Post-increment operator for the first element. More... | |
UserType | operator-- (int) |
Post-decrement operator for the first element. More... | |
template<typename COOKED_TYPE > | |
COOKED_TYPE | getAsCooked () |
Get the cooked values in case the accessor is a raw accessor (which does not do data conversion). More... | |
template<typename COOKED_TYPE > | |
void | setAsCooked (COOKED_TYPE value) |
Set the cooked values in case the accessor is a raw accessor (which does not do data conversion). More... | |
void | writeIfDifferent (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. More... | |
void | setAndWrite (UserType newValue, VersionNumber versionNumber={}) |
Convenience function to set and write new value. More... | |
UserType | readAndGet () |
Convenience function to read and return a value of UserType. More... | |
Public Member Functions inherited from ChimeraTK::NDRegisterAccessorAbstractor< UserType > | |
NDRegisterAccessorAbstractor ()=default | |
Create an uninitialised abstractor - just for late initialisation. More... | |
NDRegisterAccessorAbstractor (const NDRegisterAccessorAbstractor &)=default | |
Declare that we want the default copy constructor although we delete the assigmnent operator. More... | |
void | replace (const NDRegisterAccessorAbstractor< UserType > &newAccessor) |
Assign a new accessor to this NDRegisterAccessorAbstractor. More... | |
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). More... | |
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!) More... | |
boost::shared_ptr< NDRegisterAccessor< UserType > > | getImpl () |
Public Member Functions inherited from ChimeraTK::TransferElementAbstractor | |
TransferElementAbstractor (boost::shared_ptr< TransferElement > impl) | |
Construct from TransferElement implementation. More... | |
TransferElementAbstractor ()=default | |
Create an uninitialised abstractor - just for late initialisation. More... | |
const std::string & | getName () const |
Returns the name that identifies the process variable. More... | |
const std::string & | getUnit () const |
Returns the engineering unit. More... | |
const std::string & | getDescription () const |
Returns the description of this variable/register. More... | |
const std::type_info & | getValueType () const |
Returns the std::type_info for the value type of this transfer element. More... | |
AccessModeFlags | getAccessModeFlags () const |
Return the AccessModeFlags for this TransferElement. More... | |
void | read () |
Read the data from the device. More... | |
bool | readNonBlocking () |
Read the next value, if available in the input buffer. More... | |
bool | readLatest () |
Read the latest value, discarding any other update since the last read if present. More... | |
ChimeraTK::VersionNumber | getVersionNumber () const |
Returns the version number that is associated with the last transfer (i.e. More... | |
bool | write (ChimeraTK::VersionNumber versionNumber={}) |
Write the data to device. More... | |
bool | writeDestructively (ChimeraTK::VersionNumber versionNumber={}) |
Just like write(), but allows the implementation to destroy the content of the user buffer in the process. More... | |
bool | isReadOnly () const |
Check if transfer element is read only, i.e. More... | |
bool | isReadable () const |
Check if transfer element is readable. More... | |
bool | isWriteable () const |
Check if transfer element is writeable. More... | |
std::vector< boost::shared_ptr< TransferElement > > | getHardwareAccessingElements () |
Obtain the underlying TransferElements with actual hardware access. More... | |
std::list< boost::shared_ptr< TransferElement > > | getInternalElements () |
Obtain the full list of TransferElements internally used by this TransferElement. More... | |
const boost::shared_ptr< TransferElement > & | getHighLevelImplElement () |
Obtain the highest level implementation TransferElement. More... | |
bool | isInitialised () const |
Return if the accessor is properly initialised. More... | |
void | replace (const TransferElementAbstractor &newAccessor) |
Assign a new accessor to this TransferElementAbstractor. More... | |
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). More... | |
void | replaceTransferElement (const boost::shared_ptr< TransferElement > &newElement) |
Search for all underlying TransferElements which are considered identical (see mayReplaceOther()) with the given TransferElement. More... | |
void | setPersistentDataStorage (boost::shared_ptr< ChimeraTK::PersistentDataStorage > storage) |
Associate a persistent data storage object to be updated on each write operation of this ProcessArray. More... | |
TransferElementID | getId () const |
Obtain unique ID for the actual implementation of this TransferElement. More... | |
void | setDataValidity (DataValidity valid=DataValidity::ok) |
Set the current DataValidity for this TransferElement. More... | |
DataValidity | dataValidity () const |
Return current validity of the data. More... | |
void | interrupt () |
Return from a blocking read immediately and throw boost::thread_interrupted. More... | |
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. More... | |
Accessor class to read and write scalar registers transparently by using the accessor object like a variable 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 required. Obtain the accessor using the Device::getScalarRegisterAccessor() 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.
The second template argument TAG is only used to implement the template specialisation for ChimeraTK::Boolean without duplicating all code.
Definition at line 24 of file ScalarRegisterAccessor.h.
ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::ScalarRegisterAccessor | ( | boost::shared_ptr< NDRegisterAccessor< UserType >> | impl | ) |
Create instance from pointer to implementation.
Definition at line 208 of file ScalarRegisterAccessor.h.
ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::ScalarRegisterAccessor |
Placeholder constructor, to allow late initialisation of the accessor, e.g.
in the open function.
Definition at line 217 of file ScalarRegisterAccessor.h.
COOKED_TYPE ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::getAsCooked |
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 user buffer. It does not do any read or write transfer.
Definition at line 261 of file ScalarRegisterAccessor.h.
|
inline |
Allow free conversion between different TAG template arguments (which is merely used to avoid code duplication in the template specialisation for ChimeraTK::Boolean).
Definition at line 65 of file ScalarRegisterAccessor.h.
|
inline |
Implicit type conversion to const UserType& to access the const reference.
Definition at line 49 of file ScalarRegisterAccessor.h.
ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::operator ScalarRegisterAccessor< UserType, OTHER_TAG > & |
Allow free conversion between different TAG template arguments (which is merely used to avoid code duplication in the template specialisation for ChimeraTK::Boolean).
Definition at line 227 of file ScalarRegisterAccessor.h.
|
inline |
Implicit type conversion to UserType& to access the value as a reference.
Definition at line 45 of file ScalarRegisterAccessor.h.
|
inline |
Pre-increment operator for the first element.
Definition at line 73 of file ScalarRegisterAccessor.h.
UserType ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::operator++ | ( | int | ) |
Post-increment operator for the first element.
Definition at line 242 of file ScalarRegisterAccessor.h.
|
inline |
Pre-decrement operator for the first element.
Definition at line 76 of file ScalarRegisterAccessor.h.
UserType ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::operator-- | ( | int | ) |
Post-decrement operator for the first element.
Definition at line 251 of file ScalarRegisterAccessor.h.
ScalarRegisterAccessor< UserType, TAG > & ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::operator= | ( | UserType | rightHandSide | ) |
Assignment operator, assigns the first element.
Definition at line 234 of file ScalarRegisterAccessor.h.
UserType ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::readAndGet |
Convenience function to read and return a value of UserType.
Definition at line 300 of file ScalarRegisterAccessor.h.
void ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::setAndWrite | ( | UserType | newValue, |
VersionNumber | versionNumber = {} |
||
) |
Convenience function to set and write new value.
The given version number. If versionNumber == {}, a new version number is generated.
Definition at line 292 of file ScalarRegisterAccessor.h.
void ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::setAsCooked | ( | 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 269 of file ScalarRegisterAccessor.h.
void ChimeraTK::ScalarRegisterAccessor< UserType, TAG >::writeIfDifferent | ( | 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 276 of file ScalarRegisterAccessor.h.
|
friend |
Definition at line 119 of file ScalarRegisterAccessor.h.