Detailed Description
Structure returned by a device detection engine's process method(s), containing values.
Introduction
Results are the structure returned by an engine's process method(s) and contains the values for the properties in the engine. The base structure contains only the essential element of a data set, which is needed to return values. Any engine can extend this structure to add any additional elements which may be needed to format or return values.
The data set pointer is a managed resource, meaning that while the results exist, the data set will not be freed by the resource manager. This ensures that values contained in the data set used for processing can always be returned.
First read
When the caller named the properties the data set was created with, populating the results walks the graph of each component they answer for, as fiftyoneDegreesResultsWalkWhenPopulated decides, and the call that populates them reports a walk that fails. Otherwise populating the results walks no graph. Each component the results answer for is marked pending, and the first read of one of its properties walks the component's graph against the data set the results hold. A component is walked at most once each time the results are populated, so a walk that fails is not repeated, and the component's properties then read as if it had no profile. Anything that depends on every component, such as a value made from all of them or the items of the results read directly, needs fiftyoneDegreesResultsEvaluateAll first, which walks nothing when the results walked every graph as they were populated.
Overrides
Results can hold values from the evidence that override the values of properties. A read looks for one with fiftyoneDegreesResultsGetOverrideValues before it walks the property's component, so a property with an override value is read without walking the graph, and a component whose properties are only read from overrides is never walked.
Threads
A results structure is used by one thread at a time, because reading a value writes into the results, and when no properties were named the first read of a component's property walks the component's graph. Different results can be used on different threads at once, and the resource manager they come from can be shared, unless the library is compiled with FIFTYONE_DEGREES_NO_THREADING.
For more info, see FiftyOneDegreesResults
Collaboration diagram for Device Detection Results:
Structs | |
| struct | fiftyoneDegreesResultUserAgent |
| Singular User-Agent result returned by a device detection process method. More... | |
| struct | fiftyoneDegreesResultsDeviceDetection |
| Device detection specific results structure which any device detection processing results should extend. More... | |
Functions | |
| void | fiftyoneDegreesResultsDeviceDetectionInit (fiftyoneDegreesResultsDeviceDetection *results, fiftyoneDegreesDataSetDeviceDetection *dataSet, uint32_t overridesCapacity) |
| Initialise a set of results by setting the data set they are associated with. | |
| void | fiftyoneDegreesResultsDeviceDetectionFree (fiftyoneDegreesResultsDeviceDetection *results) |
| Free any extra data within the results. | |
| void | fiftyoneDegreesResultsUserAgentReset (const fiftyoneDegreesConfigDeviceDetection *config, fiftyoneDegreesResultUserAgent *result) |
| Reset the matched and target User-Agents in the result. | |
| void | fiftyoneDegreesResultsUserAgentInit (const fiftyoneDegreesConfigDeviceDetection *config, fiftyoneDegreesResultUserAgent *result) |
| Initialise a single result using the configuration provided. | |
| void | fiftyoneDegreesResultsUserAgentFree (fiftyoneDegreesResultUserAgent *result) |
| Free the memory allocated in a single result,. | |
Function Documentation
◆ fiftyoneDegreesResultsDeviceDetectionFree()
| void fiftyoneDegreesResultsDeviceDetectionFree | ( | fiftyoneDegreesResultsDeviceDetection * | results | ) |
Free any extra data within the results.
This calls the fiftyoneDegreesOverrideValuesFree method to free the overrides within the results.
- Parameters
-
results pointer to the results to free
◆ fiftyoneDegreesResultsDeviceDetectionInit()
| void fiftyoneDegreesResultsDeviceDetectionInit | ( | fiftyoneDegreesResultsDeviceDetection * | results, |
| fiftyoneDegreesDataSetDeviceDetection * | dataSet, | ||
| uint32_t | overridesCapacity ) |
Initialise a set of results by setting the data set they are associated with.
Also initialise the overrides using the fiftyoneDegreesOverrideValuesCreate method.
- Parameters
-
results pointer to the results to initialise dataSet pointer to the data set which will be using the results overridesCapacity size of the overrides structure
◆ fiftyoneDegreesResultsUserAgentFree()
| void fiftyoneDegreesResultsUserAgentFree | ( | fiftyoneDegreesResultUserAgent * | result | ) |
Free the memory allocated in a single result,.
This frees the matched User-Agent.
- Parameters
-
result pointer to the result to free
◆ fiftyoneDegreesResultsUserAgentInit()
| void fiftyoneDegreesResultsUserAgentInit | ( | const fiftyoneDegreesConfigDeviceDetection * | config, |
| fiftyoneDegreesResultUserAgent * | result ) |
Initialise a single result using the configuration provided.
This allocates the memory needed, initialises NULL pointers, and sets all characters of the matched User-Agent to '_'.
- Parameters
-
config pointer to the configuration to use result pointer to the result to initialise
◆ fiftyoneDegreesResultsUserAgentReset()
| void fiftyoneDegreesResultsUserAgentReset | ( | const fiftyoneDegreesConfigDeviceDetection * | config, |
| fiftyoneDegreesResultUserAgent * | result ) |
Reset the matched and target User-Agents in the result.
This means nulling the target User-Agent, and setting all characters of the matched User-Agent to '_'.
- Parameters
-
config pointer to the configuration to use result pointer to the result to reset
