fesa-core  4.2.0
fesa::FieldArray2D< T > Class Template Reference

Field template class for 2D arrays of various numeric types and structure types. More...

#include <FieldArray2D.h>

Inheritance diagram for fesa::FieldArray2D< T >:
fesa::AbstractField

Public Member Functions

 FieldArray2D (const FieldConfig &fieldConfig, DataStore *pDataStore, std::size_t size1, std::size_t size2)
 Constructor. More...
 
 ~FieldArray2D ()
 destructor
 
void getMaxSize (uint32_t &size1, uint32_t &size2) const
 retrieve the size of the array More...
 
- Public Member Functions inherited from fesa::AbstractField
virtual ~AbstractField ()
 destructor
 
AbstractMultiplexingManagergetMultiplexingManager ()
 
uint32_t getMuxDepth () const
 
bool isMultiplexed () const
 
const std::string & getName () const
 
FieldCategory getType () const
 
bool isMultiMux () const
 
bool isPersistent () const
 
bool isShared () const
 
virtual std::string getAsString (const MultiplexingContext *context) const =0
 Method to retrieve the value of the field converted to string. More...
 
std::string getAttributeAsStringByName (const std::string &attribute, MultiplexingContext *context=NULL)
 Method to retrieve the struct attribute value converted to string. More...
 

Protected Member Functions

void initializeDimensions (const boost::shared_ptr< FieldElement > &fieldElement)
 used to initialize dimensions of the field from the instance document More...
 
std::size_t getFieldValueSize () const
 Method to get the size of the field-value object. The template of the field-value class depends on the field type. More...
 
void setFieldValueAddress (char *pFV, bool initFieldsFlag)
 Maps an address in shared memory or on the heap to the field value member of the field class. More...
 
void checkMaxDimensions (std::size_t size1, std::size_t size2) const
 this method checks whether the two dimensions passed by parameter are within the max dimensions of the array throwing an exception if they are not

Exceptions
FesaExceptionin case one of the dimensions is bigger than the dynamic size

 
void checkIndexBounds (const FieldValueArray2D< T > &fieldValue, std::size_t index1, std::size_t index2) const
 
FieldValueArray2D< T > * getFieldValue (int32_t slot)
 Get the field's value for a given slot. More...
 
void copyValue (uint32_t slot, const std::string &str)
 this method puts in the slot the value passed by parameter in the corresponding format More...
 
void getValueToStore (int32_t slot, std::string &value) const
 
void setFieldValue (FieldValueArray2D< T > &fieldValue, const T *val, std::size_t size1, std::size_t size2)
 
void setRowValue (FieldValueArray2D< T > &fieldValue, const T *val, uint32_t index, std::size_t count)
 
void setColumnValue (FieldValueArray2D< T > &fieldValue, const T *val, uint32_t index, std::size_t count)
 
void copyColumn (const FieldValueArray2D< T > &fieldValue, uint32_t index, std::size_t size, T *dest, std::size_t &currentSize) const
 
const T * getRowPointer (const FieldValueArray2D< T > &fieldValue, uint32_t index, std::size_t &currentSize) const
 
void setCellValue (FieldValueArray2D< T > &fieldValue, const T &val, std::size_t index1, std::size_t index2)
 
const T & getCellRef (const FieldValueArray2D< T > &fieldValue, std::size_t index1, std::size_t index2) const
 
- Protected Member Functions inherited from fesa::AbstractField
virtual void initializeDefaultValue (const std::string &value)
 Initialize the default value with a value provided in the instantiation file. More...
 
void setMultiplexingManager (AbstractMultiplexingManager *muxManager)
 changes the multiplexing manager of the field. More...
 
void setDataIntegrity (DataIntegrity dataIntegrity)
 changes the data integrity value of the field
 
void restore (const PersistanceFieldElement &fieldElement)
 gives the value to the field from the field element This method should be used to populate the fields at instantiation More...
 
void store (PersistanceFieldElement &fieldElement)
 Used to persist fields. More...
 
 AbstractField (const FieldConfig &fieldConfig, DataStore *dataStore)
 Constructor. More...
 
template<typename T >
T * getSlotPointer (void *baseAddress, std::size_t slot)
 
template<typename T >
const T * getSlotPointer (const void *baseAddress, std::size_t slot) const
 
virtual void getAttributeValueToStore (int32_t slot, const std::string &attribute, std::string &str)
 
template<typename T >
void validateValue (const T &value) const
 
template<typename T >
void validateValues (const T *values, const std::size_t count) const
 
void setMultiMuxFlag (bool flag)
 Changes multi-multiplexing status of the field to parameter value of flag. More...
 
void setMultiplexed (bool multiplexed)
 changes the multiplexing status
 

Protected Attributes

std::size_t maxSize1_
 maximum size of first dimension of the array
 
std::size_t maxSize2_
 maximum size of second dimension of the array
 
FieldValueArray2D< T > * fieldValue_
 value of the field
 
- Protected Attributes inherited from fesa::AbstractField
std::string name_
 name of the field
 
FieldCategory fieldCategory_
 category of the field (Acquisition, Generic, Setting or Configuration)
 
bool multiplexed_
 true if the field is multiplexed
 
bool multiMultiplexed_
 flag that indicates whether field is multi-multiplexed
 
bool shared_
 flag that indicates whether field is shared byt RT and Server
 
bool persistent_
 flag that indicates whether field is persistent
 
DataIntegrity buffer_
 type of buffer of the field
 
AbstractMultiplexingManagermultiplexingManager_
 multiplexing manager of the field
 
DataStoredataStore_
 The data store this field belongs to.
 
std::size_t valueSize_
 size of the value
 

Additional Inherited Members

- Static Public Attributes inherited from fesa::AbstractField
static const std::size_t INVALID_SIZE = std::numeric_limits<std::size_t>::max()
 

Detailed Description

template<typename T>
class fesa::FieldArray2D< T >

Field template class for 2D arrays of various numeric types and structure types.

Constructor & Destructor Documentation

template<typename T >
fesa::FieldArray2D< T >::FieldArray2D ( const FieldConfig fieldConfig,
DataStore pDataStore,
std::size_t  size1,
std::size_t  size2 
)

Constructor.

Parameters
nameof the field, field category, multiplexing criterion, pointer to DataStore

Member Function Documentation

template<typename T >
void fesa::FieldArray2D< T >::checkIndexBounds ( const FieldValueArray2D< T > &  fieldValue,
std::size_t  index1,
std::size_t  index2 
) const
protected

Ensures that index1 and index2 are within the current size of the given fieldValue.

Exceptions
FesaExceptionif either of the indexes are out of bounds.
template<typename T >
void fesa::FieldArray2D< T >::copyColumn ( const FieldValueArray2D< T > &  fieldValue,
uint32_t  index,
std::size_t  size,
T *  dest,
std::size_t &  currentSize 
) const
protected

Copies fieldValue's column at the given index to the destination buffer.

Parameters
fieldValuethe source fieldValue
indexindex of the column to copy from
sizenumber of values to copy
destdestination buffer
[out]currentSizecurrent number of values at the given column
template<typename T >
void fesa::FieldArray2D< T >::copyValue ( uint32_t  slot,
const std::string &  str 
)
protectedvirtual

this method puts in the slot the value passed by parameter in the corresponding format

Parameters
slotto put the value
valvalue to put

Implements fesa::AbstractField.

template<typename T >
const T & fesa::FieldArray2D< T >::getCellRef ( const FieldValueArray2D< T > &  fieldValue,
std::size_t  index1,
std::size_t  index2 
) const
protected

Returns a reference to the fieldValue's cell at the given indexes.

template<typename T >
FieldValueArray2D< T > * fesa::FieldArray2D< T >::getFieldValue ( int32_t  slot)
protectedvirtual

Get the field's value for a given slot.

Parameters
slotThe slot to get the field's value from
Returns
The field's value

Implements fesa::AbstractField.

template<typename T >
std::size_t fesa::FieldArray2D< T >::getFieldValueSize ( ) const
protectedvirtual

Method to get the size of the field-value object. The template of the field-value class depends on the field type.

Returns
the size in bytes of the field value object.

Implements fesa::AbstractField.

template<typename T >
void fesa::FieldArray2D< T >::getMaxSize ( uint32_t &  size1,
uint32_t &  size2 
) const

retrieve the size of the array

Parameters
[out]size1first dimension of the array (row)
[out]size2second dimension of the array (column)
template<typename T >
const T * fesa::FieldArray2D< T >::getRowPointer ( const FieldValueArray2D< T > &  fieldValue,
uint32_t  index,
std::size_t &  currentSize 
) const
protected

Returns a pointer to the fieldValue's row at the given index.

Parameters
fieldValuethe fieldValue
indexthe row index
[out]currentSizecurrent number of values at the given row
template<typename T >
void fesa::FieldArray2D< T >::getValueToStore ( int32_t  slot,
std::string &  str 
) const
protectedvirtual
Returns
the value of the pending buffer as a string

Implements fesa::AbstractField.

template<typename T >
void fesa::FieldArray2D< T >::initializeDimensions ( const boost::shared_ptr< FieldElement > &  fieldElement)
protectedvirtual

used to initialize dimensions of the field from the instance document

Parameters
fieldElementthat contains the values for the field

Reimplemented from fesa::AbstractField.

template<typename T >
void fesa::FieldArray2D< T >::setCellValue ( FieldValueArray2D< T > &  fieldValue,
const T &  val,
std::size_t  index1,
std::size_t  index2 
)
protected

Copies val to the fieldValue's cell at the given indexes.

template<typename T >
void fesa::FieldArray2D< T >::setColumnValue ( FieldValueArray2D< T > &  fieldValue,
const T *  val,
uint32_t  index,
std::size_t  count 
)
protected

Copies the given values to the fieldValue's column at the given index.

Parameters
fieldValuethe destination fieldValue
valvalues to copy
countnumber of values to copy
template<typename T >
void fesa::FieldArray2D< T >::setFieldValue ( FieldValueArray2D< T > &  fieldValue,
const T *  val,
std::size_t  size1,
std::size_t  size2 
)
protected

Copies the given values to the fieldValue.

Parameters
fieldValuethe destination fieldValue
valmatrix of values to copy
size1number of rows
size2number of columns
template<typename T >
void fesa::FieldArray2D< T >::setFieldValueAddress ( char *  pFV,
bool  initFieldsFlag 
)
protectedvirtual

Maps an address in shared memory or on the heap to the field value member of the field class.

Parameters
pFVpointer to a field value.

Implements fesa::AbstractField.

template<typename T >
void fesa::FieldArray2D< T >::setRowValue ( FieldValueArray2D< T > &  fieldValue,
const T *  val,
uint32_t  index,
std::size_t  count 
)
protected

Copies the given values to the fieldValue's row at the given index.

Parameters
fieldValuethe destination fieldValue
valvalues to copy
countnumber of values to copy

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