7#include <boost/smart_ptr.hpp>
16 template<user_type UserType>
32 std::vector<UserType>&
operator[](
size_t channel) {
return get()->accessChannel(channel); }
35 const std::vector<UserType>&
operator[](
size_t channel)
const {
return get()->accessChannel(channel); }
41 [[nodiscard]]
size_t getNChannels()
const {
return get()->getNumberOfChannels(); }
50 template<
typename COOKED_TYPE>
51 COOKED_TYPE
getAsCooked(
unsigned int channel,
unsigned int sample)
const;
57 template<
typename COOKED_TYPE>
58 void setAsCooked(
unsigned int channel,
unsigned int sample, COOKED_TYPE value);
68 template<user_type UserType>
71 static_assert(!std::is_same<UserType, Void>::value,
72 "You cannot create TwoDRegisterAccessor<ChimeraTK::Void>! Use VoidRegisterAccessor instead.");
77 template<user_type UserType>
79 static_assert(!std::is_same<UserType, Void>::value,
80 "You cannot create TwoDRegisterAccessor<ChimeraTK::Void>! Use VoidRegisterAccessor instead.");
85 template<user_type UserType>
87 const std::vector<std::vector<UserType>>& other) {
88 get()->accessChannels() = other;
94 template<user_type UserType>
95 template<
typename COOKED_TYPE>
97 return get()->template getAsCooked<COOKED_TYPE>(channel, sample);
102 template<user_type UserType>
103 template<
typename COOKED_TYPE>
105 return get()->template setAsCooked<COOKED_TYPE>(channel, sample, value);
Base class for the register accessor abstractors (ScalarRegisterAccessor, OneDRegisterAccessor and Tw...
NDRegisterAccessor< UserType > * get()
N-dimensional register accessor.
Group multiple data accessors to efficiently trigger data transfers on the whole group.
Accessor class to read and write 2D registers.
COOKED_TYPE getAsCooked(unsigned int channel, unsigned int sample) const
Get the cooked values in case the accessor is a raw accessor (which does not do data conversion).
void setAsCooked(unsigned int channel, unsigned int sample, COOKED_TYPE value)
Set the cooked values in case the accessor is a raw accessor (which does not do data conversion).
size_t getNElementsPerChannel() const
Return number of elements/samples per channel.
TwoDRegisterAccessor< UserType > & operator=(const std::vector< std::vector< UserType > > &other)
Assignment operator to assign the entire 2D array.
size_t getNChannels() const
Return the number of channels (formerly called sequences)
std::vector< UserType > & operator[](size_t channel)
Operator to access individual sequences/channels.
const std::vector< UserType > & operator[](size_t channel) const
Const operator to access individual sequences/channels.
TwoDRegisterAccessor()
Placeholder constructer, to allow late initialisation of the accessor, e.g.