51Degrees Device Detection C/C++  4.1

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

FiftyoneDegrees::Common::MetaData Class Reference abstract

Detailed Description

Contains meta data for the properties, values, profiles and components that exist within the engine instance.

All Collections returned are new instances which hold a reference to the underlying data structures, so must be disposed of. All single meta data instances returned either by this class or the Collections it returns hold no reference and are safe to hold on to.

Example Usage

using namespace FiftyoneDegrees::Common;
EngineBase *engine;
// Get the meta data from an engine
MetaData *metaData = engine->getMetaData();
// Get the meta data for the engine's properties
metaData->getProperties();
// Do something with the properties (see Collection.hpp for an
// example).
// ...
// Delete the properties collection
delete properties;
// Delete the meta data instance
delete metaData;

Inheritance diagram for FiftyoneDegrees::Common::MetaData:

[legend]

Public Member Functions

Constructors and Destructors

 MetaData (shared_ptr< fiftyoneDegreesResourceManager > manager)
Construct a new instance of MetaData. More...
virtual  ~MetaData ()
Free any data and handles used for the meta data.

Getters

virtual CollectionbyteComponentMetaData > *  getComponents ()=0
Get a new Collection instance of all component meta data keyed on the unique id of the component. More...
virtual Collection< string, PropertyMetaData > *  getProperties ()=0
Get a new Collection instance of all property meta data keyed on the name of the property. More...
virtual Collection< uint32_t, ProfileMetaData > *  getProfiles ()=0
Get a new Collection instance of all profile meta data keyed on the unique id of the profile. More...
virtual CollectionValueMetaDataKeyValueMetaData > *  getValues ()=0
Get a new Collection instance of all value meta data keyed on the name of the value and the property it relates to. More...

Filtered Getters

virtual CollectionValueMetaDataKeyValueMetaData > *  getValuesForProperty (PropertyMetaData *property)=0
Get a new Collection instance of value meta data relating to the specified property, keyed on the name of the value and the property. More...
virtual CollectionValueMetaDataKeyValueMetaData > *  getValuesForProfile (ProfileMetaData *profile)=0
Get a new Collection instance of value meta data for the specified profile, keyed on the name of the value and the property it relates to. More...
virtual ComponentMetaData *  getComponentForProfile (ProfileMetaData *profile)=0
Get the Component which the specified profile relates to. More...
virtual ComponentMetaData *  getComponentForProperty (PropertyMetaData *property)=0
Get the Component which the specified property relates to. More...
virtual ProfileMetaData *  getDefaultProfileForComponent (ComponentMetaData *component)=0
Get the default profile for the specified component. More...
virtual ValueMetaData *  getDefaultValueForProperty (PropertyMetaData *property)=0
Get the default value for the specified component. More...
virtual Collection< string, PropertyMetaData > *  getPropertiesForComponent (ComponentMetaData *component)=0
Get a new Collection instance of the property meta data relating to the specified component, keyed on the name of the property. More...
virtual PropertyMetaData *  getPropertyForValue (ValueMetaData *value)=0
Get the property which the value relates to. More...
virtual Collection< string, PropertyMetaData > *  getEvidencePropertiesForProperty (PropertyMetaData *property)=0
Get the properties which are required to fetch extra evidence for a specified property. More...

Protected Member Functions

string  getString (fiftyoneDegreesCollection *strings, uint32_t offset)
Get a string from the collection and copy it to a C++ string instance. More...

Protected Attributes

shared_ptr< fiftyoneDegreesResourceManager >  manager
A shared pointer to the manager is passed around and referenced by all instances that hold open a resource handle. More...

Constructor & Destructor Documentation

◆ MetaData()

FiftyoneDegrees::Common::MetaData::MetaData ( shared_ptr< fiftyoneDegreesResourceManager >   manager )

Construct a new instance of MetaData.

This should only be used internally by engines.

Parameters
manager - shared pointer to the manager instance to get data from

Member Function Documentation

◆ getDefaultProfileForComponent()

virtual ProfileMetaData* FiftyoneDegrees::Common::MetaData::getDefaultProfileForComponent ( ComponentMetaData *   component )
pure virtual

Get the default profile for the specified component.

This is the profile that will be used if there is no match.

Parameters
component - to get the default profile for
Returns
default profile for the component

Implemented in FiftyoneDegrees::DeviceDetection::Hash::MetaDataHash.

◆ getDefaultValueForProperty()

virtual ValueMetaData* FiftyoneDegrees::Common::MetaData::getDefaultValueForProperty ( PropertyMetaData *   property )
pure virtual

Get the default value for the specified component.

This is the value that will be used if a profile does not contain a value for the property.

Parameters
property - to get the default value for
Returns
default value for the property

Implemented in FiftyoneDegrees::DeviceDetection::Hash::MetaDataHash.

◆ getEvidencePropertiesForProperty()

virtual Collection<string, PropertyMetaData>* FiftyoneDegrees::Common::MetaData::getEvidencePropertiesForProperty ( PropertyMetaData *   property )
pure virtual

Get the properties which are required to fetch extra evidence for a specified property.

If a property is not available (i.e. not set as a required property on engine construction) this will always be empty.

Parameters
property - to get the evidence properties for
Returns
evidence properties for the property

Implemented in FiftyoneDegrees::DeviceDetection::Hash::MetaDataHash.

◆ getPropertiesForComponent()

virtual Collection<string, PropertyMetaData>* FiftyoneDegrees::Common::MetaData::getPropertiesForComponent ( ComponentMetaData *   component )
pure virtual

Get a new Collection instance of the property meta data relating to the specified component, keyed on the name of the property.

These are the properties which a profile relating to the component will contain.

Parameters
component - to get the properties for
Returns
properties for the component

Implemented in FiftyoneDegrees::DeviceDetection::Hash::MetaDataHash.

◆ getString()

string FiftyoneDegrees::Common::MetaData::getString ( fiftyoneDegreesCollection *   strings,
uint32_t   offset  
)
protected

Get a string from the collection and copy it to a C++ string instance.

This method releases the collection item before returning.

Parameters
strings - pointer to the collection containing the string
offset - of the string in the collection
Returns
copy of the requested string from the collection

Field Documentation

◆ manager

shared_ptr<fiftyoneDegreesResourceManager> FiftyoneDegrees::Common::MetaData::manager
protected

A shared pointer to the manager is passed around and referenced by all instances that hold open a resource handle.

This acts as a counter to ensure that the pointer to the manager remains valid until the last handle is freed. The shared pointer also handles freeing the pointer once no references remain. See resource.h for more information.


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

Get a new Collection instance of value meta data relating to the specified property, keyed on the name of the value and the property.

Parameters
property - to get the values for
Returns
values for the property

Implemented in FiftyoneDegrees::DeviceDetection::Hash::MetaDataHash.

Field Documentation

◆ manager

shared_ptr<fiftyoneDegreesResourceManager> FiftyoneDegrees::Common::MetaData::manager
protected

A shared pointer to the manager is passed around and referenced by all instances that hold open a resource handle.

This acts as a counter to ensure that the pointer to the manager remains valid until the last handle is freed. The shared pointer also handles freeing the pointer once no references remain. See resource.h for more information.


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