\r\n

51Degrees Device Detection C/C++  4.4

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

FiftyoneDegrees::DeviceDetection::EngineDeviceDetection Class Reference abstract

Detailed Description

Encapsulates the device detection engine class to be extended by device detection engine implementations.

Device detection specific logic is contained in this class to be used by any extending classes.

An engine is constructed with a configuration, then used to process evidence in order to return a set of results. It also exposes methods to refresh the data using a new data set, and get properties relating to the data set being used by the engine.

Usage Example

using namespace FiftyoneDegrees::Common;
// Construct the engine
properties);
// Process some evidence
// Or just process a single User-Agent string
"some User-Agent");
// Do something with the results
// ...
// Delete the results and the engine
delete results;
delete engine;

Inheritance diagram for FiftyoneDegrees::DeviceDetection::EngineDeviceDetection:

[legend]

Collaboration diagram for FiftyoneDegrees::DeviceDetection::EngineDeviceDetection:

[legend]

Public Member Functions

Constructor

 EngineDeviceDetection (ConfigDeviceDetection *config, RequiredPropertiesConfig *properties)
Construct a new instance of the engine class with the configuration and properties provided. More...

Engine Methods

virtual ResultsDeviceDetection *  processDeviceDetection (EvidenceDeviceDetection *evidence) const =0
Processes the evidence provided and returns the result. More...
virtual ResultsDeviceDetection *  processDeviceDetection (const char *userAgent) const =0
Processes the User-Agent provided and returns the result. More...
virtual ResultsDeviceDetection *  processDeviceDetection (string &userAgent) const
Processes the User-Agent provided and returns the result. More...

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

 EngineBase (ConfigBase *config, RequiredPropertiesConfig *properties)
Construct a new instance of the engine class with the configuration and properties provided. More...
virtual  ~EngineBase ()
Frees the meta data class and the data set resource created by the extending class.
virtual ResultsBase *  processBase (EvidenceBase *evidence) const =0
Processes the evidence provided and returns the result. More...
virtual void  refreshData () const =0
Refresh the data set from the original file location. More...
virtual void  refreshData (const char *fileName) const =0
Refresh the data set from the file location provided. More...
virtual void  refreshData (void *data, long length) const =0
Refresh the data set from the memory location provided. More...
virtual void  refreshData (unsigned char data[], long length) const =0
Refresh the data set from the memory location provided. More...
void  setLicenseKey (const string &licenseKey)
Sets the license key to be used when updating the data set. More...
void  setDataUpdateUrl (const string &updateUrl)
Sets the URL to be used when updating the data set. More...
MetaData *  getMetaData () const
Return the a pointer to the meta data class which contains meta data for the properties, values, profiles and components that exist within the engine. More...
bool  getAutomaticUpdatesEnabled () const
Gets whether or not automatic updates are enabled. More...
virtual string  getDataFilePath () const =0
Get the path to the data file the current data set was initialised from. More...
virtual string  getDataFileTempPath () const =0
Get the path to the temporary data file created by the engine, or an empty string if one was not created. More...
virtual string  getDataUpdateUrl () const
Get the URL to be used when updating the data file, or an empty string if this is not set. More...
virtual Date  getPublishedTime () const =0
Get the date at which the current data set was published. More...
virtual Date  getUpdateAvailableTime () const =0
Get the date at which a new data file will be available to download from the URL returned by getDataUpdateUrl(). More...
virtual string  getProduct () const =0
Get the name of the data set being used e.g. More...
virtual string  getType () const =0
Get the tier of the data set being used e.g. More...
const vector< string > *  getKeys () const
Get the list of keys which the engine accepts as evidence. More...
bool  getIsThreadSafe () const
Get whether or not the engine was compiled with thread-safe support. More...

Static Public Attributes

Static Constants

static string  defaultElementDataKey
The data key which will be used to store the results of processing.

Protected Member Functions

virtual void  init (fiftyoneDegreesDataSetDeviceDetection *dataSet)
Initialise the engine with the data set provided. More...

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

virtual void  appendString (stringstream &stream, fiftyoneDegreesCollection *strings, uint32_t offset) const
Gets a string from a strings collection, and appends to a stream. More...
virtual void  initHttpHeaderKeys (fiftyoneDegreesHeaders *uniqueHeaders)
Initialise the HTTP header keys which are used by this engine. More...
void  initOverrideKeys (fiftyoneDegreesOverridePropertyArray *overrideProperties)
Initialise the override keys which are used by this engine. More...
void  addKey (string key)
Adds a key to the list of keys which should be added as evidence. More...

Constructor & Destructor Documentation

◆ EngineDeviceDetection()

FiftyoneDegrees::DeviceDetection::EngineDeviceDetection::EngineDeviceDetection ( ConfigDeviceDetection *   config,
RequiredPropertiesConfig *   properties  
)

Construct a new instance of the engine class with the configuration and properties provided.

Parameters
config - used to build the engine
properties - the properties expected to be fetched from results

Member Function Documentation

◆ init()

virtual void FiftyoneDegrees::DeviceDetection::EngineDeviceDetection::init ( fiftyoneDegreesDataSetDeviceDetection *   dataSet )
protected virtual

Initialise the engine with the data set provided.

This is the data set which carries out all the processing in the engine.

Parameters
dataSet - pointer to the data used by the engine

◆ processDeviceDetection() [1/3]

virtual ResultsDeviceDetection* FiftyoneDegrees::DeviceDetection::EngineDeviceDetection::processDeviceDetection ( EvidenceDeviceDetection *   evidence ) const
pure virtual

Processes the evidence provided and returns the result.

Parameters
evidence - to process. The keys in getKeys() will be the only ones considered by the engine.
Returns
a new results instance with the values for all requested properties

Implemented in FiftyoneDegrees::DeviceDetection::Hash::EngineHash.

◆ processDeviceDetection() [2/3]

virtual ResultsDeviceDetection* FiftyoneDegrees::DeviceDetection::EngineDeviceDetection::processDeviceDetection ( const char *   userAgent ) const
pure virtual

Processes the User-Agent provided and returns the result.

Parameters
userAgent - to process. This is equivalent to processing the string as an item of evidence with the User-Agent header key.
Returns
a new results instance with the values for all requested properties

Implemented in FiftyoneDegrees::DeviceDetection::Hash::EngineHash.

◆ processDeviceDetection() [3/3]

virtual ResultsDeviceDetection* FiftyoneDegrees::DeviceDetection::EngineDeviceDetection::processDeviceDetection ( string &   userAgent ) const
virtual

Processes the User-Agent provided and returns the result.

Parameters
userAgent - to process. This is equivalent to processing the string as an item of evidence with the User-Agent header key.
Returns
a new results instance with the values for all requested properties

The documentation for this class was generated from the following file: