libosmscout  0.1
osmscout::FeatureReader< F > Class Template Reference

Helper template class for easy access to flag-like Features. More...

#include <FeatureReader.h>

Public Member Functions

 FeatureReader (const TypeConfig &typeConfig)
 
bool GetIndex (const FeatureValueBuffer &buffer, size_t &index) const
 Returns the index of the Feature/FeatureValue within the given FeatureValueBuffer. More...
 
bool IsSet (const FeatureValueBuffer &buffer) const
 Returns true, if the feature is set for the given FeatureValueBuffer. More...
 

Detailed Description

template<class F>
class osmscout::FeatureReader< F >

Helper template class for easy access to flag-like Features.

Each type may have stored the feature in request at a different index. The FeatureReader caches the index for each type once in the constructor and later on allows access to the feature in O(1) - without iterating of all feature(values) of an object.

Constructor & Destructor Documentation

◆ FeatureReader()

Member Function Documentation

◆ GetIndex()

template<class F >
bool osmscout::FeatureReader< F >::GetIndex ( const FeatureValueBuffer buffer,
size_t &  index 
) const

Returns the index of the Feature/FeatureValue within the given FeatureValueBuffer.

Parameters
bufferThe FeatureValueBuffer instance
indexThe index
Returns
true, if there is a valid index 8because the type has such feature), else false

References osmscout::FeatureValueBuffer::GetType().

◆ IsSet()

template<class F >
bool osmscout::FeatureReader< F >::IsSet ( const FeatureValueBuffer buffer) const

Returns true, if the feature is set for the given FeatureValueBuffer.

Parameters
bufferThe FeatureValueBuffer instance
Returns
true if set, else false

References osmscout::FeatureValueBuffer::GetType(), and osmscout::FeatureValueBuffer::HasFeature().

Referenced by osmscout::PositionAgent::Process().


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