Loading...
Searching...
No Matches
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>
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
void | file_seek (int fd, std::size_t offset) noexcept
bool | isatty (int fd) noexcept
template<typename T>
VerboseOutput & | operator<< (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

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

## double2string() [2/2]

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)

## file_offset()

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

inlinenoexcept

Get current offset into file.

Parameters

  fd | Open file descriptor.

Returns
  File offset or 0 if it is not available.

## file_seek()

void osmium::util::file_seek | ( | int | fd,
|  | std::size_t | offset )

inlinenoexcept

Set current offset into file.

Parameters

  fd | Open file descriptor.
  offset | Desired absolute offset into the file

## 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

  name | File name

Returns
  file size

Exceptions

  std::system_error | If 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

  name | File name

Returns
  file size

Exceptions

  std::system_error | If 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

  fd | File descriptor

Returns
  file size

Exceptions

  std::system_error | If 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

  fd | Open 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

  fd | File descriptor
  new_size | New size

Exceptions

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