Libosmium  2.20.0
Fast and flexible C++ library for working with OpenStreetMap data
Classes | Functions
osmium::util Namespace Reference

Helpful utility classes and functions not strictly OSM related. More...

Classes

class  AnonymousMemoryMapping
 
class  AnonymousTypedMemoryMapping
 
class  DeltaDecode
 
class  DeltaEncode
 
class  MemoryMapping
 
class  Options
 
class  TypedMemoryMapping
 
class  VerboseOutput
 

Functions

uint16_t byte_swap_16 (uint16_t value) noexcept
 
uint32_t byte_swap_32 (uint32_t value) noexcept
 
uint64_t byte_swap_64 (uint64_t value) noexcept
 
template<typename T >
double2string (T iterator, double value, int precision)
 
void double2string (std::string &out, double value, int precision)
 
std::size_t file_size (int fd)
 
std::size_t file_size (const char *name)
 
std::size_t file_size (const std::string &name)
 
void resize_file (int fd, std::size_t new_size)
 
std::size_t get_pagesize () noexcept
 
std::size_t file_offset (int fd) noexcept
 
bool isatty (int fd) noexcept
 
template<typename T >
VerboseOutputoperator<< (VerboseOutput &verbose_output, const T &value)
 

Detailed Description

Helpful utility classes and functions not strictly OSM related.

Function Documentation

◆ byte_swap_16()

uint16_t osmium::util::byte_swap_16 ( uint16_t  value)
inlinenoexcept

◆ byte_swap_32()

uint32_t osmium::util::byte_swap_32 ( uint32_t  value)
inlinenoexcept

◆ byte_swap_64()

uint64_t osmium::util::byte_swap_64 ( uint64_t  value)
inlinenoexcept

◆ double2string() [1/2]

void osmium::util::double2string ( std::string &  out,
double  value,
int  precision 
)
inline

Write double to string, removing superfluous '0' characters at the end. The decimal dot will also be removed if necessary.

Parameters
outstring
valuethe value that should be written
precisionmax number of digits after the decimal point

◆ double2string() [2/2]

template<typename T >
T osmium::util::double2string ( iterator,
double  value,
int  precision 
)
inline

Write double to iterator, removing superfluous '0' characters at the end. The decimal dot will also be removed if necessary.

Template Parameters
Titerator type
Parameters
iteratoroutput iterator
valuethe value that should be written
precisionmax number of digits after the decimal point (must be <= 17)

◆ file_offset()

std::size_t osmium::util::file_offset ( int  fd)
inlinenoexcept

Get current offset into file.

Parameters
fdOpen file descriptor.
Returns
File offset or 0 if it is not available.

◆ file_size() [1/3]

std::size_t osmium::util::file_size ( const char *  name)
inline

Get file size. This is a small wrapper around a system call.

Parameters
nameFile name
Returns
file size
Exceptions
std::system_errorIf system call failed
Precondition
name must not be nullptr

◆ file_size() [2/3]

std::size_t osmium::util::file_size ( const std::string &  name)
inline

Get file size. This is a small wrapper around a system call.

Parameters
nameFile name
Returns
file size
Exceptions
std::system_errorIf system call failed

◆ file_size() [3/3]

std::size_t osmium::util::file_size ( int  fd)
inline

Get file size. This is a small wrapper around a system call.

Parameters
fdFile descriptor
Returns
file size
Exceptions
std::system_errorIf system call failed

◆ get_pagesize()

std::size_t osmium::util::get_pagesize ( )
inlinenoexcept

Get the page size for this system.

◆ isatty()

bool osmium::util::isatty ( int  fd)
inlinenoexcept

Check whether the file descriptor refers to a TTY.

Parameters
fdOpen file descriptor.

◆ operator<<()

template<typename T >
VerboseOutput & osmium::util::operator<< ( VerboseOutput verbose_output,
const T &  value 
)
inline

◆ resize_file()

void osmium::util::resize_file ( int  fd,
std::size_t  new_size 
)
inline

Resize file. Small wrapper around ftruncate(2) system call.

Parameters
fdFile descriptor
new_sizeNew size
Exceptions
std::system_errorIf ftruncate(2) call failed