7 #include <boost/smart_ptr.hpp>
16 template<
class UserType>
17 class TwoDRegisterAccessor :
public NDRegisterAccessorAbstractor<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<
class UserType>
71 static_assert(!std::is_same<UserType, Void>::value,
72 "You cannot create TwoDRegisterAccessor<ChimeraTK::Void>! Use VoidRegisterAccessor instead.");
77 template<
class UserType>
79 static_assert(!std::is_same<UserType, Void>::value,
80 "You cannot create TwoDRegisterAccessor<ChimeraTK::Void>! Use VoidRegisterAccessor instead.");
85 template<
class UserType>
87 const std::vector<std::vector<UserType>>& other) {
88 get()->accessChannels() = other;
94 template<
class UserType>
95 template<
typename COOKED_TYPE>
97 return get()->template getAsCooked<COOKED_TYPE>(channel, sample);
102 template<
class UserType>
103 template<
typename COOKED_TYPE>
105 return get()->template setAsCooked<COOKED_TYPE>(channel, sample, value);