ChimeraTK-DeviceAccess
03.18.00
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
5
#include "
NDRegisterAccessorAbstractor.h
"
6
7
namespace
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
29
VoidRegisterAccessor
() =
default
;
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
44
inline
void
VoidRegisterAccessor::read
() {
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
53
inline
bool
VoidRegisterAccessor::readNonBlocking
() {
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
62
inline
bool
VoidRegisterAccessor::readLatest
() {
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
NDRegisterAccessorAbstractor.h
ChimeraTK::VoidRegisterAccessor::read
void read()
Definition:
VoidRegisterAccessor.h:44
ChimeraTK::VoidRegisterAccessor::VoidRegisterAccessor
VoidRegisterAccessor()=default
Placeholder constructer, to allow late initialisation of the accessor, e.g.
ChimeraTK::VoidRegisterAccessor::readNonBlocking
bool readNonBlocking()
Definition:
VoidRegisterAccessor.h:53
ChimeraTK::VoidRegisterAccessor::isReadable
bool isReadable() const
Definition:
VoidRegisterAccessor.cc:31
ChimeraTK::VoidRegisterAccessor::readLatest
bool readLatest()
Definition:
VoidRegisterAccessor.h:62
ChimeraTK::AccessMode::wait_for_new_data
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.
ChimeraTK::VoidRegisterAccessor
Accessor class to read and write void-typed registers.
Definition:
VoidRegisterAccessor.h:14
ChimeraTK::NDRegisterAccessorAbstractor
Base class for the register accessor abstractors (ScalarRegisterAccessor, OneDRegisterAccessor and Tw...
Definition:
NDRegisterAccessorAbstractor.h:19
ChimeraTK::VoidRegisterAccessor::isReadOnly
bool isReadOnly() const
Definition:
VoidRegisterAccessor.cc:21
ChimeraTK::TransferElementAbstractor::_impl
boost::shared_ptr< TransferElement > _impl
Untyped pointer to implementation.
Definition:
TransferElementAbstractor.h:225
ChimeraTK
Definition:
DummyBackend.h:16
ChimeraTK::NDRegisterAccessor
N-dimensional register accessor.
Definition:
ForwardDeclarations.h:17
ChimeraTK::logic_error
Exception thrown when a logic error has occured.
Definition:
Exception.h:51
sources
ChimeraTK-DeviceAccess
include
VoidRegisterAccessor.h
Generated by
1.8.17