Libosmium
2.4.1
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <reader.hpp>
Public Member Functions | |
Reader (const osmium::io::File &file, osmium::osm_entity_bits::type read_which_entities=osmium::osm_entity_bits::all) | |
Reader (const std::string &filename, osmium::osm_entity_bits::type read_types=osmium::osm_entity_bits::all) | |
Reader (const char *filename, osmium::osm_entity_bits::type read_types=osmium::osm_entity_bits::all) | |
Reader (const Reader &)=delete | |
Reader & | operator= (const Reader &)=delete |
~Reader () | |
void | close () |
osmium::io::Header | header () const |
osmium::memory::Buffer | read () |
bool | eof () const |
Static Private Member Functions | |
static int | execute (const std::string &command, const std::string &filename, int *childpid) |
static int | open_input_file_or_url (const std::string &filename, int *childpid) |
Private Attributes | |
osmium::io::File | m_file |
osmium::io::detail::InputFormatFactory::create_input_type * | m_input_format_creator |
osmium::osm_entity_bits::type | m_read_which_entities |
std::atomic< bool > | m_input_done |
int | m_childpid |
osmium::thread::Queue < std::string > | m_input_queue |
std::unique_ptr < osmium::io::Decompressor > | m_decompressor |
std::future< bool > | m_read_future |
std::unique_ptr < osmium::io::detail::InputFormat > | m_input |
This is the user-facing interface for reading OSM files. Instantiate an object of this class with a file name or osmium::io::File object and then call read() on it in a loop until it returns an invalid Buffer.
|
inlineexplicit |
Create new Reader object.
file | The file we want to open. |
read_which_entities | Which OSM entities (nodes, ways, relations, and/or changesets) should be read from the input file. It can speed the read up significantly if objects that are not needed anyway are not parsed. |
|
inlineexplicit |
|
inlineexplicit |
|
delete |
|
inline |
|
inline |
|
inline |
Has the end of file been reached? This is set after the last data has been read. It is also set by calling close().
|
inlinestaticprivate |
Fork and execute the given command in the child. A pipe is created between the child and the parent. The child writes to the pipe, the parent reads from it. This function never returns in the child.
command | Command to execute in the child. |
filename | Filename to give to command as argument. |
std::system_error | if a system call fails. |
|
inline |
Get the header data from the file.
|
inlinestaticprivate |
|
inline |
Reads the next buffer from the input. An invalid buffer signals end-of-file. After end-of-file all read() calls will return an invalid buffer. An invalid buffer is also always returned if osmium::osm_entity_bits::nothing was set when the Reader was constructed.
Some | form of std::runtime_error if there is an error. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |