\r\n

51Degrees Device Detection C/C++  4.4

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 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...

Functions

fiftyoneDegreesProfile *  fiftyoneDegreesProfileGetByProfileId (fiftyoneDegreesCollection *profileOffsets, fiftyoneDegreesCollection *profiles, const 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, uint32_t offset, fiftyoneDegreesData *data, fiftyoneDegreesException *exception)
Read a profile from the file collection provided and store in the data pointer. More...
uint32_t  fiftyoneDegreesProfileIterateValuesForProperty (fiftyoneDegreesCollection *values, fiftyoneDegreesProfile *profile, 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  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, const 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...

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

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,
const 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
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

◆ fiftyoneDegreesProfileGetOffsetForProfileId()

uint32_t* fiftyoneDegreesProfileGetOffsetForProfileId ( fiftyoneDegreesCollection *   profileOffsets,
const 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
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

◆ fiftyoneDegreesProfileIterateValuesForProperty()

uint32_t fiftyoneDegreesProfileIterateValuesForProperty ( fiftyoneDegreesCollection *   values,
fiftyoneDegreesProfile *   profile,
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

◆ fiftyoneDegreesProfileReadFromFile()

void* fiftyoneDegreesProfileReadFromFile ( const fiftyoneDegreesCollectionFile *   file,
uint32_t   offset,
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
offset - 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