ChimeraTK-DeviceAccess 03.20.00
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChimeraTK::MappedStruct< StructHeader > Class Template Reference

Provides interface to a struct that is mapped onto a 1D array of ValType StructHeader must be derived from OpaqueStructHeader. More...

#include <MappedImage.h>

+ Inheritance diagram for ChimeraTK::MappedStruct< StructHeader >:
+ Collaboration diagram for ChimeraTK::MappedStruct< StructHeader >:

Public Types

enum class  InitData { Yes , No }
 

Public Member Functions

 MappedStruct (ChimeraTK::OneDRegisterAccessor< unsigned char > &accToData, InitData doInitData=InitData::No)
 This keeps a reference to given OneDRegisterAccessor.
 
unsigned char * data ()
 returns pointer to data for header and struct content.
 
size_t capacity () const
 capacity of used container
 
size_t size () const
 currently used size
 
StructHeader * header ()
 returns header, e.g. for setting meta data
 
void initData ()
 default initialize header and zero out data that follows
 

Protected Attributes

ChimeraTK::OneDRegisterAccessor< unsigned char > & _accToData
 

Detailed Description

template<class StructHeader>
class ChimeraTK::MappedStruct< StructHeader >

Provides interface to a struct that is mapped onto a 1D array of ValType StructHeader must be derived from OpaqueStructHeader.

Variable-length structs are supported, as long as they do not grow beyond the size of the given 1D array.

NOTE: MappedStruct concept is discouraged. Use DataConsistencyGroup of struct members instead if possible. It is still required for MappedImage.

Definition at line 38 of file MappedImage.h.

Member Enumeration Documentation

◆ InitData

template<class StructHeader >
enum class ChimeraTK::MappedStruct::InitData
strong
Enumerator
Yes 
No 

Definition at line 40 of file MappedImage.h.

Constructor & Destructor Documentation

◆ MappedStruct()

template<class StructHeader >
ChimeraTK::MappedStruct< StructHeader >::MappedStruct ( ChimeraTK::OneDRegisterAccessor< unsigned char > &  accToData,
InitData  doInitData = InitData::No 
)
explicit

This keeps a reference to given OneDRegisterAccessor.

If its underlying vector is swapped out, the MappedStruct stays valid only if the swapped-in vector was also setup as MappedStruct.

Definition at line 180 of file MappedImage.h.

Member Function Documentation

◆ capacity()

template<class StructHeader >
size_t ChimeraTK::MappedStruct< StructHeader >::capacity ( ) const

capacity of used container

Definition at line 196 of file MappedImage.h.

◆ data()

template<class StructHeader >
unsigned char * ChimeraTK::MappedStruct< StructHeader >::data ( )

returns pointer to data for header and struct content.

The returned pointer stays valid until write() or read() is called for the underlying accessor.

Definition at line 191 of file MappedImage.h.

◆ header()

template<class StructHeader >
StructHeader * ChimeraTK::MappedStruct< StructHeader >::header ( )
inline

returns header, e.g. for setting meta data

Definition at line 54 of file MappedImage.h.

◆ initData()

template<class StructHeader >
void ChimeraTK::MappedStruct< StructHeader >::initData ( )

default initialize header and zero out data that follows

Definition at line 202 of file MappedImage.h.

◆ size()

template<class StructHeader >
size_t ChimeraTK::MappedStruct< StructHeader >::size ( ) const
inline

currently used size

Definition at line 52 of file MappedImage.h.

Member Data Documentation

◆ _accToData

template<class StructHeader >
ChimeraTK::OneDRegisterAccessor<unsigned char>& ChimeraTK::MappedStruct< StructHeader >::_accToData
protected

Definition at line 61 of file MappedImage.h.


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