libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::FeatureValueBuffer Class Referencefinal

A FeatureValueBuffer is instantiated by an object and holds information about the type of the object, the features and feature values available for the given object. More...

#include <TypeConfig.h>

Public Member Functions

FeatureValue * AllocateValue (size_t idx)
void ClearFeatureValues ()
 Clears all feature buffer values.
void CopyMissingValues (const FeatureValueBuffer &other)
 Maintains the current values and types and copies over all not already set feature values of the passed instance to the current instance.
 FeatureValueBuffer ()=default
 FeatureValueBuffer (const FeatureValueBuffer &other)
 FeatureValueBuffer (FeatureValueBuffer &&other) noexcept
template<class T>
const T * findValue () const
void FreeValue (size_t idx)
FeatureInstance GetFeature (size_t idx) const
 Get a feature description for the feature with the given index ([0..featureCount[).
size_t GetFeatureCount () const
 Return the numbe rof features defined for this type.
TypeInfoRef GetType () const
FeatureValue * GetValue (size_t idx) const
 Return a raw pointer to the value (as reserved in the internal featureValueBuffer).
bool HasFeature (size_t idx) const
 Return true, if the given feature is set (available), else false.
bool operator!= (const FeatureValueBuffer &other) const
FeatureValueBuffer & operator= (const FeatureValueBuffer &other)
FeatureValueBuffer & operator= (FeatureValueBuffer &&other) noexcept
bool operator== (const FeatureValueBuffer &other) const
void Parse (TagErrorReporter &errorReporter, const TagRegistry &tagRegistry, const ObjectOSMRef &object, const TagMap &tags)
void Read (FileScanner &scanner)
 Read the FeatureValueBuffer from the given FileScanner.
void Read (FileScanner &scanner, bool &specialFlag)
 Reads the FeatureValueBuffer to the given FileScanner.
void Read (FileScanner &scanner, bool &specialFlag1, bool &specialFlag2)
 Reads the FeatureValueBuffer to the given FileScanner.
void Read (FileScanner &scanner, bool &specialFlag1, bool &specialFlag2, bool &specialFlag3)
 Reads the FeatureValueBuffer to the given FileScanner.
template<std::size_t FlagCnt>
void Read (FileScanner &scanner, std::array< bool, FlagCnt > &specialFlags)
 Reads the FeatureValueBuffer to the given FileScanner.
void Set (const FeatureValueBuffer &other)
 Deletes the current feature values and assign the type and values of the passed featur evalue buffer.
void SetType (const TypeInfoRef &type)
void Write (FileWriter &writer) const
 Writes the FeatureValueBuffer to the given FileWriter.
void Write (FileWriter &writer, bool specialFlag) const
 Writes the FeatureValueBuffer to the given FileWriter.
void Write (FileWriter &writer, bool specialFlag1, bool specialFlag2) const
 Writes the FeatureValueBuffer to the given FileWriter.
void Write (FileWriter &writer, bool specialFlag1, bool specialFlag2, bool specialFlag3) const
 Writes the FeatureValueBuffer to the given FileWriter.
template<std::size_t FlagCnt>
void Write (FileWriter &writer, const std::array< bool, FlagCnt > &specialFlags) const
 Writes the FeatureValueBuffer to the given FileWriter.
 ~FeatureValueBuffer ()

Detailed Description

A FeatureValueBuffer is instantiated by an object and holds information about the type of the object, the features and feature values available for the given object.

Constructor & Destructor Documentation

◆ FeatureValueBuffer() [1/3]

◆ FeatureValueBuffer() [2/3]

osmscout::FeatureValueBuffer::FeatureValueBuffer ( const FeatureValueBuffer & other)

References FeatureValueBuffer(), and Set().

◆ FeatureValueBuffer() [3/3]

osmscout::FeatureValueBuffer::FeatureValueBuffer ( FeatureValueBuffer && other)
noexcept

References FeatureValueBuffer().

◆ ~FeatureValueBuffer()

osmscout::FeatureValueBuffer::~FeatureValueBuffer ( )

Member Function Documentation

◆ AllocateValue()

FeatureValue * osmscout::FeatureValueBuffer::AllocateValue ( size_t idx)

References GetFeature(), and osmscout::FeatureInstance::GetFeatureBit().

Referenced by CopyMissingValues(), osmscout::AccessFeature::Parse(), osmscout::AccessRestrictedFeature::Parse(), osmscout::AddressFeature::Parse(), osmscout::AdminLevelFeature::Parse(), osmscout::BrandFeature::Parse(), osmscout::BridgeFeature::Parse(), osmscout::BuildingFeature::Parse(), osmscout::ChargingStationFeature::Parse(), osmscout::ClockwiseDirectionFeature::Parse(), osmscout::ColorFeature::Parse(), osmscout::ConstructionYearFeature::Parse(), osmscout::DestinationFeature::Parse(), osmscout::EleFeature::Parse(), osmscout::EmbankmentFeature::Parse(), osmscout::FeeFeature::Parse(), osmscout::FromToFeature::Parse(), osmscout::GradeFeature::Parse(), osmscout::HighwayMilestoneFeature::Parse(), osmscout::IsInFeature::Parse(), osmscout::LanesFeature::Parse(), osmscout::LayerFeature::Parse(), osmscout::LocationFeature::Parse(), osmscout::MaxSpeedFeature::Parse(), osmscout::MaxStayFeature::Parse(), osmscout::NameAltFeature::Parse(), osmscout::NameFeature::Parse(), osmscout::NameShortFeature::Parse(), osmscout::NetworkFeature::Parse(), osmscout::OpeningHoursFeature::Parse(), osmscout::OperatorFeature::Parse(), osmscout::PhoneFeature::Parse(), osmscout::PostalCodeFeature::Parse(), osmscout::RefFeature::Parse(), osmscout::RoundaboutFeature::Parse(), osmscout::SidewayFeature::Parse(), osmscout::TunnelFeature::Parse(), osmscout::WebsiteFeature::Parse(), osmscout::WidthFeature::Parse(), Set(), and osmscout::OverlayObject::setupFeatures().

◆ ClearFeatureValues()

void osmscout::FeatureValueBuffer::ClearFeatureValues ( )

Clears all feature buffer values.

References FreeValue(), and GetFeatureCount().

Referenced by FeatureValueBuffer().

◆ CopyMissingValues()

void osmscout::FeatureValueBuffer::CopyMissingValues ( const FeatureValueBuffer & other)

Maintains the current values and types and copies over all not already set feature values of the passed instance to the current instance.

Both FeatureValueBuffers do not have to have the same type. Copying is a based on best effort. The copy opperation is expensive.

Parameters
otherinstance to copy missing values from.
Note
Untested!

References AllocateValue(), FeatureValueBuffer(), osmscout::FeatureInstance::GetFeature(), GetFeature(), osmscout::FeatureInstance::GetFeatureBit(), GetFeatureCount(), GetType(), GetValue(), and HasFeature().

Referenced by FeatureValueBuffer().

◆ findValue()

template<class T>
const T * osmscout::FeatureValueBuffer::findValue ( ) const
inline

References GetType(), GetValue(), and HasFeature().

◆ FreeValue()

void osmscout::FeatureValueBuffer::FreeValue ( size_t idx)

◆ GetFeature()

FeatureInstance osmscout::FeatureValueBuffer::GetFeature ( size_t idx) const
inline

Get a feature description for the feature with the given index ([0..featureCount[).

References osmscout::FeatureInstance::GetFeature().

Referenced by AllocateValue(), CopyMissingValues(), FreeValue(), operator==(), and Set().

◆ GetFeatureCount()

size_t osmscout::FeatureValueBuffer::GetFeatureCount ( ) const
inline

Return the numbe rof features defined for this type.

Referenced by ClearFeatureValues(), CopyMissingValues(), operator==(), and Set().

◆ GetType()

◆ GetValue()

FeatureValue * osmscout::FeatureValueBuffer::GetValue ( size_t idx) const
inline

Return a raw pointer to the value (as reserved in the internal featureValueBuffer).

Note: Can return NULL value! HasFeature(idx) && GetFeature(idx).GetFeature()->HasValue() should be called before accessing the value.

Referenced by CopyMissingValues(), findValue(), FreeValue(), osmscout::FeatureToDescriptionProcessor::GetFeatureValue(), osmscout::DynamicFeatureLabelReader::GetLabel(), osmscout::FeatureLabelReader< F, V >::GetLabel(), osmscout::DynamicFeatureReader::GetValue(), osmscout::FeatureValueReader< F, V >::GetValue(), osmscout::FeatureValueReader< F, V >::GetValue(), operator==(), Set(), and Write().

◆ HasFeature()

◆ operator!=()

bool osmscout::FeatureValueBuffer::operator!= ( const FeatureValueBuffer & other) const

◆ operator=() [1/2]

FeatureValueBuffer & osmscout::FeatureValueBuffer::operator= ( const FeatureValueBuffer & other)

References FeatureValueBuffer(), and Set().

Referenced by FeatureValueBuffer().

◆ operator=() [2/2]

FeatureValueBuffer & osmscout::FeatureValueBuffer::operator= ( FeatureValueBuffer && other)
noexcept

References FeatureValueBuffer().

◆ operator==()

bool osmscout::FeatureValueBuffer::operator== ( const FeatureValueBuffer & other) const

◆ Parse()

void osmscout::FeatureValueBuffer::Parse ( TagErrorReporter & errorReporter,
const TagRegistry & tagRegistry,
const ObjectOSMRef & object,
const TagMap & tags )

◆ Read() [1/5]

void osmscout::FeatureValueBuffer::Read ( FileScanner & scanner)

◆ Read() [2/5]

void osmscout::FeatureValueBuffer::Read ( FileScanner & scanner,
bool & specialFlag )

Reads the FeatureValueBuffer to the given FileScanner.

It also reads the value of the special flag as passed to the Write method.

Exceptions
IOException

References Read().

◆ Read() [3/5]

void osmscout::FeatureValueBuffer::Read ( FileScanner & scanner,
bool & specialFlag1,
bool & specialFlag2 )

Reads the FeatureValueBuffer to the given FileScanner.

It also reads the value of two special flags as passed to the Write method.

Exceptions
IOException

References Read().

◆ Read() [4/5]

void osmscout::FeatureValueBuffer::Read ( FileScanner & scanner,
bool & specialFlag1,
bool & specialFlag2,
bool & specialFlag3 )

Reads the FeatureValueBuffer to the given FileScanner.

It also reads the value of three special flags as passed to the Write method.

Exceptions
IOException

References Read().

◆ Read() [5/5]

template<std::size_t FlagCnt>
void osmscout::FeatureValueBuffer::Read ( FileScanner & scanner,
std::array< bool, FlagCnt > & specialFlags )
inline

Reads the FeatureValueBuffer to the given FileScanner.

It also reads the array of special flags (up to 8) as passed to the Write method.

Exceptions
IOException

References osmscout::BitsToBytes(), HasFeature(), osmscout::FeatureValue::Read(), and osmscout::FileScanner::ReadUInt8().

◆ Set()

void osmscout::FeatureValueBuffer::Set ( const FeatureValueBuffer & other)

Deletes the current feature values and assign the type and values of the passed featur evalue buffer.

Parameters
otherOther FeatureValueBuffer to make a copy of

References AllocateValue(), FeatureValueBuffer(), osmscout::FeatureInstance::GetFeature(), GetFeature(), osmscout::FeatureInstance::GetFeatureBit(), GetFeatureCount(), GetType(), GetValue(), HasFeature(), and SetType().

Referenced by FeatureValueBuffer(), FeatureValueBuffer(), and operator=().

◆ SetType()

◆ Write() [1/5]

void osmscout::FeatureValueBuffer::Write ( FileWriter & writer) const

Writes the FeatureValueBuffer to the given FileWriter.

Exceptions
IOException

References Write().

Referenced by Write(), Write(), Write(), and Write().

◆ Write() [2/5]

void osmscout::FeatureValueBuffer::Write ( FileWriter & writer,
bool specialFlag ) const

Writes the FeatureValueBuffer to the given FileWriter.

It also writes the value of the special flag passed. The flag can later be retrieved by using the matching Read method.

Exceptions
IOException

References Write().

◆ Write() [3/5]

void osmscout::FeatureValueBuffer::Write ( FileWriter & writer,
bool specialFlag1,
bool specialFlag2 ) const

Writes the FeatureValueBuffer to the given FileWriter.

It also writes the value of the special flag passed. The flag can later be retrieved by using the matching Read method.

Exceptions
IOException

References Write().

◆ Write() [4/5]

void osmscout::FeatureValueBuffer::Write ( FileWriter & writer,
bool specialFlag1,
bool specialFlag2,
bool specialFlag3 ) const

Writes the FeatureValueBuffer to the given FileWriter.

It also writes the value of the special flag passed. The flag can later be retrieved by using the matching Read method.

Exceptions
IOException

References Write().

◆ Write() [5/5]

template<std::size_t FlagCnt>
void osmscout::FeatureValueBuffer::Write ( FileWriter & writer,
const std::array< bool, FlagCnt > & specialFlags ) const
inline

Writes the FeatureValueBuffer to the given FileWriter.

It also writes the value of the special flags passed. The flag can later be retrieved by using the matching Read method.

Exceptions
IOException

References osmscout::BitsToBytes(), GetValue(), HasFeature(), osmscout::FeatureValue::Write(), and osmscout::FileWriter::Write().


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