libosmscout
0.1
|
#include <DataFile.h>
Public Types | |
using | ValueCache = Cache< FileOffset, std::shared_ptr< N > > |
using | ValueCacheEntry = typename Cache< FileOffset, ValueType >::CacheEntry |
using | ValueCacheRef = typename Cache< FileOffset, ValueType >::CacheRef |
using | ValueType = std::shared_ptr< N > |
Public Member Functions | |
virtual bool | Close () |
Close the index. More... | |
DataFile (const DataFile &)=delete | |
DataFile (const std::string &datafile, size_t cacheSize) | |
DataFile (DataFile &&)=delete | |
void | FlushCache () |
bool | GetByBlockSpan (const DataBlockSpan &span, std::vector< ValueType > &data) const |
Read data values from the given DataBlockSpan. More... | |
template<typename IteratorIn > | |
bool | GetByBlockSpans (IteratorIn begin, IteratorIn end, std::vector< ValueType > &data) const |
Read data values from the given DataBlockSpans. More... | |
bool | GetByOffset (FileOffset offset, ValueType &entry) const |
Read one data value from the given file offset. More... | |
template<typename IteratorIn > | |
bool | GetByOffset (IteratorIn begin, IteratorIn end, size_t size, const GeoBox &boundingBox, std::vector< ValueType > &data) const |
Read data values from the given file offsets. More... | |
template<typename IteratorIn > | |
bool | GetByOffset (IteratorIn begin, IteratorIn end, size_t size, std::unordered_map< FileOffset, ValueType > &dataMap) const |
Read data values from the given file offsets. More... | |
template<typename IteratorIn > | |
bool | GetByOffset (IteratorIn begin, IteratorIn end, size_t size, std::vector< ValueType > &data) const |
Reads data for the given file offsets. More... | |
std::string | GetFilename () const |
virtual bool | IsOpen () const |
Return true, if index is currently opened. More... | |
bool | Open (const TypeConfigRef &typeConfig, const std::string &path, bool memoryMappedData) |
Open the index file. More... | |
DataFile & | operator= (const DataFile &)=delete |
DataFile & | operator= (DataFile &&)=delete |
virtual | ~DataFile () |
Protected Attributes | |
TypeConfigRef | typeConfig |
Access to standard format data files.
Allows to load data objects by offset using various standard library data structures.
using osmscout::DataFile< N >::ValueCache = Cache<FileOffset, std::shared_ptr<N> > |
using osmscout::DataFile< N >::ValueCacheEntry = typename Cache<FileOffset, ValueType>::CacheEntry |
using osmscout::DataFile< N >::ValueCacheRef = typename Cache<FileOffset, ValueType>::CacheRef |
using osmscout::DataFile< N >::ValueType = std::shared_ptr<N> |
osmscout::DataFile< N >::DataFile | ( | const std::string & | datafile, |
size_t | cacheSize | ||
) |
|
delete |
|
delete |
|
virtual |
|
virtual |
Close the index.
Method is NOT thread-safe.
Reimplemented in osmscout::IndexedDataFile< I, N >, and osmscout::IndexedDataFile< Id, osmscout::Intersection >.
Referenced by osmscout::DataFile< PTRoute >::Close().
void osmscout::DataFile< N >::FlushCache |
bool osmscout::DataFile< N >::GetByBlockSpan | ( | const DataBlockSpan & | span, |
std::vector< ValueType > & | data | ||
) | const |
Read data values from the given DataBlockSpan.
Method is thread-safe.
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.
bool osmscout::DataFile< N >::GetByOffset | ( | FileOffset | offset, |
ValueType & | entry | ||
) | const |
Read one data value from the given file offset.
Method is thread-safe.
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.
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.
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.
N | Object type managed by the data file |
IteratorIn | Iterator over a colection |
begin | Start iterator for the file offset |
end | End iterator for the file offset |
size | Number of entries returnd by the begin, end itertaor pair. USed for preallocating enough space in result vector. |
data | vector containing data. Data is appended. |
Method is thread-safe.
|
inline |
|
virtual |
Return true, if index is currently opened.
Method is NOT thread-safe.
Reimplemented in osmscout::IndexedDataFile< I, N >, and osmscout::IndexedDataFile< Id, osmscout::Intersection >.
Referenced by osmscout::DataFile< PTRoute >::IsOpen(), and osmscout::IndexedDataFile< Id, osmscout::Intersection >::IsOpen().
bool osmscout::DataFile< N >::Open | ( | const TypeConfigRef & | typeConfig, |
const std::string & | path, | ||
bool | memoryMappedData | ||
) |
Open the index file.
Method is NOT thread-safe.
|
delete |
|
delete |
|
protected |