51Degrees Device Detection C/C++  4.1

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

FiftyoneDegrees::DeviceDetection::Hash::ConfigHash Class Reference

Detailed Description

C++ class wrapper for the fiftyoneDegreesConfigHash configuration structure.

See hash.h.

This extends the ConfigDeviceDetection class to add Hash specific configuration options.

Configuration options are set using setter methods and fetched using corresponding getter methods. The names are self explanatory.

Usage Example

using namespace FiftyoneDegrees::Common;
string dataFilePath;
// Construct a new configuration
ConfigHash *config = new ConfigHash();
// Configure the engine to load the entire data set into memory
// for maximum performance, and set the maximum drift and
// difference to allow when finding substring hashes
config->setDrift(2);
config->setDifference(10);
// Use the configuration when constructing an engine
EngineHash *engine = new EngineHash(
dataFilePath,
config,
properties);
Examples
Hash/GettingStarted.cpp, Hash/MetaData.cpp, Hash/ReloadFromFile.cpp, Hash/ReloadFromMemory.cpp, and Hash/StronglyTyped.cpp.

Inheritance diagram for FiftyoneDegrees::DeviceDetection::Hash::ConfigHash:

[legend]

Collaboration diagram for FiftyoneDegrees::DeviceDetection::Hash::ConfigHash:

[legend]

Public Member Functions

Constructors

 ConfigHash ()
Construct a new instance using the default configuration fiftyoneDegreesHashDefaultConfig.
 ConfigHash (fiftyoneDegreesConfigHash *config)
Construct a new instance using the configuration provided. More...

Setters

void  setHighPerformance ()
Set the collections to use the high performance configuration. More...
void  setBalanced ()
Set the collections to use the balanced configuration. More...
void  setBalancedTemp ()
Set the collections to use the balanced temp configuration. More...
void  setLowMemory ()
Set the collections to use the low memory configuration. More...
void  setMaxPerformance ()
Set the collections to use the entirely in memory configuration. More...
void  setDifference (int32_t difference)
Set the maximum difference in hash value to allow when finding hashes during the processing of HTTP headers. More...
void  setDrift (int32_t drift)
Set the maximum drift to allow when matching hashes. More...
void  setUsePerformanceGraph (bool use)
Set whether or not the performance optimized graph is used for processing. More...
void  setUsePredictiveGraph (bool use)
Set whether or not the predictive optimized graph is used for processing. More...
void  setConcurrency (uint16_t concurrency)
Set the expected concurrent requests for all the data set's collections. More...
void  setTraceRoute (bool shouldTrace)
Sets whether the route through each graph should be traced during processing. More...

Getters

CollectionConfig  getStrings ()
Get the configuration for the strings collection. More...
CollectionConfig  getProperties ()
Get the configuration for the properties collection. More...
CollectionConfig  getValues ()
Get the configuration for the values collection. More...
CollectionConfig  getProfiles ()
Get the configuration for the profiles collection. More...
CollectionConfig  getNodes ()
Get the configuration for the nodes collection. More...
CollectionConfig  getProfileOffsets ()
Get the configuration for the profile offsets collection. More...
int  getDrift ()
Gets the drift value that should be used for all device detection requests. More...
int  getDifference ()
Gets the difference value that should be used for all device detection requests. More...
bool  getUsePerformanceGraph ()
Get whether or not the performance optimized graph is used for processing. More...
bool  getUsePredictiveGraph ()
Get whether or not the predicitive optimized graph is used for processing. More...
uint16_t  getConcurrency ()
Get the lowest concurrency value in the list of possible concurrencies. More...
bool  getTraceRoute ()
Gets whether the route through each graph should be traced during processing. More...
fiftyoneDegreesConfigHash *  getConfig ()
Gets the configuration data structure for use in C code. More...

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

 ConfigDeviceDetection (fiftyoneDegreesConfigDeviceDetection *config)
Constructs a new instance of the configuration with a reference to the C configuration provided. More...
void  setUpdateMatchedUserAgent (bool update)
Set whether or not the matched User-Agent should be constructed. More...
void  setMaxMatchedUserAgentLength (int length)
Set the maximum length string to be allocated to the matched User-Agent. More...
void  setAllowUnmatched (bool allow)
Set whether there should be at least one matched hash node (or substring) in order for the results to be considered valid. More...
bool  getUpdateMatchedUserAgent ()
Gets whether the characters matched during processing should be stored in results. More...
int  getMaxMatchedUserAgentLength ()
If the matched User-Agent characters should be stored the maximum number which should be available. More...
bool  getAllowUnmatched ()
Get whether there should be at least one matched hash node (or substring) in order for the results to be considered valid. More...

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

 ConfigBase (fiftyoneDegreesConfigBase *config)
Constructs a new instance of the configuration with a reference to the C configuration provided. More...
virtual  ~ConfigBase ()
Free any memory associated with temporary directories.
void  setUseUpperPrefixHeaders (bool use)
Set whether or not the HTTP header field might be prefixed with 'HTTP_'. More...
void  setUseTempFile (bool use)
Set whether or not a temporary file should be created from the original data file and used to initialise the data set. More...
void  setReuseTempFile (bool reuse)
Set whether or not a temporary file that already exists for a master file should be reused by another process. More...
void  setTempDirectories (vector< string > tempDirs)
Sets a collection of temporary directories to use if temporary file operation is required in the order in which the directories should be used. More...
bool  getUseUpperPrefixHeaders ()
Get whether or not an HTTP_ upper case prefixes should be considered when evaluating HTTP headers. More...
bool  getUseTempFile ()
Get whether or not a temporary file should be created from the original data file and used to initialise the data set. More...
bool  getReuseTempFile ()
Get whether temporary files can be reused across multiple processes. More...
vector< string >  getTempDirectories ()
Gets a vector of temporary directory strings which should be used to store temporary files. More...

Constructor & Destructor Documentation

◆ ConfigHash()

FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::ConfigHash ( fiftyoneDegreesConfigHash *   config )

Construct a new instance using the configuration provided.

The values are copied and no reference to the provided parameter is retained.

Parameters
config - pointer to the configuration to copy

Member Function Documentation

◆ getConcurrency()

uint16_t FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getConcurrency ( )
virtual

Get the lowest concurrency value in the list of possible concurrencies.

Returns
a 16 bit integer with the minimum concurrency value.

Reimplemented from FiftyoneDegrees::Common::ConfigBase.

◆ getConfig()

fiftyoneDegreesConfigHash* FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getConfig ( )

Gets the configuration data structure for use in C code.

Used internally.

Returns
pointer to the underlying configuration data structure.

◆ getDifference()

int FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getDifference ( )

Gets the difference value that should be used for all device detection requests.

Returns
the difference value to use for all device detection.

◆ getDrift()

int FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getDrift ( )

Gets the drift value that should be used for all device detection requests.

Returns
the drift value to use for all device detection.

◆ getNodes()

CollectionConfig FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getNodes ( )

Get the configuration for the nodes collection.

Returns
nodes collection configuration

◆ getProfileOffsets()

CollectionConfig FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getProfileOffsets ( )

Get the configuration for the profile offsets collection.

Returns
profile offsets collection configuration

◆ getProfiles()

CollectionConfig FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getProfiles ( )

Get the configuration for the profiles collection.

Returns
profiles collection configuration

◆ getProperties()

CollectionConfig FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getProperties ( )

Get the configuration for the properties collection.

Returns
properties collection configuration

◆ getStrings()

CollectionConfig FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getStrings ( )

Get the configuration for the strings collection.

Returns
strings collection configuration

◆ getTraceRoute()

bool FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getTraceRoute ( )

Gets whether the route through each graph should be traced during processing.

The trace can then be printed to debug the matching after the fact. Note that this option is only considered when compiled in debug mode.

Returns
true if graphs should be traced

◆ getUsePerformanceGraph()

bool FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getUsePerformanceGraph ( )

Get whether or not the performance optimized graph is used for processing.

Returns
true if the performance graph will be used

◆ getUsePredictiveGraph()

bool FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getUsePredictiveGraph ( )

Get whether or not the predicitive optimized graph is used for processing.

Returns
true if the performance graph will be used

◆ getTraceRoute()

bool FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getTraceRoute ( )

Gets whether the route through each graph should be traced during processing.

The trace can then be printed to debug the matching after the fact. Note that this option is only considered when compiled in debug mode.

Returns
true if graphs should be traced

◆ getUsePerformanceGraph()

bool FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getUsePerformanceGraph ( )

Get whether or not the performance optimized graph is used for processing.

Returns
true if the performance graph will be used

◆ getUsePredictiveGraph()

bool FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getUsePredictiveGraph ( )

Get whether or not the predicitive optimized graph is used for processing.

Returns
true if the performance graph will be used

◆ getValues()

CollectionConfig FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::getValues ( )

Get the configuration for the values collection.

Returns
values collection configuration

◆ setConcurrency()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setConcurrency ( uint16_t   concurrency )

Set the expected concurrent requests for all the data set's collections.

All collections in the data set which use cached elements will have their caches constructued to allow for the concurrency value set here. See CollectionConfig::setConcurrency

Parameters
concurrency - expected concurrent requests
Examples
Hash/ReloadFromFile.cpp, and Hash/ReloadFromMemory.cpp.

◆ setDifference()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setDifference ( int32_t   difference )

Set the maximum difference in hash value to allow when finding hashes during the processing of HTTP headers.

If the difference is exceeded, the result is considered invalid and values will not be returned. By default this is 0.

Parameters
difference - to set

◆ setDrift()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setDrift ( int32_t   drift )

Set the maximum drift to allow when matching hashes.

If the drift is exceeded, the result is considered invalid and values will not be returned. By default this is 0.

Parameters
drift - to set

◆ setMaxPerformance()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setMaxPerformance ( )

Set the collections to use the entirely in memory configuration.

See fiftyoneDegreesHashInMemoryConfig

◆ setTraceRoute()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setTraceRoute ( bool   shouldTrace )

Sets whether the route through each graph should be traced during processing.

The trace can then be printed to debug the matching after the fact. Note that this option is only considered when compiled in debug mode.

Parameters
shouldTrace - true if graphs should be traced

◆ setUsePerformanceGraph()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setUsePerformanceGraph ( bool   use )

Set whether or not the performance optimized graph is used for processing.

When processing evidence, the performance graph is optimised to find an answer as quick as possible. However, this can be at the expense of finding the best match for evidence which was not in the training data. If the predictive graph is also enabled, it will be used next if there was no match in the performance graph.

Parameters
use - true if the performance graph should be used

◆ setUsePredictiveGraph()

void FiftyoneDegrees::DeviceDetection::Hash::ConfigHash::setUsePredictiveGraph ( bool   use )

Set whether or not the predictive optimized graph is used for processing.

When processing evidence, the predictive graph is optimised to find the best answer for evidence which was not in the training data. However, this is at the expense of processing time, as more possibilities are taken into consideration.

Parameters
use - true if the predictive graph should be used

The documentation for this class was generated from the following file:
  • /home/vsts/work/1/s/apis/device-detection-cxx/src/hash/ConfigHash.hpp