ChimeraTK-DeviceAccess  03.18.00
ChimeraTK::NDRegisterAccessor< UserType > Class Template Reference

N-dimensional register accessor. More...

#include <ForwardDeclarations.h>

+ Inheritance diagram for ChimeraTK::NDRegisterAccessor< UserType >:
+ Collaboration diagram for ChimeraTK::NDRegisterAccessor< UserType >:

Classes

struct  Buffer
 Data type to create individual buffers. More...
 

Public Member Functions

 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). More...
 
UserType & accessData (size_t sample)
 Get or set register accessor's buffer content (1D version). More...
 
const UserType & accessData (size_t sample) const
 
UserType & accessData (unsigned int channel, unsigned int sample)
 Get or set register accessor's buffer content (2D version). More...
 
const UserType & accessData (unsigned int channel, unsigned int sample) const
 
std::vector< UserType > & accessChannel (unsigned int channel)
 Get or set register accessor's channel vector. More...
 
const std::vector< UserType > & accessChannel (unsigned int channel) const
 
std::vector< std::vector< UserType > > & accessChannels ()
 Get or set register accessor's 2D channel vector. More...
 
const std::vector< std::vector< UserType > > & accessChannels () const
 
unsigned int getNumberOfSamples () const
 Return number of elements per channel. More...
 
unsigned int getNumberOfChannels () const
 Return number of channels. More...
 
const std::type_info & getValueType () const override
 
template<typename COOKED_TYPE >
COOKED_TYPE getAsCooked (unsigned int channel, unsigned int sample) const
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (getAsCooked_impl, T const(unsigned int, unsigned int))
 
template<typename COOKED_TYPE >
COOKED_TYPE getAsCooked_impl (unsigned int channel, unsigned int sample) const
 
template<typename COOKED_TYPE >
void setAsCooked (unsigned int channel, unsigned int sample, COOKED_TYPE value)
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (setAsCooked_impl, void(unsigned int, unsigned int, T))
 
template<typename COOKED_TYPE >
void setAsCooked_impl (unsigned int channel, unsigned int sample, COOKED_TYPE value)
 
boost::shared_ptr< TransferElementmakeCopyRegisterDecorator () override
 

Protected Member Functions

 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER (NDRegisterAccessor< UserType >, getAsCooked_impl, 2)
 
 DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER (NDRegisterAccessor< UserType >, setAsCooked_impl, 3)
 

Protected Attributes

std::vector< std::vector< UserType > > buffer_2D
 Buffer of converted data elements. More...
 

Friends

class MultiplexedDataAccessor< UserType >
 the compatibility layers need access to the buffer_2D More...
 
class RegisterAccessor
 

Detailed Description

template<typename UserType>
class ChimeraTK::NDRegisterAccessor< UserType >

N-dimensional register accessor.

Base class for all register accessor implementations. The user frontend classes BufferingRegisterAccessor and TwoDRegisterAccessor are using implementations based on this class to perform the actual IO.

Definition at line 17 of file ForwardDeclarations.h.

Constructor & Destructor Documentation

◆ NDRegisterAccessor()

template<typename UserType >
ChimeraTK::NDRegisterAccessor< UserType >::NDRegisterAccessor ( std::string const &  name,
AccessModeFlags  accessModeFlags,
std::string const &  unit = std::string(TransferElement::unitNotSet),
std::string const &  description = std::string() 
)
inline

Creates an NDRegisterAccessor with the specified name (passed on to the transfer element).

Definition at line 24 of file NDRegisterAccessor.h.

Member Function Documentation

◆ accessChannel() [1/2]

template<typename UserType >
std::vector<UserType>& ChimeraTK::NDRegisterAccessor< UserType >::accessChannel ( unsigned int  channel)
inline

Get or set register accessor's channel vector.

Attention
No bounds checking is performed, use getNumberOfChannels() to obtain the number of elements in the register.

Definition at line 49 of file NDRegisterAccessor.h.

◆ accessChannel() [2/2]

template<typename UserType >
const std::vector<UserType>& ChimeraTK::NDRegisterAccessor< UserType >::accessChannel ( unsigned int  channel) const
inline

Definition at line 50 of file NDRegisterAccessor.h.

◆ accessChannels() [1/2]

template<typename UserType >
std::vector<std::vector<UserType> >& ChimeraTK::NDRegisterAccessor< UserType >::accessChannels ( )
inline

Get or set register accessor's 2D channel vector.

Definition at line 53 of file NDRegisterAccessor.h.

◆ accessChannels() [2/2]

template<typename UserType >
const std::vector<std::vector<UserType> >& ChimeraTK::NDRegisterAccessor< UserType >::accessChannels ( ) const
inline

Definition at line 54 of file NDRegisterAccessor.h.

◆ accessData() [1/4]

template<typename UserType >
UserType& ChimeraTK::NDRegisterAccessor< UserType >::accessData ( size_t  sample)
inline

Get or set register accessor's buffer content (1D version).

Attention
No bounds checking is performed, use getNumberOfSamples() to obtain the number of elements in the register.

Definition at line 36 of file NDRegisterAccessor.h.

◆ accessData() [2/4]

template<typename UserType >
const UserType& ChimeraTK::NDRegisterAccessor< UserType >::accessData ( size_t  sample) const
inline

Definition at line 37 of file NDRegisterAccessor.h.

◆ accessData() [3/4]

template<typename UserType >
UserType& ChimeraTK::NDRegisterAccessor< UserType >::accessData ( unsigned int  channel,
unsigned int  sample 
)
inline

Get or set register accessor's buffer content (2D version).

Attention
No bounds checking is performed, use getNumberOfChannels() and getNumberOfSamples() to obtain the number of channels and samples in the register.

Definition at line 43 of file NDRegisterAccessor.h.

◆ accessData() [4/4]

template<typename UserType >
const UserType& ChimeraTK::NDRegisterAccessor< UserType >::accessData ( unsigned int  channel,
unsigned int  sample 
) const
inline

Definition at line 44 of file NDRegisterAccessor.h.

◆ DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE() [1/2]

template<typename UserType >
ChimeraTK::NDRegisterAccessor< UserType >::DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE ( getAsCooked_impl  ,
T const   unsigned int, unsigned int 
)

◆ DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE() [2/2]

template<typename UserType >
ChimeraTK::NDRegisterAccessor< UserType >::DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE ( setAsCooked_impl  ,
void(unsigned int, unsigned int, T)   
)

◆ DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER() [1/2]

template<typename UserType >
ChimeraTK::NDRegisterAccessor< UserType >::DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER ( NDRegisterAccessor< UserType >  ,
getAsCooked_impl  ,
 
)
protected

◆ DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER() [2/2]

template<typename UserType >
ChimeraTK::NDRegisterAccessor< UserType >::DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE_FILLER ( NDRegisterAccessor< UserType >  ,
setAsCooked_impl  ,
 
)
protected

◆ getAsCooked()

template<typename UserType >
template<typename COOKED_TYPE >
COOKED_TYPE ChimeraTK::NDRegisterAccessor< UserType >::getAsCooked ( unsigned int  channel,
unsigned int  sample 
) const

Definition at line 136 of file NDRegisterAccessor.h.

◆ getAsCooked_impl()

template<typename UserType >
template<typename COOKED_TYPE >
COOKED_TYPE ChimeraTK::NDRegisterAccessor< UserType >::getAsCooked_impl ( unsigned int  channel,
unsigned int  sample 
) const

Definition at line 142 of file NDRegisterAccessor.h.

+ Here is the caller graph for this function:

◆ getNumberOfChannels()

template<typename UserType >
unsigned int ChimeraTK::NDRegisterAccessor< UserType >::getNumberOfChannels ( ) const
inline

Return number of channels.

Definition at line 60 of file NDRegisterAccessor.h.

◆ getNumberOfSamples()

template<typename UserType >
unsigned int ChimeraTK::NDRegisterAccessor< UserType >::getNumberOfSamples ( ) const
inline

Return number of elements per channel.

Definition at line 57 of file NDRegisterAccessor.h.

◆ getValueType()

template<typename UserType >
const std::type_info& ChimeraTK::NDRegisterAccessor< UserType >::getValueType ( ) const
inlineoverride

Definition at line 62 of file NDRegisterAccessor.h.

◆ makeCopyRegisterDecorator()

template<typename UserType >
boost::shared_ptr< TransferElement > ChimeraTK::NDRegisterAccessor< UserType >::makeCopyRegisterDecorator
override

Definition at line 11 of file NDRegisterAccessor.cc.

◆ setAsCooked()

template<typename UserType >
template<typename COOKED_TYPE >
void ChimeraTK::NDRegisterAccessor< UserType >::setAsCooked ( unsigned int  channel,
unsigned int  sample,
COOKED_TYPE  value 
)

Definition at line 148 of file NDRegisterAccessor.h.

◆ setAsCooked_impl()

template<typename UserType >
template<typename COOKED_TYPE >
void ChimeraTK::NDRegisterAccessor< UserType >::setAsCooked_impl ( unsigned int  channel,
unsigned int  sample,
COOKED_TYPE  value 
)

Definition at line 154 of file NDRegisterAccessor.h.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ MultiplexedDataAccessor< UserType >

template<typename UserType >
friend class MultiplexedDataAccessor< UserType >
friend

the compatibility layers need access to the buffer_2D

Definition at line 127 of file NDRegisterAccessor.h.

◆ RegisterAccessor

template<typename UserType >
friend class RegisterAccessor
friend

Definition at line 128 of file NDRegisterAccessor.h.

Member Data Documentation

◆ buffer_2D

template<typename UserType >
std::vector<std::vector<UserType> > ChimeraTK::NDRegisterAccessor< UserType >::buffer_2D
protected

Buffer of converted data elements.

The buffer is always two dimensional. If a register with a single dimension should be accessed, the outer vector has only a single element. For a scalar register, only a single element is present in total (buffer_2D[0][0]). This has a negligible performance impact when optimisations are enabled, but allows a coherent interface for all accessors independent of their dimension.

Implementation note: The buffer must be created with the right number of elements in the constructor!

Definition at line 123 of file NDRegisterAccessor.h.


The documentation for this class was generated from the following files: