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

FiftyoneDegrees::Common::EvidenceBase Class Reference

Detailed Description

Base evidence class containing evidence to be processed by an engine.

This wraps a dynamically generated C evidence structure.

The class extends the map<string, string> template to add a method of constructing a C evidence structure from the key value pairs.

Usage Example

using namespace FiftyoneDegrees::Common;
EngineBase *engine;
// Construct a new evidence instance
EvidenceBase *evidence = new EvidenceBase();
// Add an item of evidence
evidence->operator[]("evidence key") = "evidence value";
// Give the evidence to an engine for processing
ResultsBase *results = engine->processBase(evidence);
// Do something with the results (and delete them once finished)
// ...
// Delete the evidence
delete evidence;
Encapsulates the engine class to be extended by engine implementations.
Definition EngineBase.hpp:78
virtual ResultsBase * processBase(EvidenceBase *evidence) const =0
Processes the evidence provided and returns the result.
EvidenceBase()
Construct a new instance containing no evidence.
Encapsulates the results of an engine's processing.
Definition ResultsBase.hpp:97
Shared classes.
Definition Collection.hpp:31

Inheritance diagram for FiftyoneDegrees::Common::EvidenceBase:

[legend]

Collaboration diagram for FiftyoneDegrees::Common::EvidenceBase:

[legend]

Public Member Functions

Constructors and Destructors

 EvidenceBase ()
 Construct a new instance containing no evidence.
virtual ~EvidenceBase ()
 Free all the underlying memory containing the evidence.

Getters

fiftyoneDegreesEvidenceKeyValuePairArray * get ()
 Get the underlying C structure containing the evidence.

Overrides

void clear ()
 Clear all evidence items from the instance.
void erase (iterator position)
 Remove the evidence item at the position indicated.
void erase (iterator first, iterator last)
 Remove the evidence items between the two position indicated.

Protected Member Functions

virtual bool isRelevant (fiftyoneDegreesEvidencePrefix prefix)
 Get whether or not the evidence key prefix is relevant or not.

Member Function Documentation

◆ erase() [1/2]

void FiftyoneDegrees::Common::EvidenceBase::erase ( iterator first,
iterator last )

Remove the evidence items between the two position indicated.

Parameters
firstitem to remove
lastitem to remove

◆ erase() [2/2]

void FiftyoneDegrees::Common::EvidenceBase::erase ( iterator position)

Remove the evidence item at the position indicated.

Parameters
positionof the item to remove

◆ get()

fiftyoneDegreesEvidenceKeyValuePairArray * FiftyoneDegrees::Common::EvidenceBase::get ( )

Get the underlying C structure containing the evidence.

This only includes evidence which is relevant to the engine. Any evidence which is irrelevant will not be included in the result.

Returns
pointer to a populated C evidence structure

◆ isRelevant()

virtual bool FiftyoneDegrees::Common::EvidenceBase::isRelevant ( fiftyoneDegreesEvidencePrefix prefix)
protectedvirtual

Get whether or not the evidence key prefix is relevant or not.

If the prefix is not relevant or not known then it is of no use to the engine processing it.

Parameters
prefixextracted from the evidence key
Returns
true if the key prefix relevant and should be used

Reimplemented in FiftyoneDegrees::DeviceDetection::EvidenceDeviceDetection.


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