ChimeraTK-DeviceAccess 03.20.00
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChimeraTK::DummyInterruptTriggerAccessor< UserType > Class Template Reference

The DummyInterruptTriggerAccessor class. More...

#include <DummyInterruptTriggerAccessor.h>

+ Inheritance diagram for ChimeraTK::DummyInterruptTriggerAccessor< UserType >:
+ Collaboration diagram for ChimeraTK::DummyInterruptTriggerAccessor< UserType >:

Public Member Functions

 DummyInterruptTriggerAccessor (boost::shared_ptr< DeviceBackend > backend, std::function< VersionNumber(void)> interruptTrigger, const RegisterPath &registerPathName, size_t numberOfElements=1, size_t elementsOffset=0, const AccessModeFlags &flags={})
 
bool doWriteTransfer (ChimeraTK::VersionNumber) override
 Implementation version of writeTransfer().
 
void doReadTransferSynchronously () override
 Implementation version of readTransfer() for synchronous reads.
 
void doPreRead (TransferType) override
 Backend specific implementation of preRead().
 
void doPreWrite (TransferType, VersionNumber) override
 Backend specific implementation of preWrite().
 
bool isReadOnly () const override
 Check if transfer element is read only, i.e.
 
bool isReadable () const override
 Check if transfer element is readable.
 
bool isWriteable () const override
 Check if transfer element is writeable.
 
- Public Member Functions inherited from ChimeraTK::NDRegisterAccessor< UserType >
 NDRegisterAccessor (std::string const &name, AccessModeFlags accessModeFlags, std::string const &unit=std::string(TransferElement::unitNotSet), std::string const &description=std::string())
 Creates an NDRegisterAccessor with the specified name (passed on to the transfer element).
 
UserType & accessData (size_t sample)
 Get or set register accessor's buffer content (1D version).
 
const UserType & accessData (size_t sample) const
 
UserType & accessData (unsigned int channel, unsigned int sample)
 Get or set register accessor's buffer content (2D version).
 
const UserType & accessData (unsigned int channel, unsigned int sample) const
 
std::vector< UserType > & accessChannel (unsigned int channel)
 Get or set register accessor's channel vector.
 
const std::vector< UserType > & accessChannel (unsigned int channel) const
 
std::vector< std::vector< UserType > > & accessChannels ()
 Get or set register accessor's 2D channel vector.
 
const std::vector< std::vector< UserType > > & accessChannels () const
 
unsigned int getNumberOfSamples () const
 Return number of elements per channel.
 
unsigned int getNumberOfChannels () const
 Return number of channels.
 
const std::type_info & getValueType () const override
 Returns the std::type_info for the value type of this transfer element.
 
template<typename COOKED_TYPE >
COOKED_TYPE getAsCooked (unsigned int channel, unsigned int sample) const
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (getAsCooked_impl, T const(unsigned int, unsigned int))
 
template<typename COOKED_TYPE >
COOKED_TYPE getAsCooked_impl (unsigned int channel, unsigned int sample) const
 
template<typename COOKED_TYPE >
void setAsCooked (unsigned int channel, unsigned int sample, COOKED_TYPE value)
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (setAsCooked_impl, void(unsigned int, unsigned int, T))
 
template<typename COOKED_TYPE >
void setAsCooked_impl (unsigned int channel, unsigned int sample, COOKED_TYPE value)
 
boost::shared_ptr< TransferElementmakeCopyRegisterDecorator () override
 Create a CopyRegisterDecorator of the right type decorating this TransferElement.
 
virtual boost::shared_ptr< NDRegisterAccessor< UserType > > decorateDeepInside (std::function< boost::shared_ptr< NDRegisterAccessor< UserType > >(const boost::shared_ptr< NDRegisterAccessor< UserType > > &)> factory)
 Decorate the innermost TransferElement of the stack of decorators or decorator-like accessors.
 
- Public Member Functions inherited from ChimeraTK::TransferElement
 TransferElement (std::string name, AccessModeFlags accessModeFlags, std::string unit=std::string(unitNotSet), std::string description=std::string())
 Creates a transfer element with the specified name.
 
 TransferElement (const TransferElement &other)=delete
 Copying and moving is not allowed.
 
 TransferElement (TransferElement &&other)=delete
 
TransferElementoperator= (const TransferElement &other)=delete
 
TransferElementoperator= (TransferElement &&other)=delete
 
virtual ~TransferElement ()=default
 Abstract base classes need a virtual destructor.
 
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.
 
AccessModeFlags getAccessModeFlags () const
 Return the AccessModeFlags for this TransferElement.
 
void setDataValidity (DataValidity validity=DataValidity::ok)
 Set the current DataValidity for this TransferElement.
 
DataValidity dataValidity () const
 Return current validity of the data.
 
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.
 
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.
 
ChimeraTK::VersionNumber getVersionNumber () const
 Returns the version number that is associated with the last transfer (i.e.
 
void setActiveException (std::exception_ptr &setThisException)
 Set an active exception.
 
virtual void setExceptionBackend (boost::shared_ptr< DeviceBackend > exceptionBackend)
 Set the backend to which the exception has to be reported.
 
boost::shared_ptr< DeviceBackendgetExceptionBackend ()
 Return the exception backend.
 
cppext::future_queue< void > getReadQueue ()
 Function to get a copy of the read queue.
 
void readTransfer ()
 Read the data from the device but do not fill it into the user buffer of this TransferElement.
 
bool readTransferNonBlocking ()
 Read the data from the device but do not fill it into the user buffer of this TransferElement.
 
void preRead (TransferType type)
 Perform any pre-read tasks if necessary.
 
void postRead (TransferType type, bool updateDataBuffer)
 Transfer the data from the device receive buffer into the user buffer, while converting the data into the user data format if needed.
 
void preWrite (TransferType type, ChimeraTK::VersionNumber versionNumber)
 Transfer the data from the user buffer into the device send buffer, while converting the data from then user data format if needed.
 
void postWrite (TransferType type, VersionNumber versionNumber)
 Perform any post-write clean-ups if necessary.
 
bool writeTransfer (ChimeraTK::VersionNumber versionNumber)
 Write the data to the device.
 
bool writeTransferDestructively (ChimeraTK::VersionNumber versionNumber)
 Write the data to the device.
 
virtual bool mayReplaceOther (const boost::shared_ptr< TransferElement const > &other) const
 Check whether the TransferElement can be used in places where the TransferElement "other" is currently used, e.g.
 
virtual boost::shared_ptr< TransferElementgetHighLevelImplElement ()
 Obtain the highest level implementation TransferElement.
 
virtual void replaceTransferElement (boost::shared_ptr< TransferElement > newElement)
 Search for all underlying TransferElements which are considered identical (see sameRegister()) with the given TransferElement.
 
virtual void setPersistentDataStorage (boost::shared_ptr< ChimeraTK::PersistentDataStorage >)
 Associate a persistent data storage object to be updated on each write operation of this ProcessArray.
 
TransferElementID getId () const
 Obtain unique ID for this TransferElement, see TransferElementID for details.
 
virtual void interrupt ()
 Return from a blocking read immediately and throw boost::thread_interrupted.
 
template<typename QUEUE_TYPE >
void interrupt_impl (QUEUE_TYPE &dataTransportQueue)
 Implementation of interrupt()
 
bool isReadTransactionInProgress () const
 Check whether a read transaction is in progress, i.e.
 
bool isWriteTransactionInProgress () const
 Check whether a write transaction is in progress, i.e.
 
ReadAnyGroupgetReadAnyGroup () const
 Obtain the ReadAnyGroup this TransferElement is part of, or nullptr if not in a ReadAnyGroup.
 
virtual void setInReadAnyGroup (ReadAnyGroup *rag)
 Set the ReadAnyGroup of which this TransferElement is part of.
 

Protected Member Functions

std::vector< boost::shared_ptr< TransferElement > > getHardwareAccessingElements () override
 Obtain the underlying TransferElements with actual hardware access.
 
std::list< boost::shared_ptr< TransferElement > > getInternalElements () override
 Obtain the full list of TransferElements internally used by this TransferElement.
 
- Protected Member Functions inherited from ChimeraTK::NDRegisterAccessor< UserType >
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER (NDRegisterAccessor< UserType >, getAsCooked_impl, 2)
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER (NDRegisterAccessor< UserType >, setAsCooked_impl, 3)
 
- Protected Member Functions inherited from ChimeraTK::TransferElement
virtual void doPostRead (TransferType, bool)
 Backend specific implementation of postRead().
 
virtual void doPostWrite (TransferType, VersionNumber)
 Backend specific implementation of postWrite().
 
virtual bool doWriteTransferDestructively (ChimeraTK::VersionNumber versionNumber)
 Implementation version of writeTransferDestructively().
 
void makeUniqueId ()
 Allow generating a unique ID from derived classes.
 

Additional Inherited Members

- Public Types inherited from ChimeraTK::TransferElement
using SharedPtr = boost::shared_ptr< TransferElement >
 A typedef for more compact syntax.
 
- Static Public Attributes inherited from ChimeraTK::TransferElement
static constexpr char unitNotSet [] = "n./a."
 Constant string to be used as a unit when the unit is not provided or known.
 
- Protected Attributes inherited from ChimeraTK::NDRegisterAccessor< UserType >
std::vector< std::vector< UserType > > buffer_2D
 Buffer of converted data elements.
 
- Protected Attributes inherited from ChimeraTK::TransferElement
boost::shared_ptr< DeviceBackend_exceptionBackend
 The backend to which the runtime_errors are reported via DeviceBackend::setException().
 
std::string _name
 Identifier uniquely identifying the TransferElement.
 
std::string _unit
 Engineering unit.
 
std::string _description
 Description of this variable/register.
 
TransferElementID _id
 The ID of this TransferElement.
 
bool _isInTransferGroup {false}
 Flag whether this TransferElement has been added to a TransferGroup or not.
 
ReadAnyGroup_inReadAnyGroup {nullptr}
 ReadAnyGroup this TransferElement has been added to, nullptr if not in a ReadAnyGroup.
 
AccessModeFlags _accessModeFlags
 The access mode flags for this transfer element.
 
cppext::future_queue< void > _readQueue
 The queue for asynchronous read transfers.
 
VersionNumber _versionNumber {nullptr}
 The version number of the last successful transfer.
 
DataValidity _dataValidity {DataValidity::ok}
 The validity of the data in the application buffer.
 
std::exception_ptr _activeException {nullptr}
 Exception to be rethrown in postXXX() in case hasSeenException == true Can be set via setActiveException().
 

Detailed Description

template<typename UserType>
class ChimeraTK::DummyInterruptTriggerAccessor< UserType >

The DummyInterruptTriggerAccessor class.

Pseudo-accessor for the hidden DUMMY_INTERRUPT_X_Y register that can be used to trigger the interrupt Y on interrupt controller X. This will do nothing but call DummyBackendBase::triggerInterrupt() when written to. For backwards compatibility it can also be read from, but there is only a constant value available.

Definition at line 21 of file DummyInterruptTriggerAccessor.h.

Constructor & Destructor Documentation

◆ DummyInterruptTriggerAccessor()

template<typename UserType >
ChimeraTK::DummyInterruptTriggerAccessor< UserType >::DummyInterruptTriggerAccessor ( boost::shared_ptr< DeviceBackend backend,
std::function< VersionNumber(void)>  interruptTrigger,
const RegisterPath registerPathName,
size_t  numberOfElements = 1,
size_t  elementsOffset = 0,
const AccessModeFlags flags = {} 
)

Definition at line 13 of file DummyInterruptTriggerAccessor.cc.

Member Function Documentation

◆ doPreRead()

template<typename UserType >
void ChimeraTK::DummyInterruptTriggerAccessor< UserType >::doPreRead ( TransferType  )
overridevirtual

Backend specific implementation of preRead().

preRead() will call this function, but it will make sure that it gets called only once per transfer.

No actual communication may be done. Hence, no runtime_error exception may be thrown by this function. Also it must be acceptable to call this function while the device is closed or not functional (see isFunctional()) and no exception is thrown.

Reimplemented from ChimeraTK::TransferElement.

Definition at line 47 of file DummyInterruptTriggerAccessor.cc.

◆ doPreWrite()

template<typename UserType >
void ChimeraTK::DummyInterruptTriggerAccessor< UserType >::doPreWrite ( TransferType  ,
VersionNumber   
)
overridevirtual

Backend specific implementation of preWrite().

preWrite() will call this function, but it will make sure that it gets called only once per transfer.

No actual communication may be done. Hence, no runtime_error exception may be thrown by this function. Also it must be acceptable to call this function while the device is closed or not functional (see isFunctional()) and no exception is thrown.

Reimplemented from ChimeraTK::TransferElement.

Definition at line 54 of file DummyInterruptTriggerAccessor.cc.

◆ doReadTransferSynchronously()

template<typename UserType >
void ChimeraTK::DummyInterruptTriggerAccessor< UserType >::doReadTransferSynchronously ( )
inlineoverridevirtual

Implementation version of readTransfer() for synchronous reads.

This function must be implemented by the backend. For the functional description read the documentation of readTransfer().

Implementation notes:

  • This function must return within ~1 second after both boost::thread::interrupt() (on the thread calling this function) and TransferElement::interrupt() have been called (reliable termination requires both calls; implementation needs to react to one of the call only).
  • Decorators must delegate the call to readTransfer() of the decorated target.
  • Delegations within the same object should go to the "do" version, e.g. to BaseClass::doReadTransferSynchronously()

Implements ChimeraTK::TransferElement.

Definition at line 29 of file DummyInterruptTriggerAccessor.h.

◆ doWriteTransfer()

template<typename UserType >
bool ChimeraTK::DummyInterruptTriggerAccessor< UserType >::doWriteTransfer ( ChimeraTK::VersionNumber  versionNumber)
overridevirtual

Implementation version of writeTransfer().

This function must be implemented by the backend. For the functional description read the documentation of writeTransfer().

Implementation notes:

  • Decorators must delegate the call to writeTransfer() of the decorated target.

Implements ChimeraTK::TransferElement.

Definition at line 38 of file DummyInterruptTriggerAccessor.cc.

◆ getHardwareAccessingElements()

template<typename UserType >
std::vector< boost::shared_ptr< TransferElement > > ChimeraTK::DummyInterruptTriggerAccessor< UserType >::getHardwareAccessingElements ( )
inlineoverrideprotectedvirtual

Obtain the underlying TransferElements with actual hardware access.

If this transfer element is directly reading from / writing to the hardware, it will return a list just containing a shared pointer of itself.

Note: Avoid using this in application code, since it will break the abstraction!

Implements ChimeraTK::TransferElement.

Definition at line 40 of file DummyInterruptTriggerAccessor.h.

◆ getInternalElements()

template<typename UserType >
std::list< boost::shared_ptr< TransferElement > > ChimeraTK::DummyInterruptTriggerAccessor< UserType >::getInternalElements ( )
inlineoverrideprotectedvirtual

Obtain the full list of TransferElements internally used by this TransferElement.

The function is recursive, i.e. elements used by the elements returned by this function are also added to the list. It is guaranteed that the directly used elements are first in the list and the result from recursion is appended to the list.

Example: A decorator would return a list with its target TransferElement followed by the result of getInternalElements() called on its target TransferElement.

If this TransferElement is not using any other element, it should return an empty vector. Thus those elements which return a list just containing themselves in getHardwareAccessingElements() will return an empty list here in getInternalElements().

Note: Avoid using this in application code, since it will break the abstraction!

Implements ChimeraTK::TransferElement.

Definition at line 44 of file DummyInterruptTriggerAccessor.h.

◆ isReadable()

template<typename UserType >
bool ChimeraTK::DummyInterruptTriggerAccessor< UserType >::isReadable ( ) const
inlineoverridevirtual

Check if transfer element is readable.

It throws an exception if you try to read and isReadable() is not true.

Implements ChimeraTK::TransferElement.

Definition at line 36 of file DummyInterruptTriggerAccessor.h.

◆ isReadOnly()

template<typename UserType >
bool ChimeraTK::DummyInterruptTriggerAccessor< UserType >::isReadOnly ( ) const
inlineoverridevirtual

Check if transfer element is read only, i.e.

it is readable but not writeable.

Implements ChimeraTK::TransferElement.

Definition at line 35 of file DummyInterruptTriggerAccessor.h.

◆ isWriteable()

template<typename UserType >
bool ChimeraTK::DummyInterruptTriggerAccessor< UserType >::isWriteable ( ) const
inlineoverridevirtual

Check if transfer element is writeable.

It throws an exception if you try to write and isWriteable() is not true.

Implements ChimeraTK::TransferElement.

Definition at line 37 of file DummyInterruptTriggerAccessor.h.


The documentation for this class was generated from the following files: