libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::FeatureValueReader< F, V > Class Template Reference

Helper template class for easy access to the value of a certain feature for objects of any type. More...

#include <TypeFeatures.h>

Public Member Functions

 FeatureValueReader (const TypeConfig &typeConfig)
 
bool GetIndex (const FeatureValueBuffer &buffer, size_t &index) const
 Returns the index of the Feature/FeatureValue within the given FeatureValueBuffer. More...
 
V * GetValue (const FeatureValueBuffer &buffer) const
 Returns the FeatureValue for the given FeatureValueBuffer. More...
 

Detailed Description

template<class F, class V>
class osmscout::FeatureValueReader< F, V >

Helper template class for easy access to the value of a certain feature for objects of any type.

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

Constructor & Destructor Documentation

template<class F , class V >
osmscout::FeatureValueReader< F, V >::FeatureValueReader ( const TypeConfig &  typeConfig)

Member Function Documentation

template<class F , class V >
bool osmscout::FeatureValueReader< F, V >::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
template<class F , class V >
V * osmscout::FeatureValueReader< F, V >::GetValue ( const FeatureValueBuffer &  buffer) const

Returns the FeatureValue for the given FeatureValueBuffer.

Parameters
bufferThe FeatureValueBuffer instance
Returns
A pointer to an instance if the Type and the instance do have the feature and its value is not NULL, else NULL

Referenced by osmscout::AbstractRoutingProfile::CanUse(), osmscout::AbstractRoutingProfile::CanUseBackward(), osmscout::AbstractRoutingProfile::CanUseForward(), osmscout::RoutePostprocessor::GetNameDescription(), osmscout::StyleResolveContext::IsOneway(), and osmscout::RoutePostprocessor::MotorwayJunctionPostprocessor::Process().


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