10#include <boost/container/static_vector.hpp>
11#include <boost/make_shared.hpp>
20 template<user_type UserType>
27 std::string
const& description = std::string())
44 UserType&
accessData(
unsigned int channel,
unsigned int sample) {
return buffer_2D[channel][sample]; }
45 const UserType&
accessData(
unsigned int channel,
unsigned int sample)
const {
return buffer_2D[channel][sample]; }
63 const std::type_info&
getValueType()
const override {
return typeid(UserType); }
65 template<
typename COOKED_TYPE>
66 COOKED_TYPE
getAsCooked(
unsigned int channel,
unsigned int sample)
const;
68 template<
typename COOKED_TYPE>
71 template<
typename COOKED_TYPE>
72 void setAsCooked(
unsigned int channel,
unsigned int sample, COOKED_TYPE value);
74 template<
typename COOKED_TYPE>
111 for(
auto& channel :
value) channel.resize(nElements);
120 value = std::move(other.value);
127 std::vector<std::vector<UserType>>
value;
156 template<user_type UserType>
157 template<
typename COOKED_TYPE>
162 template<user_type UserType>
163 template<
typename COOKED_TYPE>
168 template<user_type UserType>
169 template<
typename COOKED_TYPE>
174 template<user_type UserType>
175 template<
typename COOKED_TYPE>
177 unsigned int ,
unsigned int , COOKED_TYPE ) {
#define DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(TemplateClass)
#define CALL_VIRTUAL_FUNCTION_TEMPLATE(functionName, templateArgument,...)
Execute the virtual function template call using the vtable defined with the DEFINE_VIRTUAL_FUNCTION_...
#define FILL_VIRTUAL_FUNCTION_TEMPLATE_VTABLE(functionName)
Fill the vtable of a virtual function template defined with DEFINE_VIRTUAL_FUNCTION_TEMPLATE.
Set of AccessMode flags with additional functionality for an easier handling.
N-dimensional register accessor.
const std::type_info & getValueType() const override
Returns the std::type_info for the value type of this transfer element.
COOKED_TYPE getAsCooked_impl(unsigned int channel, unsigned int sample) const
DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE(setAsCooked_impl, void(unsigned int, unsigned int, T))
NDRegisterAccessor(std::string const &name, AccessModeFlags accessModeFlags, std::string const &unit=std::string(TransferElement::unitNotSet), std::string const &description=std::string())
Creates an NDRegisterAccessor with the specified name (passed on to the transfer element).
friend class RegisterAccessor
the compatibility layers need access to the buffer_2D
unsigned int getNumberOfSamples() const
Return number of elements per channel.
DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER(NDRegisterAccessor< UserType >, setAsCooked_impl, 3)
UserType & accessData(unsigned int channel, unsigned int sample)
Get or set register accessor's buffer content (2D version).
const std::vector< std::vector< UserType > > & accessChannels() const
virtual boost::shared_ptr< NDRegisterAccessor< UserType > > decorateDeepInside(std::function< boost::shared_ptr< NDRegisterAccessor< UserType > >(const boost::shared_ptr< NDRegisterAccessor< UserType > > &)> factory)
Decorate the innermost TransferElement of the stack of decorators or decorator-like accessors.
std::vector< UserType > & accessChannel(unsigned int channel)
Get or set register accessor's channel vector.
std::vector< std::vector< UserType > > buffer_2D
Buffer of converted data elements.
std::vector< std::vector< UserType > > & accessChannels()
Get or set register accessor's 2D channel vector.
UserType & accessData(size_t sample)
Get or set register accessor's buffer content (1D version).
DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER(NDRegisterAccessor< UserType >, getAsCooked_impl, 2)
void setAsCooked(unsigned int channel, unsigned int sample, COOKED_TYPE value)
void setAsCooked_impl(unsigned int channel, unsigned int sample, COOKED_TYPE value)
boost::shared_ptr< TransferElement > makeCopyRegisterDecorator() override
Create a CopyRegisterDecorator of the right type decorating this TransferElement.
COOKED_TYPE getAsCooked(unsigned int channel, unsigned int sample) const
const std::vector< UserType > & accessChannel(unsigned int channel) const
const UserType & accessData(unsigned int channel, unsigned int sample) const
DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE(getAsCooked_impl, T const(unsigned int, unsigned int))
unsigned int getNumberOfChannels() const
Return number of channels.
const UserType & accessData(size_t sample) const
Base class for register accessors which can be part of a TransferGroup.
void makeUniqueId()
Allow generating a unique ID from derived classes.
static constexpr char unitNotSet[]
Constant string to be used as a unit when the unit is not provided or known.
Class for generating and holding version numbers without exposing a numeric representation.
Exception thrown when a logic error has occured.
DataValidity
The current state of the data.
Data type to create individual buffers.
Buffer(Buffer &&other) noexcept
Buffer & operator=(Buffer &&other) noexcept
std::vector< std::vector< UserType > > value
The actual data contained in this buffer.
ChimeraTK::VersionNumber versionNumber
Version number of this data.
ChimeraTK::DataValidity dataValidity
Whether or not the data in the buffer is considered valid.
Buffer(size_t nChannels, size_t nElements)