ChimeraTK-DeviceAccess 03.20.00
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CountingDecorator< T > Struct Template Reference
+ Inheritance diagram for CountingDecorator< T >:
+ Collaboration diagram for CountingDecorator< T >:

Public Member Functions

 CountingDecorator (const boost::shared_ptr< ChimeraTK::TransferElement > &target, bool _fakeLowLevel=false)
 
void doPreRead (TransferType type) override
 Backend specific implementation of preRead().
 
void doPostRead (TransferType type, bool hasNewData) override
 Backend specific implementation of postRead().
 
void doPreWrite (TransferType type, VersionNumber versionNumber) override
 Backend specific implementation of preWrite().
 
void doPostWrite (TransferType type, VersionNumber versionNumber) override
 Backend specific implementation of postWrite().
 
void doReadTransferSynchronously () override
 Implementation version of readTransfer() for synchronous reads.
 
bool doWriteTransfer (ChimeraTK::VersionNumber versionNumber) override
 Implementation version of writeTransfer().
 
std::vector< boost::shared_ptr< ChimeraTK::TransferElement > > getHardwareAccessingElements () override
 Obtain the underlying TransferElements with actual hardware access.
 
void replaceTransferElement (boost::shared_ptr< TransferElement > newElement) override
 Search for all underlying TransferElements which are considered identical (see sameRegister()) with the given TransferElement.
 
std::list< boost::shared_ptr< TransferElement > > getInternalElements () override
 Obtain the full list of TransferElements internally used by this TransferElement.
 
bool mayReplaceOther (const boost::shared_ptr< TransferElement const > &other) const override
 Check whether the TransferElement can be used in places where the TransferElement "other" is currently used, e.g.
 
void resetCounters ()
 
- Public Member Functions inherited from ChimeraTK::NDRegisterAccessorDecorator< T >
 NDRegisterAccessorDecorator (const boost::shared_ptr< ChimeraTK::NDRegisterAccessor< T > > &target)
 
bool doWriteTransfer (ChimeraTK::VersionNumber versionNumber) override
 Implementation version of writeTransfer().
 
bool doWriteTransferDestructively (ChimeraTK::VersionNumber versionNumber) override
 Implementation version of writeTransferDestructively().
 
void doReadTransferSynchronously () override
 Implementation version of readTransfer() for synchronous reads.
 
void doPreRead (TransferType type) override
 Backend specific implementation of preRead().
 
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.
 
std::vector< boost::shared_ptr< ChimeraTK::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.
 
void setPersistentDataStorage (boost::shared_ptr< ChimeraTK::PersistentDataStorage > storage) override
 Associate a persistent data storage object to be updated on each write operation of this ProcessArray.
 
void setInReadAnyGroup (ReadAnyGroup *rag) override
 Set the ReadAnyGroup of which this TransferElement is part of.
 
void replaceTransferElement (boost::shared_ptr< ChimeraTK::TransferElement > newElement) override
 
boost::shared_ptr< NDRegisterAccessor< T > > decorateDeepInside (std::function< boost::shared_ptr< NDRegisterAccessor< T > >(const boost::shared_ptr< NDRegisterAccessor< T > > &)> factory) override
 Decorate the innermost TransferElement of the stack of decorators or decorator-like accessors.
 
void setExceptionBackend (boost::shared_ptr< DeviceBackend > exceptionBackend) override
 Set the backend to which the exception has to be reported.
 
void interrupt () override
 Return from a blocking read immediately and throw boost::thread_interrupted.
 

Public Attributes

bool fakeLowLevel
 
size_t nPreRead {0}
 
size_t nPostRead {0}
 
size_t nPreWrite {0}
 
size_t nPostWrite {0}
 
size_t nRead {0}
 
size_t nReadNonBlocking {0}
 
size_t nReadLatest {0}
 
size_t nWrite {0}
 

Additional Inherited Members

- Protected Member Functions inherited from ChimeraTK::NDRegisterAccessorDecorator< T >
void initFromTarget (const boost::shared_ptr< ChimeraTK::NDRegisterAccessor< T > > &target)
 

Detailed Description

template<typename T>
struct CountingDecorator< T >

Definition at line 728 of file testTransferGroup.cpp.

Constructor & Destructor Documentation

◆ CountingDecorator()

template<typename T >
CountingDecorator< T >::CountingDecorator ( const boost::shared_ptr< ChimeraTK::TransferElement > &  target,
bool  _fakeLowLevel = false 
)
inline

Definition at line 731 of file testTransferGroup.cpp.

Member Function Documentation

◆ doPostRead()

template<typename T >
void CountingDecorator< T >::doPostRead ( TransferType  ,
bool   
)
inlineoverridevirtual

Backend specific implementation of postRead().

postRead() 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.

Notes for backend implementations:

  • If the flag updateDataBuffer is false, the data buffer must stay unaltered. Full implementations (backends) must also leave the meta data (version number and data validity) unchanged. Decorators are allowed to change the meta data (for instance set the DataValidity::faulty).

Reimplemented from ChimeraTK::TransferElement.

Definition at line 744 of file testTransferGroup.cpp.

◆ doPostWrite()

template<typename T >
void CountingDecorator< T >::doPostWrite ( TransferType  ,
VersionNumber   
)
inlineoverridevirtual

Backend specific implementation of postWrite().

postWrite() 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 754 of file testTransferGroup.cpp.

◆ doPreRead()

template<typename T >
void CountingDecorator< T >::doPreRead ( TransferType  )
inlineoverridevirtual

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 739 of file testTransferGroup.cpp.

◆ doPreWrite()

template<typename T >
void CountingDecorator< T >::doPreWrite ( TransferType  ,
VersionNumber   
)
inlineoverridevirtual

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 749 of file testTransferGroup.cpp.

◆ doReadTransferSynchronously()

template<typename T >
void CountingDecorator< T >::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 759 of file testTransferGroup.cpp.

◆ doWriteTransfer()

template<typename T >
bool CountingDecorator< T >::doWriteTransfer ( ChimeraTK::VersionNumber  versionNumber)
inlineoverridevirtual

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 764 of file testTransferGroup.cpp.

◆ getHardwareAccessingElements()

template<typename T >
std::vector< boost::shared_ptr< ChimeraTK::TransferElement > > CountingDecorator< T >::getHardwareAccessingElements ( )
inlineoverridevirtual

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 769 of file testTransferGroup.cpp.

◆ getInternalElements()

template<typename T >
std::list< boost::shared_ptr< TransferElement > > CountingDecorator< T >::getInternalElements ( )
inlineoverridevirtual

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 788 of file testTransferGroup.cpp.

◆ mayReplaceOther()

template<typename T >
bool CountingDecorator< T >::mayReplaceOther ( const boost::shared_ptr< TransferElement const > &  other) const
inlineoverridevirtual

Check whether the TransferElement can be used in places where the TransferElement "other" is currently used, e.g.

to merge the two transfers. This function must be used in replaceTransferElement() by implementations which use other TransferElements, to determine if a used TransferElement shall be replaced with the TransferElement "other".

The purpose of this function is not to determine if at any point in the hierarchy an replacement could be done. This function only works on a single level. It is not used by the TransferGroup to determine replaceTransferElement() whether shall be used (it is always called). Instead this function can be used by decorators etc. inside their implementation of replaceTransferElement() to determine if they might swap their implementation(s).

Note for decorators and similar implementations: This function must not be decorated. It should only return true if this should actually be replaced with other in the call to replaceTransferElement() one level up in the hierarchy. If the replacement should be done further down in the hierarchy, simply return false. It should only return if other is fully identical to this (i.e. behaves identical in all situations but might be another instance).

Reimplemented from ChimeraTK::TransferElement.

Definition at line 797 of file testTransferGroup.cpp.

◆ replaceTransferElement()

template<typename T >
void CountingDecorator< T >::replaceTransferElement ( boost::shared_ptr< TransferElement newElement)
inlineoverridevirtual

Search for all underlying TransferElements which are considered identical (see sameRegister()) with the given TransferElement.

These TransferElements are then replaced with the new element. If no underlying element matches the new element, this function has no effect.

Reimplemented from ChimeraTK::TransferElement.

Definition at line 778 of file testTransferGroup.cpp.

◆ resetCounters()

template<typename T >
void CountingDecorator< T >::resetCounters ( )
inline

Definition at line 805 of file testTransferGroup.cpp.

Member Data Documentation

◆ fakeLowLevel

template<typename T >
bool CountingDecorator< T >::fakeLowLevel

Definition at line 816 of file testTransferGroup.cpp.

◆ nPostRead

template<typename T >
size_t CountingDecorator< T >::nPostRead {0}

Definition at line 818 of file testTransferGroup.cpp.

◆ nPostWrite

template<typename T >
size_t CountingDecorator< T >::nPostWrite {0}

Definition at line 820 of file testTransferGroup.cpp.

◆ nPreRead

template<typename T >
size_t CountingDecorator< T >::nPreRead {0}

Definition at line 817 of file testTransferGroup.cpp.

◆ nPreWrite

template<typename T >
size_t CountingDecorator< T >::nPreWrite {0}

Definition at line 819 of file testTransferGroup.cpp.

◆ nRead

template<typename T >
size_t CountingDecorator< T >::nRead {0}

Definition at line 821 of file testTransferGroup.cpp.

◆ nReadLatest

template<typename T >
size_t CountingDecorator< T >::nReadLatest {0}

Definition at line 823 of file testTransferGroup.cpp.

◆ nReadNonBlocking

template<typename T >
size_t CountingDecorator< T >::nReadNonBlocking {0}

Definition at line 822 of file testTransferGroup.cpp.

◆ nWrite

template<typename T >
size_t CountingDecorator< T >::nWrite {0}

Definition at line 824 of file testTransferGroup.cpp.


The documentation for this struct was generated from the following file: