\r\n

51Degrees Device Detection C/C++  4.4

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

FiftyoneDegrees::DeviceDetection::Hash::ResultsHash Class Reference

Detailed Description

Encapsulates the results of a Hash device detection engine's processing.

The class is constructed using an instance of a C fiftyoneDegreesResultsHash structure which are then referenced to return associated values and metrics.

Additional get methods are included on top of the device detection methods to return Hash specific metrics.

The key used to get the value for a property can be either the name of the property, or the index of the property in the required properties structure.

Results instances should only be created by an Engine.

Usage Example

ResultsHash *results;
// Get the maximum drift used to arrive at the result
int drift = results->getDrift();
// Delete the results
delete results;
Examples
Hash/GettingStarted.cpp, Hash/MatchMetrics.cpp, and Hash/StronglyTyped.cpp.

Inheritance diagram for FiftyoneDegrees::DeviceDetection::Hash::ResultsHash:

[legend]

Collaboration diagram for FiftyoneDegrees::DeviceDetection::Hash::ResultsHash:

[legend]

Public Member Functions

Constructors and Destructors

 ResultsHash (fiftyoneDegreesResultsHash *results, shared_ptr< fiftyoneDegreesResourceManager > manager)
Create a new instance of Results from the results structure provided. More...
virtual  ~ResultsHash ()
Release the reference to the underlying results and and associated data set.

Metric Getters

string  getDeviceId (uint32_t resultIndex) const
Returns the unique device id if the Id property was included in the required list of properties when the Provider was constructed. More...
int  getIterations () const
Get the number of iterations carried out in order to find a match. More...
int  getDrift () const
Returns the maximum drift for a matched substring from the character position where it was expected to be found. More...
int  getDrift (uint32_t resultIndex) const
Returns the drift for a matched substring from the character position where it was expected to be found. More...
int  getMatchedNodes () const
Returns the number of hash nodes matched within the evidence. More...
int  getDifference () const
Returns the total difference between the results returned and the target User-Agents. More...
int  getDifference (uint32_t resultIndex) const
Returns the difference between the result returned and the target User-Agent. More...
int  getMethod () const
Returns the method used to determine the match result. More...
int  getMethod (uint32_t resultIndex) const
Returns the method used to determine the match result. More...
string  getTrace () const
Get the trace route in a readable format showing the hash nodes which were visited during processing. More...
string  getTrace (uint32_t resultIndex) const
Get the trace route in a readable format for the result index specified showing the hash nodes which were visited during processing. More...

DeviceDetection::ResultsDeviceDetection Implementation

string  getDeviceId () const
Returns the unique device id if the Id property was included in the required list of properties when the Provider was constructed. More...
int  getUserAgents () const
Returns the number of different User-Agents that were used in the results. More...
string  getUserAgent (int resultIndex) const
Returns relevant parts of the User-Agent which most closely matched the target User-Agent if the ConfigDeviceDetection::setUpdateMatchedUserAgent flag was set to true in the configuration. More...

Public Member Functions inherited from FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection

 ResultsDeviceDetection (fiftyoneDegreesResultsDeviceDetection *results, shared_ptr< fiftyoneDegreesResourceManager > manager)
Create a new instance of Results from the results structure provided. More...

Public Member Functions inherited from FiftyoneDegrees::Common::ResultsBase

 ResultsBase (fiftyoneDegreesResultsBase *results, shared_ptr< fiftyoneDegreesResourceManager > manager)
Create a new instance of Results from the results structure provided. More...
virtual  ~ResultsBase ()
Free any memory associated with the results and release any resource handles.
int  getAvailableProperties () const
Get the number of available properties contained in the Results instance. More...
bool  containsProperty (const string &propertyName) const
Get whether or not this results instance contains a value for the requested property. More...
vector< string >  getProperties () const
Get the names of the properties which are available in the Results instance. More...
string  getPropertyName (int requiredPropertyIndex) const
Get the name of the property at the require property index, or an empty string if the required property index is invalid. More...
Value< vector< string > >  getValues (const char *propertyName)
Get a vector with all values associated with the required property name. More...
Value< vector< string > >  getValues (const string &propertyName)
Get a vector with all values associated with the required property name. More...
Value< vector< string > >  getValues (const string *propertyName)
Get a vector with all values associated with the required property name. More...
Value< vector< string > >  getValues (int requiredPropertyIndex)
Get a vector with all values associated with the required property index. More...
Value< string >  getValueAsString (const char *propertyName)
Get a string representation of the value associated with the required property name. More...
Value< string >  getValueAsString (const string &propertyName)
Get a string representation of the value associated with the required property name. More...
Value< string >  getValueAsString (const string *propertyName)
Get a string representation of the value associated with the required property name. More...
virtual Value< string >  getValueAsString (int requiredPropertyIndex)
Get a string representation of the value associated with the required property index. More...
Value< bool >  getValueAsBool (const char *propertyName)
Get a boolean representation of the value associated with the required property name. More...
Value< bool >  getValueAsBool (const string &propertyName)
Get a boolean representation of the value associated with the required property name. More...
Value< bool >  getValueAsBool (const string *propertyName)
Get a boolean representation of the value associated with the required property name. More...
virtual Value< bool >  getValueAsBool (int requiredPropertyIndex)
Get a boolean representation of the value associated with the required property index. More...
Value< int >  getValueAsInteger (const char *propertyName)
Get an integer representation of the value associated with the required property name. More...
Value< int >  getValueAsInteger (const string &propertyName)
Get an integer representation of the value associated with the required property name. More...
Value< int >  getValueAsInteger (const string *propertyName)
Get an integer representation of the value associated with the required property name. More...
virtual Value< int >  getValueAsInteger (int requiredPropertyIndex)
Get an integer representation of the value associated with the required property index. More...
Value< double >  getValueAsDouble (const char *propertyName)
Get a double representation of the value associated with the required property name. More...
Value< double >  getValueAsDouble (const string &propertyName)
Get a double representation of the value associated with the required property name. More...
Value< double >  getValueAsDouble (const string *propertyName)
Get a double representation of the value associated with the required property name. More...
virtual Value< double >  getValueAsDouble (int requiredPropertyIndex)
Get a double representation of the value associated with the required property index. More...

Protected Member Functions

void  getValuesInternal (int requiredPropertyIndex, vector< string > &values)
Get the values for the index in required properties and add them to the values vector supplied. More...
bool  hasValuesInternal (int requiredPropertyIndex)
Get whether or not there are valid values available for the property identified by its index in the required properties. More...
const char *  getNoValueMessageInternal (fiftyoneDegreesResultsNoValueReason reason)
Get the message explaining the reason for missing values. More...
fiftyoneDegreesResultsNoValueReason  getNoValueReasonInternal (int requiredPropertyIndex)
Get the reason for values not being available. More...

Protected Member Functions inherited from FiftyoneDegrees::Common::ResultsBase

int  getRequiredPropertyIndex (const char *propertyName)
Get the index in the available properties for the property name provided. More...

Friends

class  ::EngineHashTests

Constructor & Destructor Documentation

◆ ResultsHash()

FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::ResultsHash ( fiftyoneDegreesResultsHash *   results,
shared_ptr< fiftyoneDegreesResourceManager >   manager  
)

Create a new instance of Results from the results structure provided.

This method should only be called from inside an engine's process method.

Parameters
results - pointer to the underlying results structure
manager - shared pointer to the manager which manages the data set used to create the results. This is needed for thread-safe operation, see local variable description for more info.

Member Function Documentation

◆ getDeviceId() [1/2]

string FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getDeviceId ( uint32_t   resultIndex ) const

Returns the unique device id if the Id property was included in the required list of properties when the Provider was constructed.

Parameters
resultIndex - index of the individual User-Agent in the results
Returns
device id string
Examples
Hash/GettingStarted.cpp, and Hash/MatchMetrics.cpp.

◆ getDeviceId() [2/2]

string FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getDeviceId ( ) const
virtual

Returns the unique device id if the Id property was included in the required list of properties when the Provider was constructed.

Returns
profile ids separated with a '-' character

Implements FiftyoneDegrees::DeviceDetection::ResultsDeviceDetection.

◆ getDifference() [1/2]

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getDifference ( ) const

Returns the total difference between the results returned and the target User-Agents.

Where multiple evidence items are used, this is the total difference.

Returns
total difference
Examples
Hash/MatchMetrics.cpp.

◆ getDifference() [2/2]

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getDifference ( uint32_t   resultIndex ) const

Returns the difference between the result returned and the target User-Agent.

Parameters
resultIndex - index of the individual User-Agent in the results
Returns
individual difference

◆ getDrift() [1/2]

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getDrift ( ) const

Returns the maximum drift for a matched substring from the character position where it was expected to be found.

The higher this value, the less accurate the results should be considered.

Returns
int maximum drift
Examples
Hash/MatchMetrics.cpp.

◆ getDrift() [2/2]

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getDrift ( uint32_t   resultIndex ) const

Returns the drift for a matched substring from the character position where it was expected to be found.

The higher this value, the lass accurate the results should be considered.

Parameters
resultIndex - index of the individual User-Agent in the results
Returns
individual drift

◆ getIterations()

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getIterations ( ) const

Get the number of iterations carried out in order to find a match.

This is the number of nodes in the graph which have been visited.

Returns
number of iterations
Examples
Hash/MatchMetrics.cpp.

◆ getMatchedNodes()

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getMatchedNodes ( ) const

Returns the number of hash nodes matched within the evidence.

Returns

◆ getMethod() [2/2]

int FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getMethod ( uint32_t   resultIndex ) const

Returns the method used to determine the match result.

See fiftyoneDegreesHashMatchMethod

Parameters
resultIndex - index of the individual User-Agent in the results
Returns
individual method used

◆ getNoValueMessageInternal()

const char* FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getNoValueMessageInternal ( fiftyoneDegreesResultsNoValueReason   reason )
protected virtual

Get the message explaining the reason for missing values.

This can differ slightly between APIs, so the implementation of this is left up to the extending class. This is used when populating a Value instance to return.

Parameters
reason - the enum indicating the reason no values are available
Returns
string explaining the reason in more detail

Implements FiftyoneDegrees::Common::ResultsBase.

◆ getNoValueReasonInternal()

fiftyoneDegreesResultsNoValueReason FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getNoValueReasonInternal ( int   requiredPropertyIndex )
protected virtual

Get the reason for values not being available.

This is implemented by the extending class and is called when the hasValuesInternal method returns false.

Parameters
requiredPropertyIndex - index in the available properties
Returns
enum indicating the reason for values not being available

Implements FiftyoneDegrees::Common::ResultsBase.

◆ getTrace() [1/2]

string FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getTrace ( ) const

Get the trace route in a readable format showing the hash nodes which were visited during processing.

Returns
trace route string

◆ getTrace() [2/2]

string FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getTrace ( uint32_t   resultIndex ) const

Get the trace route in a readable format for the result index specified showing the hash nodes which were visited during processing.

Parameters
resultIndex - index to get the trace route for
Returns
trace route string

◆ getValuesInternal()

void FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::getValuesInternal ( int   requiredPropertyIndex,
vector< string > &   values  
)
protected virtual

Get the values for the index in required properties and add them to the values vector supplied.

This is implemented by extending classes.

Parameters
requiredPropertyIndex - index in the available properties
values - vector to populate with the values for the property

Implements FiftyoneDegrees::Common::ResultsBase.

◆ hasValuesInternal()

bool FiftyoneDegrees::DeviceDetection::Hash::ResultsHash::hasValuesInternal ( int   requiredPropertyIndex )
protected virtual

Get whether or not there are valid values available for the property identified by its index in the required properties.

This is implemented by extending classes, and used when populating a Value instance to return.

Parameters
requiredPropertyIndex - index in the available properties
Returns
true if there are values available for the property

Implements FiftyoneDegrees::Common::ResultsBase.


The documentation for this class was generated from the following file:
  • /home/runner/work/device-detection-cxx/device-detection-cxx/common/device-detection-cxx/src/hash/ResultsHash.hpp