osmium::util Namespace Reference

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

## Classes

class | AnonymousMemoryMapping
class | AnonymousTypedMemoryMapping
class | DeltaDecode
class | DeltaEncode
class | DeltaEncodeIterator
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 >
T | double2string (T iterator, double value, int precision)
void | double2string (std::string &out, double value, int precision)
size_t | file_size (int fd)
void | resize_file (int fd, size_t new_size)
size_t | get_pagesize ()
template<typename T >
VerboseOutput & | operator<< (VerboseOutput &verbose_output, const T &value)

## Variables

constexpr int | max_double_length = 20

## Detailed Description

Helpful utility classes and functions not strictly OSM related.

## Function Documentation

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

inline noexcept

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

inline noexcept

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

inline noexcept

template<typename T >

T osmium::util::double2string | ( | T | 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

  T | iterator type

Parameters

  iterator | output iterator
  value | the value that should be written
  precision | max number of digits after the decimal point (must be <= 17)

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

  out | string
  value | the value that should be written
  precision | max number of digits after the decimal point

size_t osmium::util::file_size | ( | int | fd | ) |

inline

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

Parameters

  fd | File descriptor

Returns
  file size

Exceptions

  std::system_error | If system call failed

size_t osmium::util::get_pagesize | ( |  | ) |

inline

Get the page size for this system.

template<typename T >

VerboseOutput& osmium::util::operator<< | ( | VerboseOutput & | verbose_output,
|  | const T & | value
| ) |  |

inline

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

inline

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

Parameters

  fd | File descriptor
  new_size | New size

Exceptions

  std::system_error | If ftruncate(2) call failed

## Variable Documentation

constexpr int osmium::util::max_double_length = 20