ChimeraTK-DeviceAccess  03.18.00
ChimeraTK::async::AsyncVariableImpl< UserType > Struct Template Reference

AsyncVariableImpl contains a weak pointer to an AsyncNDRegisterAccessor<UserType> and a send buffer NDRegisterAccessor<UserType>::Buffer. More...

#include <AsyncAccessorManager.h>

+ Inheritance diagram for ChimeraTK::async::AsyncVariableImpl< UserType >:
+ Collaboration diagram for ChimeraTK::async::AsyncVariableImpl< UserType >:

Public Member Functions

 AsyncVariableImpl (size_t nChannels, size_t nElements)
 
void send () final
 Send the value from the _sendBuffer of the AsyncVariableImpl. More...
 
void sendException (std::exception_ptr e) final
 Send an exception to all subscribers. More...
 
unsigned int getNumberOfChannels () override
 Helper functions for the creation of an AsyncNDRegisterAccessor. More...
 
unsigned int getNumberOfSamples () override
 
- Public Member Functions inherited from ChimeraTK::async::AsyncVariable
virtual ~AsyncVariable ()=default
 
virtual const std::string & getUnit ()=0
 
virtual const std::string & getDescription ()=0
 
virtual void fillSendBuffer ()=0
 Fill the send buffer with data and version number. More...
 

Public Attributes

NDRegisterAccessor< UserType >::Buffer _sendBuffer
 

Detailed Description

template<typename UserType>
struct ChimeraTK::async::AsyncVariableImpl< UserType >

AsyncVariableImpl contains a weak pointer to an AsyncNDRegisterAccessor<UserType> and a send buffer NDRegisterAccessor<UserType>::Buffer.

This class provides implementation for those functions of the AsyncVariable which touch the AsyncNDRegisterAccessor. It does implement the functions which provide the information needed to create an AsyncNDRegisterAccessor, like getNumberOfChannels(). These are backend specific and need a dedicated implementation per backend.

The AsyncVariableManager cannot hold a shared pointer of the AsyncNDRegisterAccessor because then you could never get rid of a created accessor, which means the manager would just keep growing in memory if accessors are dynamically created and removed. Hence a weak pointer is used, and this class provides all the functions that access this weak pointer and do all the locking and nullptr checking.

Definition at line 166 of file AsyncAccessorManager.h.

Constructor & Destructor Documentation

◆ AsyncVariableImpl()

template<typename UserType >
ChimeraTK::async::AsyncVariableImpl< UserType >::AsyncVariableImpl ( size_t  nChannels,
size_t  nElements 
)

Definition at line 212 of file AsyncAccessorManager.h.

Member Function Documentation

◆ getNumberOfChannels()

template<typename UserType >
unsigned int ChimeraTK::async::AsyncVariableImpl< UserType >::getNumberOfChannels ( )
overridevirtual

Helper functions for the creation of an AsyncNDRegisterAccessor.

As the creating code cannot use the catalogue, each backend has to implement these functions appropriately.

Implements ChimeraTK::async::AsyncVariable.

Reimplemented in ChimeraTK::async::PolledAsyncVariable< UserType >.

Definition at line 197 of file AsyncAccessorManager.h.

◆ getNumberOfSamples()

template<typename UserType >
unsigned int ChimeraTK::async::AsyncVariableImpl< UserType >::getNumberOfSamples
overridevirtual

◆ send()

template<typename UserType >
void ChimeraTK::async::AsyncVariableImpl< UserType >::send ( )
finalvirtual

Send the value from the _sendBuffer of the AsyncVariableImpl.

The buffer has to be prepared before calling this function (incl. version number and data validity flag). The buffer is swapped out to avoid unnecessary copies. If you need a copy, you have to make one before calling this function.

Implements ChimeraTK::async::AsyncVariable.

Definition at line 217 of file AsyncAccessorManager.h.

◆ sendException()

template<typename UserType >
void ChimeraTK::async::AsyncVariableImpl< UserType >::sendException ( std::exception_ptr  e)
finalvirtual

Send an exception to all subscribers.

Must only be called from within deactivateAsyncAndExecute().

Implements ChimeraTK::async::AsyncVariable.

Definition at line 188 of file AsyncAccessorManager.h.

Member Data Documentation

◆ _sendBuffer

template<typename UserType >
NDRegisterAccessor<UserType>::Buffer ChimeraTK::async::AsyncVariableImpl< UserType >::_sendBuffer

Definition at line 174 of file AsyncAccessorManager.h.


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