visageSDK

List of all members
VsCfgArr< T > Struct Template Reference

This is a templated structure that can store an array of values of varying types, including: More...

`#include <VisageConfiguration.h>`

## Detailed Description

### template<class T>
struct VsCfgArr< T >

This is a templated structure that can store an array of values of varying types, including:

- short
- int
- float
- double
- string

It is exclusively used in conjunction with VisageConfiguration class as means for obtaining and manipulation of array type configuration parameters (such as smoothing_factors or au_names).

Allocated memory is managed automatically by a destructor that deallocates its internal arrays at the end of its lifetime.

Following code examples demonstrate:

- initialization of VsCfgArr,
- accessing and reading values stored within VsCfgAr,
- iterating and changing values stored in a VsCfgArr

## Initialization of VsCfgArr

A new VsCfgArr may be created as follows:

VsCfgArr<int> newArray(6);

This would create a VsCfgArr that allocates space for 6 values of the integer type. The parameters supplied to the VsCfgArr constructor should be suited to the type and number of items that you wish to store:

- Type - short, integer, float, double or string
- Size - the number of elements to allocate storage space for

It may also be created from a pre-existing array:

float values[5] = {1, 2, 3, 4, 5};
VsCfgArr<float> newArray (values, 5);

A VsCfgArr's destructor automatically deallocates its internal arrays at the end of its lifetime.

## Accessing and reading values stored in a VsCfgArr

The values stored in a VsCfgArr which contains floating-point data may be accessed as follows:

m_Tracker = new VisageTracker(defaultConfigFile);
VsCfgArr<float> smoothingFactors = m_Tracker->getTrackerConfiguration()->getSmoothingFactors();
float sf_eyebrows = smoothingFactors[0];

Similarly for a VsCfgArr containing an array of integer values:

VsCfgArr<int> pose_fitting_au_use = m_Tracker->getTrackerConfiguration()->getPoseFittingAuUse();
int au1state = pose_fitting_au_use[0];

For information on whether a specific parameter is stored as a floating-point or integer data type, please refer to the respective setter or getter function for that parameter.

## Iterating and changing values stored in a VsCfgArr

The size/number of elements stored in a VsCfgArr can be obtained by the size member of VsCfgArr. Thus, for example, an iteration over a VsCfgArr array could be done in the following manner:

VsCfgArr<float> poseFittingAuSens = m_Tracker->getTrackerConfiguration()->getPoseFittingAuSensitivity();
unsigned int numOfEntries = poseFittingAuSens.size;
for (int i = 0; i < numOfEntries; i++)
{
poseFittingAuSens[i] = 1; //Setting all members to 1
}
poseFittingAuSens[0] = 5.5; //Setting the first member to 5.5

As shown in the above example values can be set directly via standard [] bracket operator.

Definition at line 129 of file VisageConfiguration.h.

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

- VisageConfiguration.h