A device detection library that is used natively or by 51Degrees products

Profile

Detailed Description

Profile containing a unique set of values for the properties of a single component.

Introduction

A Profile is stored in a profiles collection and contains the meta data for a specific profile for a component in a data set. Each profile contains a unique set of values for a single component.

Get

A Profile can be fetched from a profiles collection in one of two ways:

By Index : The fiftyoneDegreesProfileGetByIndex method return the profile at a specified index. This provides a way to access a profile at a known index, or iterate over all values.

By Id : If the index of a profile is not known, then the profile can be fetched using the fiftyoneDegreesProfileGetByProfileId method to find the profile in a profiles collection.

Iterate

A profiles collection can be iterated in two ways:

Values : The fiftyoneDegreesProfileIterateValuesForProperty method can be used to iterate over all the values which a profile contains for a specified property.

Profiles : The fiftyoneDegreesProfileIterateProfilesForPropertyAndValue method can be used to iterate over all the profiles in a profiles collection which contain a specified property and value pairing.

Collaboration diagram for Profile:

Structs

struct  fiftyoneDegreesProfile
 Encapsulates a profile stored within a data set. More...
struct  fiftyoneDegreesProfileOffset
 Structure containing the unique id of the profile, and the offset needed to retrieve the actual profile structure from a profiles collection. More...

Typedefs

typedef uint32_t fiftyoneDegreesProfileValuesCountType
 Type for fiftyoneDegreesProfile::valueCount.
typedef uint32_t(* fiftyoneDegreesProfileOffsetValueExtractor) (const void *rawProfileOffset)
 Function that extracts "pure" profile offset from a value inside profileOffsets collection.
typedef bool(* fiftyoneDegreesProfileIterateMethod) (void *state, fiftyoneDegreesCollectionItem *item)
 Definition of a callback function which is passed an item of a type determined by the iteration method.
typedef bool(* fiftyoneDegreesProfileIterateValueIndexesMethod) (void *state, uint32_t valueIndex)
 Definition of a callback function which is passed the next values index for the profile.

Functions

uint32_t fiftyoneDegreesProfileOffsetToPureOffset (const void *rawProfileOffset)
 Function that extracts "pure" profile offset from a fiftyoneDegreesProfileOffset.
uint32_t fiftyoneDegreesProfileOffsetAsPureOffset (const void *rawProfileOffset)
 Function that extracts "pure" profile offset from a value (that starts with a "pure" profile offset) inside profileOffsets collection.
uint32_t fiftyoneDegreesProfileGetFinalSize (const void *initial, fiftyoneDegreesException *const exception)
 Gets size of Profile with trailing values.
fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByProfileId (fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, uint32_t profileId, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
 Gets the profile associated with the profileId or NULL if there is no corresponding profile.
fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByIndex (fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, uint32_t index, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
 Gets a pointer to the profile at the index provided.
void * fiftyoneDegreesProfileReadFromFile (const fiftyoneDegreesCollectionFile *file, const fiftyoneDegreesCollectionKey *key, fiftyoneDegreesData *data, fiftyoneDegreesException *exception)
 Read a profile from the file collection provided and store in the data pointer.
uint32_t fiftyoneDegreesProfileIterateValuesForProperty (const fiftyoneDegreesCollection *values, const fiftyoneDegreesProfile *profile, const fiftyoneDegreesProperty *property, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
 Iterate over all values contained in the profile which relate to the specified property, calling the callback method for each.
uint32_t fiftyoneDegreesProfileIterateValuesForPropertyWithIndex (const fiftyoneDegreesCollection *values, fiftyoneDegreesIndicesPropertyProfile *index, uint32_t availablePropertyIndex, const fiftyoneDegreesProfile *profile, const fiftyoneDegreesProperty *property, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
 Iterate over all values contained in the profile which relate to the specified property and profile, calling the callback method for each.
uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyWithTypeAndValue (fiftyoneDegreesCollection *strings, fiftyoneDegreesCollection *properties, fiftyoneDegreesCollection *propertyTypes, fiftyoneDegreesCollection *values, fiftyoneDegreesCollection *profiles, fiftyoneDegreesCollection *profileOffsets, const char *propertyName, const char *valueName, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
 Iterate all profiles which contain the specified value, calling the callback method for each.
uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyWithTypeAndValueAndOffsetExtractor (fiftyoneDegreesCollection *strings, fiftyoneDegreesCollection *properties, fiftyoneDegreesCollection *propertyTypes, fiftyoneDegreesCollection *values, fiftyoneDegreesCollection *profiles, const fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesProfileOffsetValueExtractor offsetValueExtractor, const char *propertyName, const char *valueName, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
 Iterate all profiles which contain the specified value, calling the callback method for each.
uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyAndValue (fiftyoneDegreesCollection *strings, fiftyoneDegreesCollection *properties, fiftyoneDegreesCollection *values, fiftyoneDegreesCollection *profiles, fiftyoneDegreesCollection *profileOffsets, const char *propertyName, const char *valueName, void *state, fiftyoneDegreesProfileIterateMethod callback, fiftyoneDegreesException *exception)
 Iterate all profiles which contain the specified value, calling the callback method for each.
uint32_t * fiftyoneDegreesProfileGetOffsetForProfileId (fiftyoneDegreesCollection *profileOffsets, uint32_t profileId, uint32_t *profileOffset, fiftyoneDegreesException *exception)
 Gets the offset in the profiles collection for the profile with the profileId or NULL if there is no corresponding profile.
fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByProfileIdIndirect (fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, uint32_t profileId, fiftyoneDegreesCollectionItem *outProfileItem, fiftyoneDegreesException *exception)
 Gets the profile from the profiles collection with the profileId or NULL if there is no corresponding profile.
uint32_t fiftyoneDegreesProfileIterateValueIndexes (fiftyoneDegreesProfile *profile, fiftyoneDegreesPropertiesAvailable *available, fiftyoneDegreesCollection *values, void *state, fiftyoneDegreesProfileIterateValueIndexesMethod callback, fiftyoneDegreesException *exception)
 Calls the callback for every value index available for the profile.

Typedef Documentation

◆ fiftyoneDegreesProfileIterateMethod

typedef bool(* fiftyoneDegreesProfileIterateMethod) (void *state, fiftyoneDegreesCollectionItem *item)

Definition of a callback function which is passed an item of a type determined by the iteration method.

Parameters
statepointer to data needed by the method
itemto store each profile in while iterating
Returns
true if the iteration should continue, otherwise false to stop

◆ fiftyoneDegreesProfileIterateValueIndexesMethod

typedef bool(* fiftyoneDegreesProfileIterateValueIndexesMethod) (void *state, uint32_t valueIndex)

Definition of a callback function which is passed the next values index for the profile.

Parameters
statepointer to data needed by the method
valueIndexfor the next value
Returns
true if the iteration should continue, otherwise false to stop

◆ fiftyoneDegreesProfileOffsetValueExtractor

typedef uint32_t(* fiftyoneDegreesProfileOffsetValueExtractor) (const void *rawProfileOffset)

Function that extracts "pure" profile offset from a value inside profileOffsets collection.

Parameters
rawProfileOffseta "raw" value retrieved from profileOffsets
Returns
Offset to the profile in the profiles structure

Function Documentation

◆ fiftyoneDegreesProfileGetByIndex()

fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByIndex ( fiftyoneDegreesCollection * profileOffsets,
fiftyoneDegreesCollection * profiles,
uint32_t index,
fiftyoneDegreesCollectionItem * item,
fiftyoneDegreesException * exception )

Gets a pointer to the profile at the index provided.

The index refers to the index in the profile offsets collection as this contains fixed size entities which can be quickly looked up. The variable sized profile is then returned from that.

Parameters
profileOffsetscollection containing the profile offsets
profilescollection containing the profiles referenced by the profile offsets
indexof the profile to return
itemto set as the handle to the profile returned
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to the profile at the index

◆ fiftyoneDegreesProfileGetByProfileId()

fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByProfileId ( fiftyoneDegreesCollection * profileOffsets,
fiftyoneDegreesCollection * profiles,
uint32_t profileId,
fiftyoneDegreesCollectionItem * item,
fiftyoneDegreesException * exception )

Gets the profile associated with the profileId or NULL if there is no corresponding profile.

Parameters
profileOffsetscollection containing the profile offsets (with profile ID)
profilescollection containing the profiles referenced by the profile offsets
profileIdthe unique id of the profile to fetch
itemto set as the handle to the profile returned
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to the profile or NULL

◆ fiftyoneDegreesProfileGetByProfileIdIndirect()

fiftyoneDegreesProfile * fiftyoneDegreesProfileGetByProfileIdIndirect ( fiftyoneDegreesCollection * profileOffsets,
fiftyoneDegreesCollection * profiles,
uint32_t profileId,
fiftyoneDegreesCollectionItem * outProfileItem,
fiftyoneDegreesException * exception )

Gets the profile from the profiles collection with the profileId or NULL if there is no corresponding profile.

Parameters
profileOffsetscollection containing the profile offsets (without ID)
profilescollection containing the profiles referenced by the profile offsets
profileIdthe unique id of the profile to fetch
outProfileItempointer to the item to store profile reference in
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to the profile or NULL

◆ fiftyoneDegreesProfileGetFinalSize()

uint32_t fiftyoneDegreesProfileGetFinalSize ( const void * initial,
fiftyoneDegreesException *const exception )

Gets size of Profile with trailing values.

Parameters
initialpointer to profile "head"
Returns
full (with tail) struct size

◆ fiftyoneDegreesProfileGetOffsetForProfileId()

uint32_t * fiftyoneDegreesProfileGetOffsetForProfileId ( fiftyoneDegreesCollection * profileOffsets,
uint32_t profileId,
uint32_t * profileOffset,
fiftyoneDegreesException * exception )

Gets the offset in the profiles collection for the profile with the profileId or NULL if there is no corresponding profile.

Parameters
profileOffsetscollection containing the profile offsets (with ID)
profileIdthe unique id of the profile to fetch
profileOffsetpointer to the integer to set the offset in
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to the profile offset or NULL

◆ fiftyoneDegreesProfileIterateProfilesForPropertyAndValue()

uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyAndValue ( fiftyoneDegreesCollection * strings,
fiftyoneDegreesCollection * properties,
fiftyoneDegreesCollection * values,
fiftyoneDegreesCollection * profiles,
fiftyoneDegreesCollection * profileOffsets,
const char * propertyName,
const char * valueName,
void * state,
fiftyoneDegreesProfileIterateMethod callback,
fiftyoneDegreesException * exception )

Iterate all profiles which contain the specified value, calling the callback method for each.

Parameters
stringscollection containing the strings referenced properties and values
propertiescollection containing all properties
valuescollection containing all values
profilescollection containing the profiles referenced by the profile offsets
profileOffsetscollection containing all profile offsets
propertyNamename of the property the value relates to
valueNamename of the value to iterate the profiles for
statepointer to data needed by the callback method
callbackmethod to be called for each matching profile
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
the number matching profiles which have been iterated

◆ fiftyoneDegreesProfileIterateProfilesForPropertyWithTypeAndValue()

uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyWithTypeAndValue ( fiftyoneDegreesCollection * strings,
fiftyoneDegreesCollection * properties,
fiftyoneDegreesCollection * propertyTypes,
fiftyoneDegreesCollection * values,
fiftyoneDegreesCollection * profiles,
fiftyoneDegreesCollection * profileOffsets,
const char * propertyName,
const char * valueName,
void * state,
fiftyoneDegreesProfileIterateMethod callback,
fiftyoneDegreesException * exception )

Iterate all profiles which contain the specified value, calling the callback method for each.

Parameters
stringscollection containing the strings referenced properties and values
propertiescollection containing all properties
propertyTypescollection containing types for all properties
valuescollection containing all values
profilescollection containing the profiles referenced by the profile offsets
profileOffsetscollection containing all profile offsets (with IDs)
propertyNamename of the property the value relates to
valueNamename of the value to iterate the profiles for
statepointer to data needed by the callback method
callbackmethod to be called for each matching profile
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
the number matching profiles which have been iterated

◆ fiftyoneDegreesProfileIterateProfilesForPropertyWithTypeAndValueAndOffsetExtractor()

uint32_t fiftyoneDegreesProfileIterateProfilesForPropertyWithTypeAndValueAndOffsetExtractor ( fiftyoneDegreesCollection * strings,
fiftyoneDegreesCollection * properties,
fiftyoneDegreesCollection * propertyTypes,
fiftyoneDegreesCollection * values,
fiftyoneDegreesCollection * profiles,
const fiftyoneDegreesCollection * profileOffsets,
fiftyoneDegreesProfileOffsetValueExtractor offsetValueExtractor,
const char * propertyName,
const char * valueName,
void * state,
fiftyoneDegreesProfileIterateMethod callback,
fiftyoneDegreesException * exception )

Iterate all profiles which contain the specified value, calling the callback method for each.

Parameters
stringscollection containing the strings referenced properties and values
propertiescollection containing all properties
propertyTypescollection containing types for all properties
valuescollection containing all values
profilescollection containing the profiles referenced by the profile offsets
profileOffsetscollection containing all profile offsets (any form)
offsetValueExtractorconverts profileOffsets value to "pure" offset
propertyNamename of the property the value relates to
valueNamename of the value to iterate the profiles for
statepointer to data needed by the callback method
callbackmethod to be called for each matching profile
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
the number matching profiles which have been iterated

◆ fiftyoneDegreesProfileIterateValueIndexes()

uint32_t fiftyoneDegreesProfileIterateValueIndexes ( fiftyoneDegreesProfile * profile,
fiftyoneDegreesPropertiesAvailable * available,
fiftyoneDegreesCollection * values,
void * state,
fiftyoneDegreesProfileIterateValueIndexesMethod callback,
fiftyoneDegreesException * exception )

Calls the callback for every value index available for the profile.

Parameters
profileto return value indexes for
availablerequired properties
valuescollection containing all values
statepointer to data needed by the callback method
callbackmethod to be called for each value index
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
number of times the callback was called.

◆ fiftyoneDegreesProfileIterateValuesForProperty()

uint32_t fiftyoneDegreesProfileIterateValuesForProperty ( const fiftyoneDegreesCollection * values,
const fiftyoneDegreesProfile * profile,
const fiftyoneDegreesProperty * property,
void * state,
fiftyoneDegreesProfileIterateMethod callback,
fiftyoneDegreesException * exception )

Iterate over all values contained in the profile which relate to the specified property, calling the callback method for each.

Parameters
valuescollection containing all values
profilepointer to the profile to iterate the values of
propertywhich the values must relate to
statepointer containing data needed for the callback method
callbackmethod to be called for each value
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
the number of matching values which have been iterated

◆ fiftyoneDegreesProfileIterateValuesForPropertyWithIndex()

uint32_t fiftyoneDegreesProfileIterateValuesForPropertyWithIndex ( const fiftyoneDegreesCollection * values,
fiftyoneDegreesIndicesPropertyProfile * index,
uint32_t availablePropertyIndex,
const fiftyoneDegreesProfile * profile,
const fiftyoneDegreesProperty * property,
void * state,
fiftyoneDegreesProfileIterateMethod callback,
fiftyoneDegreesException * exception )

Iterate over all values contained in the profile which relate to the specified property and profile, calling the callback method for each.

Parameters
valuescollection containing all values
indexarray of property and profile first value indexes
profileIndexthe index of the profile
availablePropertyIndexthe index of the available property
propertywhich the values must relate to
statepointer containing data needed for the callback method
callbackmethod to be called for each value
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
the number of matching values which have been iterated

◆ fiftyoneDegreesProfileOffsetAsPureOffset()

uint32_t fiftyoneDegreesProfileOffsetAsPureOffset ( const void * rawProfileOffset)

Function that extracts "pure" profile offset from a value (that starts with a "pure" profile offset) inside profileOffsets collection.

Parameters
rawProfileOffseta "raw" value retrieved from profileOffsets
Returns
Offset to the profile in the profiles structure

◆ fiftyoneDegreesProfileOffsetToPureOffset()

uint32_t fiftyoneDegreesProfileOffsetToPureOffset ( const void * rawProfileOffset)

Function that extracts "pure" profile offset from a fiftyoneDegreesProfileOffset.

Parameters
rawProfileOffseta "raw" ProfileOffset retrieved from profileOffsets
Returns
Offset to the profile in the profiles structure

◆ fiftyoneDegreesProfileReadFromFile()

void * fiftyoneDegreesProfileReadFromFile ( const fiftyoneDegreesCollectionFile * file,
const fiftyoneDegreesCollectionKey * key,
fiftyoneDegreesData * data,
fiftyoneDegreesException * exception )

Read a profile from the file collection provided and store in the data pointer.

This method is used when creating a collection from file.

Parameters
filecollection to read from
keyof the profile in the collection
datato store the resulting profile in
exceptionpointer to an exception data structure to be used if an exception occurs. See exceptions.h
Returns
pointer to the profile allocated within the data structure