ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
VoidRegisterAccessor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
6
7namespace ChimeraTK {
8
9 /********************************************************************************************************************/
10
14 class VoidRegisterAccessor : public NDRegisterAccessorAbstractor<ChimeraTK::Void> {
15 public:
20 // NOLINTNEXTLINE(google-explicit-constructor,hicpp-explicit-conversions)
21 VoidRegisterAccessor(const boost::shared_ptr<NDRegisterAccessor<Void>>& impl);
22
30
31 [[nodiscard]] bool isReadOnly() const;
32
33 [[nodiscard]] bool isReadable() const;
34
35 void read();
36
37 bool readNonBlocking();
38
39 bool readLatest();
40 };
41
42 /********************************************************************************************************************/
43
45 if(!_impl->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
46 throw ChimeraTK::logic_error("A VoidRegisterAccessor without wait_for_new_data is not readable.");
47 }
48 _impl->read();
49 }
50
51 /********************************************************************************************************************/
52
54 if(!_impl->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
55 throw ChimeraTK::logic_error("A VoidRegisterAccessor without wait_for_new_data is not readable.");
56 }
57 return _impl->readNonBlocking();
58 }
59
60 /********************************************************************************************************************/
61
63 if(!_impl->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
64 throw ChimeraTK::logic_error("A VoidRegisterAccessor without wait_for_new_data is not readable.");
65 }
66 return _impl->readLatest();
67 }
68
69 /********************************************************************************************************************/
70
71} // namespace ChimeraTK
Base class for the register accessor abstractors (ScalarRegisterAccessor, OneDRegisterAccessor and Tw...
N-dimensional register accessor.
boost::shared_ptr< TransferElement > _impl
Untyped pointer to implementation.
Accessor class to read and write void-typed registers.
VoidRegisterAccessor()=default
Placeholder constructer, to allow late initialisation of the accessor, e.g.
Exception thrown when a logic error has occured.
Definition Exception.h:51
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.