Libosmium
2.8.0
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 (Reader &&)=default | |
Reader & | operator= (Reader &&)=default |
~Reader () noexcept | |
void | close () |
osmium::io::Header | header () |
osmium::memory::Buffer | read () |
bool | eof () const |
Private Types | |
enum | status { status::okay = 0, status::error = 1, status::closed = 2, status::eof = 3 } |
Static Private Member Functions | |
static void | parser_thread (const osmium::io::File &file, detail::future_string_queue_type &input_queue, detail::future_buffer_queue_type &osmdata_queue, std::promise< osmium::io::Header > &&header_promise, osmium::osm_entity_bits::type read_which_entities) |
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::osm_entity_bits::type | m_read_which_entities |
enum osmium::io::Reader::status | m_status |
int | m_childpid |
detail::future_string_queue_type | m_input_queue |
std::unique_ptr< osmium::io::Decompressor > | m_decompressor |
osmium::io::detail::ReadThreadManager | m_read_thread_manager |
detail::future_buffer_queue_type | m_osmdata_queue |
detail::queue_wrapper< osmium::memory::Buffer > | m_osmdata_queue_wrapper |
std::future< osmium::io::Header > | m_header_future |
osmium::io::Header | m_header |
osmium::thread::thread_handler | m_thread |
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.
|
strongprivate |
|
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 |
|
default |
|
inlinenoexcept |
|
inline |
Close down the Reader. A call to this is optional, because the destructor of Reader will also call this. But if you don't call this function first, you might miss an exception, because the destructor is not allowed to throw.
Some | form of osmium::io_error when there is a problem. |
|
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.
Some | form of osmium::io_error if there is an error. |
|
inlinestaticprivate |
|
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 osmium::io_error if there is an error. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |