#include <pftypes.h>
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 |
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()
#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); // ... //
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.