23#ifndef _GEMA_VALUE_SET_PACKED_DATA_H_
24#define _GEMA_VALUE_SET_PACKED_DATA_H_
33template <
class T,
bool Align>
class GmTLBuffer;
60template <
class T,
template <
class>
class Vector>
68 virtual void packLayoutUpdated();
76 virtual bool isDual()
const {
return _pack->isDual(); }
79 virtual int numValues()
const {
return _pack->numValues(); }
85 QString desiredUnit,
bool atomic =
false);
90#if defined ENABLE_TESTS || defined ENABLE_VALUESETDATA_TESTS
91 virtual void validateInternalStructure();
96 const T*
iptr(
int index)
const
98 assert(index >= 0 && index <
numValues());
101 assert(_ptr && _strideOrIndex);
102 return (T*)(_ptr + (size_t)index * _strideOrIndex);
106 assert(_strideOrIndex >= 0);
107 return ((T*)_pack->iptr(_strideOrIndex, index)) + _state * _dim;
115 virtual bool isDefValue(
int index)
const {
return !memcmp(
value(index), _info->defValue(), _dim *
sizeof(
double)); }
120 virtual const double*
value (
int index)
const;
121 virtual bool setValue(
int index,
const double* values);
124 virtual void*
functionValue(
int index)
const { Q_UNUSED(index); assert(0);
return NULL; }
129 Q_UNUSED(index); Q_UNUSED(type); Q_UNUSED(functionObj);
151template <
template <
class>
class Vector>
158 QString desiredUnit,
bool atomic =
false);
171 virtual const double*
value (
int index)
const;
172 virtual bool setValue(
int index,
const double* values);
The value set data object for packed data with function support. Very similar to GmFVectorValueSetSto...
Definition gmValueSetPackedData.h:153
const GmNanBoxedValue * nanBoxPtr(int index) const
Returns a pointer to the index data inside the pack converted to a Nan Box.
Definition gmValueSetPackedData.h:162
GmNanBoxedValue * nanBoxPtr(int index)
Non-const overload to return a pointer to the index data inside the pack converted to a Nan Box.
Definition gmValueSetPackedData.h:165
GmUserFunction * _defFunction
The default user function if the default value is a function, NULL otherwise.
Definition gmValueSetPackedData.h:178
Class representing a category with multiple logging levels.
Definition gmLog.h:58
A wrapper class around QtNanBoxedValue providing specific constructors to store user functions / user...
Definition gmNanBoxedValue.h:41
The value set data object for packed data without function support. Very similar to GmVectorValueSetS...
Definition gmValueSetPackedData.h:62
int _dim
Value dimension. Equal to _info->size();.
Definition gmValueSetPackedData.h:138
int _state
The state index number if _info->history() > 0, 0 otherwise.
Definition gmValueSetPackedData.h:137
virtual int numValues() const
Returns the number of values stored in this value set.
Definition gmValueSetPackedData.h:79
virtual size_t usedMemory() const
Memory usage is accounted by the pack and not by the value set data.
Definition gmValueSetPackedData.h:88
char * _ptr
The pointer to the first entry of our data in the pack WHEN Vector is a single vector.
Definition gmValueSetPackedData.h:139
GmTLBuffer< double, GM_VALUESET_ALIGNED_BUFFERS > * _convBuffer
The buffer used to store data returned by value() when T is not double.
Definition gmValueSetPackedData.h:141
int _strideOrIndex
The "distance" between data entries for Single Vector or the value set index in the pack for Dual vec...
Definition gmValueSetPackedData.h:140
virtual GmPackedBuffer * pack() const
Returns the associated pack object;.
Definition gmValueSetPackedData.h:70
virtual bool isDual() const
Returns true if the underlying data storage is a dual vector, false if not.
Definition gmValueSetPackedData.h:76
const T * iptr(int index) const
Returns a pointer to the index data inside the pack.
Definition gmValueSetPackedData.h:96
virtual int storedItemSize() const
Returns the size in bytes of a value set item. It is usually equal to the data dimension (info()->siz...
Definition gmValueSetPackedData.h:82
GmPackedBufferImpl< Vector > * _pack
The pack that contains the data for this object.
Definition gmValueSetPackedData.h:135
virtual GmValueInfo * info() const
Returns a pointer to the associated value info object.
Definition gmValueSetPackedData.h:73
GmValueInfo * _info
The info object describing this set contents.
Definition gmValueSetPackedData.h:136
T * iptr(int index)
Non-const overload to return a pointer to the index data inside the pack.
Definition gmValueSetPackedData.h:112
virtual bool setFunctionValue(int index, GmValueSetData::StoredValueType type, void *functionObj)
Overload of setValue() storing a user function definition.
Definition gmValueSetPackedData.h:127
virtual void * functionValue(int index) const
Returns a pointer to the stored function object. Return will be either a GmUserFunction* or a GmUserF...
Definition gmValueSetPackedData.h:124
virtual bool isDefValue(int index) const
Returns true if the indexed value is the default value for the set.
Definition gmValueSetPackedData.h:115
virtual GmValueSetData::StoredValueType storedValueType(int index) const
Returns the type (number, function definition/evaluator) of the stored value for the given index.
Definition gmValueSetPackedData.h:118
The basic interface for a shared buffer storing interleaved data for a group of value sets.
Definition gmPackedBuffer.h:119
The concrete implementation for GmPackedBuffer. The template parameter defines the kind of vector use...
Definition gmPackedBuffer.h:188
A class with the same API as GmDualVector storing a single vector. No query "if" overhead....
Definition gmSingleVector.h:37
A class similar to GmTLS that creates a buffer for each possible thread in the GmThreadManager,...
Definition gmThreadLocalBuffer.h:106
Auxiliary class responisble for allowing a value accessor to track changes to the referenced value se...
Definition gmTrackedValueAccessor.h:38
Class used to store the definition of a user function and its parameters.
Definition gmUserFunction.h:82
Auxiliar class used to store the definition of a value. It can be used to store informations about st...
Definition gmValueInfo.h:132
The generic interface implemented by every GmValueSetData object. Its purpose is to provide a base cl...
Definition gmValueSetData.h:58
virtual const double * value(int index) const =0
Returns the numeric value stored at the given index (converted to a double if needed) Must be called ...
virtual void * functionValue(int index) const =0
Returns a pointer to the stored function object. Return will be either a GmUserFunction* or a GmUserF...
virtual int numValues() const =0
Returns the number of values stored in this value set.
StoredValueType
Enumeration to detect the type of stored data for an index.
Definition gmValueSetData.h:62
@ GM_SVT_NUMBER
A number.
Definition gmValueSetData.h:63
virtual GmTrackedValueAccessor * accessor(const GmLogCategory &logger, UnitConverter *conv, QString desiredUnit, bool atomic=false)=0
Returns an accessor for the stored data. The atomic flag can be used by the caller to request that a ...
virtual bool setFunctionValue(int index, StoredValueType type, void *functionObj)=0
Overload of setValue() storing a user function definition.
virtual bool setValue(int index, const double *values)=0
Updates the value stored at the given index with a numeric value (converted to the correct type if ne...
virtual bool isDefValue(int index) const =0
Returns true if the indexed value is the default value for the set.
virtual StoredValueType storedValueType(int index) const =0
Returns the type (number, function definition/evaluator) of the stored value for the given index.
Auxiliar class used to store the needed information to translate an user function id / user function ...
Definition gmValueSetEvalContext.h:46
The generic GmValueSetData interface for packed storage.
Definition gmValueSetPackedData.h:37
virtual void packLayoutUpdated()=0
Updates internal data after a layout update inside the pack. This INCLUDES internal buffer updates,...
virtual GmPackedBuffer * pack() const =0
Returns the associated pack object;.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of the GmPackedBuffer and GmPackedBufferInfo classes.
Declaration of the GmValueSetData interface.