libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::IndexedDataFile< I, N > Class Template Reference

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. More...

#include <DataFile.h>

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

Public Types

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

Public Member Functions

bool Close ()
 Close the index. More...
 
bool Get (const I &id, ValueType &entry) 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
 
bool GetOffset (const I &id, FileOffset &offset) const
 
template<typename IteratorIn >
bool GetOffsets (IteratorIn begin, IteratorIn end, size_t size, std::vector< FileOffset > &offsets) const
 
 IndexedDataFile (const std::string &datafile, const std::string &indexfile, unsigned long indexCacheSize, unsigned long dataCacheSize)
 
bool IsOpen () const
 Return true, if index is currently opened. More...
 
bool Open (const TypeConfigRef &typeConfig, const std::string &path, bool memoryMapedIndex, bool memoryMapedData)
 
- Public Member Functions inherited from osmscout::DataFile< N >
 DataFile (const std::string &datafile, size_t cacheSize)
 
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 (const 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, std::vector< ValueType > &data) const
 Reads data for the given file offsets. 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...
 
bool Open (const TypeConfigRef &typeConfig, const std::string &path, bool memoryMapedData)
 Open the index file. More...
 
virtual ~DataFile ()
 

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

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

Constructor & Destructor Documentation

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

Member Function Documentation

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

Close the index.

Method is NOT thread-safe.

Reimplemented from osmscout::DataFile< N >.

template<class I, class N >
bool osmscout::IndexedDataFile< I, N >::Get ( const I &  id,
ValueType entry 
) const
template<class I, class N >
bool osmscout::IndexedDataFile< I, N >::Get ( const std::vector< I > &  ids,
std::vector< ValueType > &  data 
) const
template<class I, class N >
bool osmscout::IndexedDataFile< I, N >::Get ( const std::list< I > &  ids,
std::vector< ValueType > &  data 
) const
template<class I, class N >
bool osmscout::IndexedDataFile< I, N >::Get ( const std::set< I > &  ids,
std::vector< ValueType > &  data 
) const
template<class I, class N >
bool osmscout::IndexedDataFile< I, N >::Get ( const std::set< I > &  ids,
std::unordered_map< I, ValueType > &  data 
) const
template<class I, class N >
bool osmscout::IndexedDataFile< I, N >::GetOffset ( const I &  id,
FileOffset offset 
) const
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
template<class I , class N >
bool osmscout::IndexedDataFile< I, N >::IsOpen ( ) const
virtual

Return true, if index is currently opened.

Method is NOT thread-safe.

Reimplemented from osmscout::DataFile< N >.

References osmscout::DataFile< N >::IsOpen().

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

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