Detailed Description
class FiftyoneDegrees::Common::Collection< K, V >
A group of items accessible by index or key.
A Collection instance hands out new instances of any item requested so once they are finished with, they must be deleted. A static object is not returned, as this would require any type V to declare a default constructor in the case that the caller declares a variable before calling a get method.
Usage Example
- Template Parameters
-
K key type for the items in the collection which must be unique e.g. string is used for property meta data where the unique key is the name of the property. The type K must implement the '<' and '==' operators V value type for the items stored in the collection. These must be instantiatable by the collection, and should implement a public destructor as their lifetimes are not handled by the collection instance
- Examples
- Hash/MetaData.cpp.
Inheritance diagram for FiftyoneDegrees::Common::Collection< K, V >:
Public Member Functions | |
Destructor | |
| virtual | ~Collection () |
| Dispose of any internal data. | |
Getters | |
| virtual V * | getByIndex (uint32_t index) const =0 |
| Get the item from the collection at the index provided. | |
| virtual V * | getByKey (K key) const =0 |
| Get the item for the key from the collection. | |
| virtual uint32_t | getSize () const =0 |
| Number of items in the underlying collection. | |
Protected Member Functions | |
| Collection () | |
| A collection can't be constructed without an inheriting class. | |
Member Function Documentation
◆ getByIndex()
|
pure virtual |
Get the item from the collection at the index provided.
- Parameters
-
index of the item required in the collection. Not the same as the key
- Returns
- a new instance of the item at the index
Implemented in FiftyoneDegrees::DeviceDetection::Hash::ComponentMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::ProfileMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionForComponentHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionForPropertyHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionForProfileHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionForPropertyHash, and FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionHash.
◆ getByKey()
|
pure virtual |
Get the item for the key from the collection.
- Parameters
-
key unique key of the item required in the collection
- Returns
- a new instance of the item with the key
Implemented in FiftyoneDegrees::DeviceDetection::Hash::ComponentMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::ProfileMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionForComponentHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionForPropertyHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionBaseHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionForProfileHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionForPropertyHash, and FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionHash.
◆ getSize()
|
pure virtual |
Number of items in the underlying collection.
- Returns
- the number of items in the collection
Implemented in FiftyoneDegrees::DeviceDetection::Hash::ComponentMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::ProfileMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionForComponentHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionForPropertyHash, FiftyoneDegrees::DeviceDetection::Hash::PropertyMetaDataCollectionHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionForProfileHash, FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionForPropertyHash, and FiftyoneDegrees::DeviceDetection::Hash::ValueMetaDataCollectionHash.
The documentation for this class was generated from the following file:
