PFValue Struct Reference

#include <pftypes.h>

List of all members.

Public Attributes

union {
   long   i
 Union: Integer value.
   float   f
 Union: Float value.
   void *   p
 Union: Generic Pointer value.
value
PropertyType type
 Value Type.
int len
 length of array, if type is a buffer


Detailed Description

Run time information data type.

This contains a value union and a type field

A PFValue is to be initialized as follows:

 v.type = <type>; v.value.<valuefield> = <value> 

For example, see macros SET_FLOAT, etc.

In case of a string or buffer value, it is important to know that the data buffer is not owned by the property structure, i.e. the PFValue only serves as a descriptor and no value copying actually happens. Therefore, the programmer has to distinguish between two cases before querying a property via pfDevice_GetProperty()

For a dynamic string, the initialization would look as follows:

#define BUF_LEN 80
        PFValue v;
        char buffer[BUF_LEN];

        v.type = PF_STRING;
        v.len = BUF_LEN;
        v.value.p = buffer;

        pfDevice_GetProperty(d, property, &v);
        // ...
        //
Note that in this example, the (zero terminated) string has a maximum length of 79.

If there was not enough space reserved for the property buffer, an error PFERR_PROPERTY_SIZE_MATCH is returned from pfGetProperty()

Data type checking is performed when setting properties.


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

Generated on Mon Aug 9 15:37:46 2010 for PhotonFocusCameraControlLibrary by  doxygen 1.5.8