ChimeraTK-DeviceAccess  03.18.00
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  InitData { InitData::Yes, InitData::No }
 

Public Member Functions

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

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 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

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.

+ Here is the caller graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ 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: