libosmscout 1.1.1
Loading...
Searching...
No Matches
osmscout::IndexedDataFile< I, N > Class Template Reference

#include <libosmscout/include/osmscout/io/DataFile.h>

Inheritance diagram for osmscout::IndexedDataFile< I, N >:
Collaboration diagram for osmscout::IndexedDataFile< I, N >:

Public Types

using ValueType = std::shared_ptr<N>
Public Types inherited from osmscout::DataFile< N >
using ValueType = std::shared_ptr<N>
using ValueCache = Cache<FileOffset, std::shared_ptr<N> >
using ValueCacheEntry = typename Cache<FileOffset, ValueType>::CacheEntry
using ValueCacheRef = typename Cache<FileOffset, ValueType>::CacheRef

Public Member Functions

 IndexedDataFile (const std::string &datafile, const std::string &indexfile, size_t indexCacheSize, size_t dataCacheSize)
bool Open (const TypeConfigRef &typeConfig, const std::string &path, bool memoryMappedIndex, bool memoryMappedData)
bool Close () override
bool IsOpen () const override
bool GetOffset (I id, FileOffset &offset) const
bool Get (I id, ValueType &entry) const
template<typename IteratorIn>
bool GetOffsets (IteratorIn begin, IteratorIn end, size_t size, std::vector< FileOffset > &offsets) const
bool Get (const std::vector< I > &ids, std::vector< ValueType > &data) const
bool Get (const std::list< I > &ids, std::vector< ValueType > &data) const
bool Get (const std::set< I > &ids, std::vector< ValueType > &data) const
bool Get (const std::set< I > &ids, std::unordered_map< I, ValueType > &data) const
Public Member Functions inherited from osmscout::DataFile< N >
 DataFile (const std::string &datafile, size_t cacheSize)
 DataFile (const DataFile &)=delete
 DataFile (DataFile &&)=delete
DataFileoperator= (const DataFile &)=delete
DataFileoperator= (DataFile &&)=delete
virtual ~DataFile ()
bool Open (const TypeConfigRef &typeConfig, const std::string &path, bool memoryMappedData)
void FlushCache ()
std::string GetFilename () const
bool GetByOffset (FileOffset offset, ValueType &entry) const
bool GetByBlockSpan (const DataBlockSpan &span, std::vector< ValueType > &data) const
template<typename IteratorIn>
bool GetByOffset (IteratorIn begin, IteratorIn end, size_t size, std::vector< ValueType > &data) const
template<typename IteratorIn>
bool GetByOffset (IteratorIn begin, IteratorIn end, size_t size, const GeoBox &boundingBox, std::vector< ValueType > &data) const
template<typename IteratorIn>
bool GetByOffset (IteratorIn begin, IteratorIn end, size_t size, std::unordered_map< FileOffset, ValueType > &dataMap) const
template<typename IteratorIn>
bool GetByBlockSpans (IteratorIn begin, IteratorIn end, std::vector< ValueType > &data) const

Additional Inherited Members

Protected Attributes inherited from osmscout::DataFile< N >
TypeConfigRef typeConfig

Detailed Description

template<class I, class N>
class osmscout::IndexedDataFile< I, N >

Extension of DataFile to allow loading data not only by offset but by id using an additional index file, mapping objects id to object file offset.

Member Typedef Documentation

◆ ValueType

template<class I, class N>
using osmscout::IndexedDataFile< I, N >::ValueType = std::shared_ptr<N>

Constructor & Destructor Documentation

◆ IndexedDataFile()

template<class I, class N>
osmscout::IndexedDataFile< I, N >::IndexedDataFile ( const std::string & datafile,
const std::string & indexfile,
size_t indexCacheSize,
size_t dataCacheSize )

Member Function Documentation

◆ Close()

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Close ( )
overridevirtual

Close the index.

Method is NOT thread-safe.

Reimplemented from osmscout::DataFile< N >.

◆ Get() [1/5]

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Get ( const std::list< I > & ids,
std::vector< ValueType > & data ) const

◆ Get() [2/5]

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Get ( const std::set< I > & ids,
std::unordered_map< I, ValueType > & data ) const

◆ Get() [3/5]

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Get ( const std::set< I > & ids,
std::vector< ValueType > & data ) const

◆ Get() [4/5]

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Get ( const std::vector< I > & ids,
std::vector< ValueType > & data ) const

◆ Get() [5/5]

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Get ( I id,
ValueType & entry ) const

◆ GetOffset()

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::GetOffset ( I id,
FileOffset & offset ) const

◆ GetOffsets()

template<class I, class N>
template<typename IteratorIn>
bool osmscout::IndexedDataFile< I, N >::GetOffsets ( IteratorIn begin,
IteratorIn end,
size_t size,
std::vector< FileOffset > & offsets ) const

◆ IsOpen()

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::IsOpen ( ) const
overridevirtual

Return true, if index is currently opened.

Method is NOT thread-safe.

Reimplemented from osmscout::DataFile< N >.

◆ Open()

template<class I, class N>
bool osmscout::IndexedDataFile< I, N >::Open ( const TypeConfigRef & typeConfig,
const std::string & path,
bool memoryMappedIndex,
bool memoryMappedData )

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