Tkrzw
Classes | Namespaces | Functions | Variables
tkrzw_lib_common.h File Reference

Common library features. More...

#include <limits>
#include <iostream>
#include <map>
#include <memory>
#include <set>
#include <stdexcept>
#include <string>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
#include <cinttypes>
#include <cstdlib>
#include <cstring>

Classes

class  tkrzw::Status
 Status of operations. More...
 
class  tkrzw::StatusException
 Exception to convey the status of operations. More...
 

Namespaces

 tkrzw
 Common namespace of Tkrzw.
 

Functions

void * tkrzw::xmalloc (size_t size)
 Allocates a region on memory. More...
 
void * tkrzw::xcalloc (size_t nmemb, size_t size)
 Allocates a nullified region on memory. More...
 
void * tkrzw::xrealloc (void *ptr, size_t size)
 Re-allocates a region on memory. More...
 
void * tkrzw::xreallocappend (void *ptr, size_t size)
 Re-allocates a region on memory for appending operations. More...
 
void tkrzw::xfree (void *ptr)
 Frees a region on memory. More...
 
void * tkrzw::xmallocaligned (size_t alignment, size_t size)
 Allocates an aligned region on memory. More...
 
void tkrzw::xfreealigned (void *ptr)
 Frees an aligned region on memory. More...
 
template<typename SET >
bool tkrzw::CheckSet (SET set, const typename SET::key_type &elem)
 Checks whether a set has an element. More...
 
template<typename MAP >
bool tkrzw::CheckMap (MAP map, const typename MAP::key_type &key)
 Checks whether a map has a key. More...
 
template<typename MAP >
MAP::value_type::second_type tkrzw::SearchMap (MAP map, const typename MAP::key_type &key, const typename MAP::value_type::second_type &default_value)
 Searches a map and get the value of a record. More...
 
int64_t tkrzw::GetProcessID ()
 Gets the current processs ID. More...
 
std::map< std::string, std::string > tkrzw::GetSystemInfo ()
 Gets system information of the environment. More...
 
int64_t tkrzw::GetMemoryCapacity ()
 Gets the memory capacity of the platform. More...
 
int64_t tkrzw::GetMemoryUsage ()
 Gets the current memory usage of the process. More...
 
bool tkrzw::operator== (const Status::Code &lhs, const Status &rhs)
 Checks whether a status code is equal to another status object. More...
 
bool tkrzw::operator!= (const Status::Code &lhs, const Status &rhs)
 Checks whether a status code is not equal to another status object. More...
 
std::string tkrzw::ToString (const Status &status)
 Converts a status into a string. More...
 
std::ostream & tkrzw::operator<< (std::ostream &os, const Status &status)
 Outputs a status string into an output stream. More...
 
Status tkrzw::GetErrnoStatus (const char *call_name, int32_t sys_err_num)
 Gets a status according to a system error number of a system call. More...
 

Variables

constexpr int8_t tkrzw::INT8MIN = std::numeric_limits<int8_t>::min()
 Disable macros to avoid possible name confliction. More...
 
constexpr int8_t tkrzw::INT8MAX = std::numeric_limits<int8_t>::max()
 The maximum value of int8_t. More...
 
constexpr uint8_t tkrzw::UINT8MAX = std::numeric_limits<uint8_t>::max()
 The maximum value of uint8_t. More...
 
constexpr int16_t tkrzw::INT16MIN = std::numeric_limits<int16_t>::min()
 The minimum value of int16_t. More...
 
constexpr int16_t tkrzw::INT16MAX = std::numeric_limits<int16_t>::max()
 The maximum value of int16_t. More...
 
constexpr uint16_t tkrzw::UINT16MAX = std::numeric_limits<uint16_t>::max()
 The maximum value of uint16_t. More...
 
constexpr int32_t tkrzw::INT32MIN = std::numeric_limits<int32_t>::min()
 The minimum value of int32_t. More...
 
constexpr int32_t tkrzw::INT32MAX = std::numeric_limits<int32_t>::max()
 The maximum value of int32_t. More...
 
constexpr uint32_t tkrzw::UINT32MAX = std::numeric_limits<uint32_t>::max()
 The maximum value of uint32_t. More...
 
constexpr int64_t tkrzw::INT64MIN = std::numeric_limits<int64_t>::min()
 The minimum value of int64_t. More...
 
constexpr int64_t tkrzw::INT64MAX = std::numeric_limits<int64_t>::max()
 The maximum value of int64_t. More...
 
constexpr uint64_t tkrzw::UINT64MAX = std::numeric_limits<uint64_t>::max()
 The maximum value of uint64_t. More...
 
constexpr size_t tkrzw::SIZEMAX = std::numeric_limits<size_t>::max()
 The maximum value of size_t. More...
 
constexpr float tkrzw::FLOATMIN = std::numeric_limits<float>::min()
 The minimum value of float. More...
 
constexpr float tkrzw::FLOATMAX = std::numeric_limits<float>::max()
 The maximum value of float. More...
 
constexpr double tkrzw::DOUBLEMIN = std::numeric_limits<double>::min()
 The minimum value of double. More...
 
constexpr double tkrzw::DOUBLEMAX = std::numeric_limits<double>::max()
 The maximum value of double. More...
 
constexpr double tkrzw::DOUBLENAN = std::numeric_limits<double>::quiet_NaN()
 The quiet Not-a-Number value of double. More...
 
constexpr double tkrzw::DOUBLEINF = std::numeric_limits<double>::infinity()
 The positive infinity value of double. More...
 
constexpr int32_t tkrzw::NUM_BUFFER_SIZE = 32
 The buffer size for a numeric string expression. More...
 
constexpr int64_t tkrzw::MAX_MEMORY_SIZE = (1LL << 40)
 The maximum memory size. More...
 
const int32_t tkrzw::PAGE_SIZE
 The size of a memory page on the OS. More...
 
const char *const tkrzw::PACKAGE_VERSION
 The string expression of the package version. More...
 
const char *const tkrzw::LIBRARY_VERSION
 The string expression of the library version. More...
 
const char *const tkrzw::OS_NAME
 The recognized OS name. More...
 
const bool tkrzw::IS_POSIX
 True if the OS is conforming to POSIX. More...
 
const bool tkrzw::IS_BIG_ENDIAN
 True if the byte order is big endian. More...
 

Detailed Description

Common library features.