libosmscout  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
osmscout::FileScanner Class Reference

FileScanner implements platform independent sequential scanning-like access to data in files. More...

#include <FileScanner.h>

Public Types

enum  Mode { Sequential, FastRandom, LowMemRandom, Normal }
 

Public Member Functions

void Close ()
 Closes the file. More...
 
void CloseFailsafe ()
 Closes the file. More...
 
 FileScanner ()
 
std::string GetFilename () const
 
FileOffset GetPos () const
 Returns the current position of the reading cursor in relation to the begining of the file. More...
 
void GotoBegin ()
 Moves the reading cursor to the start of the file (offset 0) More...
 
bool HasError () const
 
bool IsEOF () const
 
bool IsOpen () const
 
void Open (const std::string &filename, Mode mode, bool useMmap)
 
void Read (char *buffer, size_t bytes)
 
void Read (std::string &value)
 
void Read (bool &boolean)
 
void Read (int8_t &number)
 
void Read (int16_t &number)
 
void Read (int32_t &number)
 
void Read (int64_t &number)
 
void Read (uint8_t &number)
 
void Read (uint16_t &number)
 
void Read (uint32_t &number)
 
void Read (uint64_t &number)
 
void Read (uint16_t &number, size_t bytes)
 
void Read (uint32_t &number, size_t bytes)
 
void Read (uint64_t &number, size_t bytes)
 
void Read (ObjectFileRef &ref)
 
void Read (std::vector< Point > &nodes, bool readIds)
 
void ReadBox (GeoBox &box)
 
void ReadConditionalCoord (GeoCoord &coord, bool &isSet)
 
void ReadCoord (GeoCoord &coord)
 
void ReadFileOffset (FileOffset &offset)
 
void ReadFileOffset (FileOffset &offset, size_t bytes)
 
void ReadNumber (int16_t &number)
 
void ReadNumber (int32_t &number)
 
void ReadNumber (int64_t &number)
 
void ReadNumber (uint16_t &number)
 
void ReadNumber (uint32_t &number)
 
void ReadNumber (uint64_t &number)
 
void ReadTypeId (TypeId &id, uint8_t maxBytes)
 
void SetPos (FileOffset pos)
 Moves the reading cursor to the given file position. More...
 
virtual ~FileScanner ()
 

Detailed Description

FileScanner implements platform independent sequential scanning-like access to data in files.

File access is buffered.

FileScanner will use mmap in read-only mode if available (and will fall back to normal buffered IO if available but failing), resulting in mapping the complete file into the memory of the process (without allocating real memory) resulting in measurable speed increase because of exchanging buffered file access with in memory array access.

Member Enumeration Documentation

Enumerator
Sequential 
FastRandom 
LowMemRandom 
Normal 

Constructor & Destructor Documentation

osmscout::FileScanner::FileScanner ( )
osmscout::FileScanner::~FileScanner ( )
virtual

Member Function Documentation

std::string osmscout::FileScanner::GetFilename ( ) const
FileOffset osmscout::FileScanner::GetPos ( ) const

Returns the current position of the reading cursor in relation to the begining of the file.

throws IOException on error

References HasError().

Referenced by osmscout::LocationIndex::Load(), and osmscout::RouteNode::Read().

void osmscout::FileScanner::GotoBegin ( )

Moves the reading cursor to the start of the file (offset 0)

throws IOException on error

References SetPos().

bool osmscout::FileScanner::IsEOF ( ) const

References HasError().

void osmscout::FileScanner::Read ( std::string &  value)

References HasError().

void osmscout::FileScanner::Read ( bool &  boolean)

References HasError().

void osmscout::FileScanner::Read ( int8_t &  number)

References HasError().

void osmscout::FileScanner::Read ( int16_t &  number)

References HasError().

void osmscout::FileScanner::Read ( int32_t &  number)

References HasError().

void osmscout::FileScanner::Read ( int64_t &  number)

References HasError().

void osmscout::FileScanner::Read ( uint8_t &  number)

References HasError().

void osmscout::FileScanner::Read ( uint16_t &  number)

References HasError().

void osmscout::FileScanner::Read ( uint32_t &  number)

References HasError().

void osmscout::FileScanner::Read ( uint64_t &  number)

References HasError().

void osmscout::FileScanner::Read ( uint16_t &  number,
size_t  bytes 
)

References HasError().

void osmscout::FileScanner::Read ( uint32_t &  number,
size_t  bytes 
)

References HasError().

void osmscout::FileScanner::Read ( uint64_t &  number,
size_t  bytes 
)

References HasError().

void osmscout::FileScanner::Read ( ObjectFileRef &  ref)

References Read(), and ReadFileOffset().

void osmscout::FileScanner::Read ( std::vector< Point > &  nodes,
bool  readIds 
)
void osmscout::FileScanner::ReadBox ( GeoBox &  box)
void osmscout::FileScanner::ReadConditionalCoord ( GeoCoord &  coord,
bool &  isSet 
)
void osmscout::FileScanner::ReadCoord ( GeoCoord &  coord)
void osmscout::FileScanner::ReadFileOffset ( FileOffset offset,
size_t  bytes 
)

References HasError().

void osmscout::FileScanner::ReadNumber ( int32_t &  number)
void osmscout::FileScanner::ReadNumber ( int64_t &  number)
void osmscout::FileScanner::ReadNumber ( uint16_t &  number)

References HasError().

void osmscout::FileScanner::ReadNumber ( uint32_t &  number)

References HasError().

void osmscout::FileScanner::ReadNumber ( uint64_t &  number)

References HasError().

void osmscout::FileScanner::ReadTypeId ( TypeId id,
uint8_t  maxBytes 
)

References Read().


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