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

Access to standard format data files. More...

#include <DataFile.h>

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

Public Types

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

virtual bool Close ()
 Close the index. More...
 
 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...
 
virtual bool IsOpen () const
 Return true, if index is currently opened. More...
 
bool Open (const TypeConfigRef &typeConfig, const std::string &path, bool memoryMapedData)
 Open the index file. More...
 
virtual ~DataFile ()
 

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

template<class N>
typedef Cache<FileOffset,std::shared_ptr<N> > osmscout::DataFile< N >::ValueCache
template<class N>
typedef Cache<FileOffset,ValueType>::CacheEntry osmscout::DataFile< N >::ValueCacheEntry
template<class N>
typedef Cache<FileOffset,ValueType>::CacheRef osmscout::DataFile< N >::ValueCacheRef
template<class N>
typedef std::shared_ptr<N> osmscout::DataFile< N >::ValueType

Constructor & Destructor Documentation

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

Member Function Documentation

template<class N >
bool osmscout::DataFile< N >::GetByBlockSpan ( const DataBlockSpan span,
std::vector< ValueType > &  data 
) const
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.

References osmscout::Log::Error(), osmscout::IOException::GetDescription(), and osmscout::log.

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

Read one data value from the given file offset.

Method is thread-safe.

References osmscout::Log::Error(), and osmscout::log.

Referenced by osmscout::IndexedDataFile< I, N >::Get().

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.

References osmscout::Log::Error(), and osmscout::log.

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.

References osmscout::Log::Error(), and osmscout::log.

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.

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

Open the index file.

Method is NOT thread-safe.

References osmscout::AppendFileToDir(), osmscout::Log::Error(), osmscout::IOException::GetDescription(), and osmscout::log.

Member Data Documentation

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

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