libosmscout 1.1.1
Loading...
Searching...
No Matches
osmscout::DataFile< N > Class Template Reference

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

Inheritance diagram for osmscout::DataFile< N >:
Collaboration diagram for osmscout::DataFile< N >:

Public Types

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

 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)
virtual bool IsOpen () const
virtual bool Close ()
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

Protected Attributes

TypeConfigRef typeConfig

Detailed Description

template<class N>
class osmscout::DataFile< N >

Access to standard format data files.

Allows to load data objects by offset using various standard library data structures.

Member Typedef Documentation

◆ ValueCache

template<class N>
using osmscout::DataFile< N >::ValueCache = Cache<FileOffset, std::shared_ptr<N> >

◆ ValueCacheEntry

template<class N>
using osmscout::DataFile< N >::ValueCacheEntry = typename Cache<FileOffset, ValueType>::CacheEntry

◆ ValueCacheRef

template<class N>
using osmscout::DataFile< N >::ValueCacheRef = typename Cache<FileOffset, ValueType>::CacheRef

◆ ValueType

template<class N>
using osmscout::DataFile< N >::ValueType = std::shared_ptr<N>

Constructor & Destructor Documentation

◆ DataFile() [1/3]

template<class N>
osmscout::DataFile< N >::DataFile ( const std::string & datafile,
size_t cacheSize )

◆ DataFile() [2/3]

template<class N>
osmscout::DataFile< N >::DataFile ( const DataFile< N > & )
delete

◆ DataFile() [3/3]

template<class N>
osmscout::DataFile< N >::DataFile ( DataFile< N > && )
delete

◆ ~DataFile()

template<class N>
osmscout::DataFile< N >::~DataFile ( )
virtual

Member Function Documentation

◆ Close()

◆ FlushCache()

template<class N>
void osmscout::DataFile< N >::FlushCache ( )

◆ GetByBlockSpan()

template<class N>
bool osmscout::DataFile< N >::GetByBlockSpan ( const DataBlockSpan & span,
std::vector< ValueType > & data ) const

Read data values from the given DataBlockSpan.

Method is thread-safe.

◆ GetByBlockSpans()

template<class N>
template<typename IteratorIn>
bool osmscout::DataFile< N >::GetByBlockSpans ( IteratorIn begin,
IteratorIn end,
std::vector< ValueType > & data ) const

Read data values from the given DataBlockSpans.

Method is thread-safe.

◆ GetByOffset() [1/4]

template<class N>
bool osmscout::DataFile< N >::GetByOffset ( FileOffset offset,
ValueType & entry ) const

Read one data value from the given file offset.

Method is thread-safe.

◆ GetByOffset() [2/4]

template<class N>
template<typename IteratorIn>
bool osmscout::DataFile< N >::GetByOffset ( IteratorIn begin,
IteratorIn end,
size_t size,
const GeoBox & boundingBox,
std::vector< ValueType > & data ) const

Read data values from the given file offsets.

Method is thread-safe.

◆ GetByOffset() [3/4]

template<class N>
template<typename IteratorIn>
bool osmscout::DataFile< N >::GetByOffset ( IteratorIn begin,
IteratorIn end,
size_t size,
std::unordered_map< FileOffset, ValueType > & dataMap ) const

Read data values from the given file offsets.

Method is thread-safe.

◆ GetByOffset() [4/4]

template<class N>
template<typename IteratorIn>
bool osmscout::DataFile< N >::GetByOffset ( IteratorIn begin,
IteratorIn end,
size_t size,
std::vector< ValueType > & data ) const

Reads data for the given file offsets. File offsets are passed by iterator over some container. the size parameter hints as the number of entries returned by the iterators and is used to preallocate enough room in the result vector.

Template Parameters
NObject type managed by the data file
IteratorInIterator over a colection
Parameters
beginStart iterator for the file offset
endEnd iterator for the file offset
sizeNumber of entries returnd by the begin, end itertaor pair. USed for preallocating enough space in result vector.
datavector containing data. Data is appended.
Returns
false if there was an error, else true

Method is thread-safe.

◆ GetFilename()

template<class N>
std::string osmscout::DataFile< N >::GetFilename ( ) const
inline

◆ IsOpen()

◆ Open()

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

Open the index file.

Method is NOT thread-safe.

◆ operator=() [1/2]

template<class N>
DataFile & osmscout::DataFile< N >::operator= ( const DataFile< N > & )
delete

◆ operator=() [2/2]

template<class N>
DataFile & osmscout::DataFile< N >::operator= ( DataFile< N > && )
delete

Member Data Documentation

◆ typeConfig

template<class N>
TypeConfigRef osmscout::DataFile< N >::typeConfig
protected

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