19 template<
typename UserType>
46 UserType&
operator[](
unsigned int element) {
return get()->accessData(0, element); }
54 using iterator =
typename std::vector<UserType>::iterator;
74 void swap(std::vector<UserType>& x) noexcept;
87 operator const std::vector<UserType>&() {
return get()->accessChannel(0); }
96 UserType*
data() {
return get()->accessChannel(0).data(); }
102 template<
typename COOKED_TYPE>
109 template<
typename COOKED_TYPE>
110 void setAsCooked(
unsigned int sample, COOKED_TYPE value);
128 template<
typename UserType>
131 static_assert(!std::is_same<UserType, Void>::value,
132 "You cannot create OneDRegisterAccessor<ChimeraTK::Void>! Use VoidRegisterAccessor instead.");
134 if(get()->getNumberOfChannels() != 1) {
136 "dimension to access the register " + impl->getName());
142 template<
typename UserType>
144 static_assert(!std::is_same<UserType, Void>::value,
145 "You cannot create OneDRegisterAccessor<ChimeraTK::Void>! Use VoidRegisterAccessor instead.");
153 template<
typename UserType>
155 if(x.size() != get()->accessChannel(0).size()) {
158 std::cerr <<
"Swapping with a buffer of a different size is not allowed." << std::endl;
161 get()->accessChannel(0).swap(x);
169 template<
typename UserType>
171 if(x.size() != get()->accessChannel(0).size()) {
174 get()->accessChannel(0) = x;
184 template<
typename UserType>
185 template<
typename COOKED_TYPE>
187 return get()->template getAsCooked<COOKED_TYPE>(0, sample);
196 template<
typename UserType>
197 template<
typename COOKED_TYPE>
199 return get()->template setAsCooked<COOKED_TYPE>(0, sample, value);
209 template<
typename UserType>
212 if(!std::equal(newValue.begin(), newValue.end(), get()->accessChannel(0).begin()) ||
213 this->getVersionNumber() ==
VersionNumber(
nullptr) || this->dataValidity() != validity) {
215 if(versionNumber ==
VersionNumber{
nullptr}) versionNumber = {};
216 this->setDataValidity(validity);
217 this->
write(versionNumber);