ChimeraTK-DeviceAccess  03.18.00
ChimeraTK::async::DomainImpl< BackendDataType > Class Template Reference

#include <DomainImpl.h>

+ Inheritance diagram for ChimeraTK::async::DomainImpl< BackendDataType >:
+ Collaboration diagram for ChimeraTK::async::DomainImpl< BackendDataType >:

Public Member Functions

 DomainImpl (boost::shared_ptr< DeviceBackend > backend, size_t domainId)
 
VersionNumber distribute (BackendDataType data, VersionNumber version=VersionNumber{nullptr})
 Distribute the data via the associated distribution tree. More...
 
VersionNumber activate (BackendDataType data, VersionNumber version=VersionNumber{nullptr})
 Activate and distribute the initial value. More...
 
void deactivate () override
 
void sendException (const std::exception_ptr &e) noexcept override
 
template<typename UserDataType >
boost::shared_ptr< AsyncNDRegisterAccessor< UserDataType > > subscribe (RegisterPath name, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags)
 
- Public Member Functions inherited from ChimeraTK::async::Domain
virtual ~Domain ()=default
 
std::lock_guard< std::mutex > getDomainLock ()
 

Protected Attributes

boost::weak_ptr< SubDomain< BackendDataType > > _subDomain
 
boost::shared_ptr< DeviceBackend_backend
 
size_t _id
 
BackendDataType _notDistributedData
 
VersionNumber _notDistributedVersion {nullptr}
 
VersionNumber _activationVersion {nullptr}
 
- Protected Attributes inherited from ChimeraTK::async::Domain
std::mutex _mutex
 
bool _isActive {false}
 

Additional Inherited Members

- Protected Member Functions inherited from ChimeraTK::async::Domain
bool unsafeGetIsActive () const
 Friend classes are allowed to read the _isActiveFlag without acquiring the mutex. More...
 

Detailed Description

template<typename BackendDataType>
class ChimeraTK::async::DomainImpl< BackendDataType >

Definition at line 15 of file DomainImpl.h.

Constructor & Destructor Documentation

◆ DomainImpl()

template<typename BackendDataType >
ChimeraTK::async::DomainImpl< BackendDataType >::DomainImpl ( boost::shared_ptr< DeviceBackend backend,
size_t  domainId 
)
inline

Definition at line 17 of file DomainImpl.h.

Member Function Documentation

◆ activate()

template<typename BackendDataType >
VersionNumber ChimeraTK::async::DomainImpl< BackendDataType >::activate ( BackendDataType  data,
VersionNumber  version = VersionNumber{nullptr} 
)

Activate and distribute the initial value.

If the backend can determine a version number from the data, it has to do this before calling distribute and give the version as an argument. Otherwise a new version is created under the domain lock.

In case distribute has been called before with a version number newer than the version of the polled initial value, these data and version number are distributed instead.

@ return The version number that has been used for distribution.

Definition at line 105 of file DomainImpl.h.

◆ deactivate()

template<typename BackendDataType >
void ChimeraTK::async::DomainImpl< BackendDataType >::deactivate
overridevirtual

Implements ChimeraTK::async::Domain.

Definition at line 134 of file DomainImpl.h.

◆ distribute()

template<typename BackendDataType >
VersionNumber ChimeraTK::async::DomainImpl< BackendDataType >::distribute ( BackendDataType  data,
VersionNumber  version = VersionNumber{nullptr} 
)

Distribute the data via the associated distribution tree.

If the backend can determine a version number from the data, it has to do this before calling distribute and give the version as an argument. Otherwise a new version is created under the domain lock.

As the asynchronous subscription with its thread has to be started before activate() is called, it can happen that distribute with newer data and a newer version number is called before activate is called with the initial value. In this case, the data is stored and no data is distributed. The data will later be distributed during activation instead of the older polled initial value. If data is stored for delayed distribution, the return value is VersionNumber{nullptr}.

In case distribute() is called after activate(), with a version number older than the polled initial value, the data is dropped and not distributed. In this case the return value is VersionNumber{nullptr}.

@ return The version number that has been used for distribution, or VersionNumber{nullptr} if there was no distribution.

Definition at line 75 of file DomainImpl.h.

◆ sendException()

template<typename BackendDataType >
void ChimeraTK::async::DomainImpl< BackendDataType >::sendException ( const std::exception_ptr &  e)
overridevirtualnoexcept

Implements ChimeraTK::async::Domain.

Definition at line 143 of file DomainImpl.h.

◆ subscribe()

template<typename BackendDataType >
template<typename UserDataType >
boost::shared_ptr< AsyncNDRegisterAccessor< UserDataType > > ChimeraTK::async::DomainImpl< BackendDataType >::subscribe ( RegisterPath  name,
size_t  numberOfWords,
size_t  wordOffsetInRegister,
AccessModeFlags  flags 
)

Definition at line 164 of file DomainImpl.h.

Member Data Documentation

◆ _activationVersion

template<typename BackendDataType >
VersionNumber ChimeraTK::async::DomainImpl< BackendDataType >::_activationVersion {nullptr}
protected

Definition at line 69 of file DomainImpl.h.

◆ _backend

template<typename BackendDataType >
boost::shared_ptr<DeviceBackend> ChimeraTK::async::DomainImpl< BackendDataType >::_backend
protected

Definition at line 63 of file DomainImpl.h.

◆ _id

template<typename BackendDataType >
size_t ChimeraTK::async::DomainImpl< BackendDataType >::_id
protected

Definition at line 64 of file DomainImpl.h.

◆ _notDistributedData

template<typename BackendDataType >
BackendDataType ChimeraTK::async::DomainImpl< BackendDataType >::_notDistributedData
protected

Definition at line 67 of file DomainImpl.h.

◆ _notDistributedVersion

template<typename BackendDataType >
VersionNumber ChimeraTK::async::DomainImpl< BackendDataType >::_notDistributedVersion {nullptr}
protected

Definition at line 68 of file DomainImpl.h.

◆ _subDomain

template<typename BackendDataType >
boost::weak_ptr<SubDomain<BackendDataType> > ChimeraTK::async::DomainImpl< BackendDataType >::_subDomain
protected

Definition at line 61 of file DomainImpl.h.


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