\r\n

51Degrees Device Detection C/C++  4.5

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(*  fiftyoneDegreesProfileOffsetValueExtractor) (const void *rawProfileOffset)
Function that extracts "pure" profile offset from a value inside profileOffsets collection. More...
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. More...
typedef bool(*  fiftyoneDegreesProfileIterateValueIndexesMethod) (void *state, uint32_t valueIndex)
Definition of a callback function which is passed the next values index for the profile. More...

Functions

uint32_t  fiftyoneDegreesProfileOffsetToPureOffset (const void *rawProfileOffset)
Function that extracts "pure" profile offset from a fiftyoneDegreesProfileOffset. More...
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. More...
uint32_t  fiftyoneDegreesProfileGetFinalSize (const void *initial, fiftyoneDegreesException *const exception)
Gets size of Profile with trailing values. More...
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. More...
fiftyoneDegreesProfile *  fiftyoneDegreesProfileGetByIndex (fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, uint32_t index, fiftyoneDegreesCollectionItem *item, fiftyoneDegreesException *exception)
Gets a pointer to the profile at the index provided. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...

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
state - pointer to data needed by the method
item - to 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
state - pointer to data needed by the method
valueIndex - for 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
rawProfileOffset - a "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
profileOffsets - collection containing the profile offsets
profiles - collection containing the profiles referenced by the profile offsets
index - of the profile to return
item - to set as the handle to the profile returned
exception - pointer 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
profileOffsets - collection containing the profile offsets (with profile ID)
profiles - collection containing the profiles referenced by the profile offsets
profileId - the unique id of the profile to fetch
item - to set as the handle to the profile returned
exception - pointer 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
profileOffsets - collection containing the profile offsets (without ID)
profiles - collection containing the profiles referenced by the profile offsets
profileId - the unique id of the profile to fetch
outProfileItem - pointer to the item to store profile reference in
exception - pointer 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
initial - pointer 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
profileOffsets - collection containing the profile offsets (with ID)
profileId - the unique id of the profile to fetch
profileOffset - pointer to the integer to set the offset in
exception - pointer 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
strings - collection containing the strings referenced properties and values
properties - collection containing all properties
values - collection containing all values
profiles - collection containing the profiles referenced by the profile offsets
profileOffsets - collection containing all profile offsets
propertyName - name of the property the value relates to
valueName - name of the value to iterate the profiles for
state - pointer to data needed by the callback method
callback - method to be called for each matching profile
exception - pointer 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
strings - collection containing the strings referenced properties and values
properties - collection containing all properties
propertyTypes - collection containing types for all properties
values - collection containing all values
profiles - collection containing the profiles referenced by the profile offsets
profileOffsets - collection containing all profile offsets (with IDs)
propertyName - name of the property the value relates to
valueName - name of the value to iterate the profiles for
state - pointer to data needed by the callback method
callback - method to be called for each matching profile
exception - pointer 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
strings - collection containing the strings referenced properties and values
properties - collection containing all properties
propertyTypes - collection containing types for all properties
values - collection containing all values
profiles - collection containing the profiles referenced by the profile offsets
profileOffsets - collection containing all profile offsets (any form)
offsetValueExtractor - converts profileOffsets value to "pure" offset
propertyName - name of the property the value relates to
valueName - name of the value to iterate the profiles for
state - pointer to data needed by the callback method
callback - method to be called for each matching profile
exception - pointer 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
profile - to return value indexes for
available - required properties
values - collection containing all values
state - pointer to data needed by the callback method
callback - method to be called for each value index
exception - pointer 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
values - collection containing all values
profile - pointer to the profile to iterate the values of
property - which the values must relate to
state - pointer containing data needed for the callback method
callback - method to be called for each value
exception - pointer 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
values - collection containing all values
index - array of property and profile first value indexes
profileIndex - the index of the profile
availablePropertyIndex - the index of the available property
property - which the values must relate to
state - pointer containing data needed for the callback method
callback - method to be called for each value
exception - pointer 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
rawProfileOffset - a "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
rawProfileOffset - a "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
file - collection to read from
key - of the profile in the collection
data - to store the resulting profile in
exception - pointer 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
On This Page