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
Inheritance diagram for FiftyoneDegrees::DeviceDetection::EngineDeviceDetection:
Collaboration diagram for FiftyoneDegrees::DeviceDetection::EngineDeviceDetection:
Public Member Functions | |
Constructor | |
| EngineDeviceDetection (ConfigDeviceDetection *config, RequiredPropertiesConfig *properties) | |
| Construct a new instance of the engine class with the configuration and properties provided. | |
Engine Methods | |
| virtual ResultsDeviceDetection * | processDeviceDetection (EvidenceDeviceDetection *evidence) const =0 |
| Processes the evidence provided and returns the result. | |
| virtual ResultsDeviceDetection * | processDeviceDetection (const char *userAgent) const =0 |
| Processes the User-Agent provided and returns the result. | |
| virtual ResultsDeviceDetection * | processDeviceDetection (string &userAgent) const |
| Processes the User-Agent provided and returns the result. | |
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. | |
| 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. | |
| virtual void | refreshData () const =0 |
| Refresh the data set from the original file location. | |
| virtual void | refreshData (const char *fileName) const =0 |
| Refresh the data set from the file location provided. | |
| virtual void | refreshData (void *data, fiftyoneDegreesFileOffset length) const =0 |
| Refresh the data set from the memory location provided. | |
| virtual void | refreshData (unsigned char data[], fiftyoneDegreesFileOffset length) const =0 |
| Refresh the data set from the memory location provided. | |
| void | setLicenseKey (const string &licenseKey) |
| Sets the license key to be used when updating the data set. | |
| void | setDataUpdateUrl (const string &updateUrl) |
| Sets the URL to be used when updating the data set. | |
| 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. | |
| bool | getAutomaticUpdatesEnabled () const |
| Gets whether or not automatic updates are enabled. | |
| virtual string | getDataFilePath () const =0 |
| Get the path to the data file the current data set was initialised from. | |
| 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. | |
| virtual string | getDataUpdateUrl () const |
| Get the URL to be used when updating the data file, or an empty string if this is not set. | |
| virtual Date | getPublishedTime () const =0 |
| Get the date at which the current data set was published. | |
| 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(). | |
| virtual string | getProduct () const =0 |
| Get the name of the data set being used e.g. | |
| virtual string | getType () const =0 |
| Get the tier of the data set being used e.g. | |
| const vector< string > * | getKeys () const |
| Get the list of keys which the engine accepts as evidence. | |
| vector< string > | getRequiredProperties () const |
| Get the names of the required properties in required property index order, so position i in the vector is the index a caller passes for that property. | |
| bool | getIsThreadSafe () const |
| Get whether or not the engine was compiled with thread-safe support. | |
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. | |
Protected Member Functions inherited from FiftyoneDegrees::Common::EngineBase | |
| virtual void | appendValue (stringstream &stream, fiftyoneDegreesCollection *strings, uint32_t offset, fiftyoneDegreesPropertyValueType storedValueType) const |
| Gets a string from a strings collection, and appends to a stream. | |
| virtual void | appendString (stringstream &stream, fiftyoneDegreesCollection *strings, uint32_t offset) const |
| Gets a string from a strings collection, and appends to a stream. | |
| virtual void | initHttpHeaderKeys (fiftyoneDegreesHeaders *uniqueHeaders) |
| Initialise the HTTP header keys which are used by this engine. | |
| void | initOverrideKeys (fiftyoneDegreesOverridePropertyArray *overrideProperties) |
| Initialise the override keys which are used by this engine. | |
| void | addKey (string key) |
| Adds a key to the list of keys which should be added as evidence. | |
Additional Inherited Members | |
Protected Attributes inherited from FiftyoneDegrees::Common::EngineBase | |
| ConfigBase * | config |
| Pointer to the configuration used to build the engine. | |
| shared_ptr< fiftyoneDegreesResourceManager > | manager |
| A shared pointer to the manager is passed around and referenced by all instances that hold open a resource handle. | |
| RequiredPropertiesConfig * | requiredProperties |
| Pointer to the properties which are going to be used. | |
| MetaData * | metaData |
| Pointer to the meta data relating to the contents of the engine's data set. | |
| string | licenceKey |
| License key used to update the data set. | |
| string | updateUrl |
| URL used to update the data set. | |
| string | defaultDataKey |
| The default key to use when adding the results to a dictionary. | |
| vector< string > | keys |
| Keys which should be added to evidence. | |
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, or null for every property
Member Function Documentation
◆ init()
|
protectedvirtual |
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
Reimplemented in FiftyoneDegrees::DeviceDetection::Hash::EngineHash.
◆ processDeviceDetection() [1/3]
|
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() [2/3]
|
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() [3/3]
|
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:
