Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
toolbox Namespace Reference

Namespaces

namespace  bm
 
namespace  detail
 
namespace  hdr
 A C++ port of HdrHistogram_c written Michael Barker and released to the public domain.
 
namespace  http
 
namespace  io
 
namespace  net
 
namespace  os
 
namespace  resp
 
namespace  sys
 
namespace  util
 

Classes

class  Alarm
 
struct  Allocator
 
struct  AlwaysFalse
 
class  App
 
class  ArgvLexer
 
class  ArgvSequence
 Utility class that allows an argv array to be treated as a sequence. More...
 
class  ArrayView
 
class  AsyncLogger
 
class  BasicConn
 
class  BasicDisposer
 
class  BasicHandle
 
class  BasicParser
 
class  BasicServ
 
class  BasicSlot
 
class  BasicTrans
 
class  BasicUrl
 
struct  BucketConfig
 Bucket configuration. More...
 
class  Buffer
 
class  Config
 Simple config reader with environment variable substitution. More...
 
class  CountAddedIterator
 CountAddedIterator is a recorded value iterator. More...
 
class  CyclTime
 
struct  DgramProtocol
 
struct  DgramSock
 Connectionless Datagram Socket. All state is in base class, so object can be sliced. More...
 
class  Epoll
 
class  EventFd
 
struct  Exception
 
struct  FilePolicy
 
class  FileWatcher
 FileWatcher watches for changes to files. More...
 
class  Finally
 
struct  FunctionTraits
 Default case for functors and lambdas. More...
 
struct  FunctionTraits< ReturnT(*)(ArgsT...) noexcept >
 Specialisation for noexcept free functions. More...
 
struct  FunctionTraits< ReturnT(*)(ArgsT...)>
 Specialisation for free functions. More...
 
struct  FunctionTraits< ReturnT(ClassT::*)(ArgsT...) const >
 Specialisation for const member functions. More...
 
struct  FunctionTraits< ReturnT(ClassT::*)(ArgsT...) const noexcept >
 Specialisation for const noexcept member functions. More...
 
struct  FunctionTraits< ReturnT(ClassT::*)(ArgsT...) noexcept >
 Specialisation for noexcept member functions. More...
 
struct  FunctionTraits< ReturnT(ClassT::*)(ArgsT...)>
 Specialisation for member functions. More...
 
class  Help
 
class  Histogram
 A High Dynamic Range (HDR) Histogram. More...
 
struct  Hook
 
struct  Id16Policy
 
struct  Id32Policy
 
struct  Id64Policy
 
class  Inotify
 Inotify provides a simplified interface to an inotify instance. More...
 
struct  IntPolicy
 
struct  IntWrapper
 
struct  IoSock
 
struct  IpMcastGroup
 
struct  is_instantiation_of
 
struct  is_instantiation_of< TemplateTypeT< TypeT >, TemplateTypeT >
 
struct  is_string
 
struct  is_string< std::string >
 
struct  is_string< std::string_view >
 
struct  IsoDatePolicy
 
class  Iterator
 Iterator is the base iterator for all iterator types. More...
 
struct  JDayPolicy
 
class  LinearIterator
 LinearIterator is a linear value iterator. More...
 
class  Log
 
class  Logger
 
class  LogIterator
 LogIterator is a logarithmic value iterator. More...
 
struct  McastSock
 Connectionless Datagram Socket. All state is in base class, so object can be sliced. More...
 
struct  MonoClock
 
struct  MsgEvent
 
class  MultiConfig
 
class  NoOp
 
class  Options
 
class  OStaticStream
 
class  OStream
 
struct  overloaded
 
class  PercentileIterator
 PercentileIterator is a percentile iterator. More...
 
class  Presence
 
struct  PutPercentiles
 
struct  PutTime
 
class  RateLimit
 
class  RateWindow
 RateWindow maintains a sliding window of second time buckets for the specified interval. More...
 
class  Reactor
 
class  ReactorRunner
 
class  RecordedIterator
 RecordedIterator is a recorded value iterator. More...
 
class  RefCount
 Base class for atomic referenced counted objects. More...
 
class  Request
 
class  Resolver
 
class  RingBuffer
 
class  Runner
 
class  ScopedLogger
 
class  ScopedLogLevel
 
class  SigWait
 
struct  Sock
 
class  StaticStreamBuf
 
class  StreamAcceptor
 
class  StreamBuf
 
class  StreamConnector
 
class  StreamInserter
 
struct  StreamProtocol
 
struct  StreamSockClnt
 Active Client Stream Socket. All state is in base class, so object can be sliced. More...
 
struct  StreamSockServ
 Passive Server Stream Socket. All state is in base class, so object can be sliced. More...
 
class  StringBuf
 String buffer with fixed upper-bound. More...
 
class  Switch
 
class  TaskQueue
 A vector-based task queue for use in multi-threaded, producer-consumer components. More...
 
struct  TcpProtocol
 
struct  ThreadConfig
 ThreadConfig holds the thread attributes. More...
 
struct  ThreadSafePolicy
 
struct  ThreadUnsafePolicy
 
class  Timer
 
class  TimerFd
 
class  TimerPool
 
class  TimerQueue
 
class  Tokeniser
 
struct  TransTraits
 
struct  TypeTraits
 
struct  TypeTraits< bool >
 
struct  TypeTraits< DgramEndpoint >
 
struct  TypeTraits< double >
 
struct  TypeTraits< std::chrono::duration< RepT, PeriodT > >
 
struct  TypeTraits< std::string >
 
struct  TypeTraits< std::string_view >
 
struct  TypeTraits< StreamEndpoint >
 
struct  TypeTraits< ValueT >
 
struct  TypeTraits< Version >
 
struct  TypeTraits< WallTime >
 
struct  UdpProtocol
 
struct  UnixDgramProtocol
 
struct  UnixStreamProtocol
 
class  Url
 
class  UrlView
 
class  Value
 
class  VarAccum
 
class  VarSub
 Variable substitution. More...
 
struct  Version
 
class  Waker
 
struct  WallClock
 
struct  WatchFile
 
struct  WatchFilePolicy
 

Typedefs

using Conn = BasicConn< Request, App >
 
using Headers = std::vector< std::pair< std::string, std::string > >
 
using Serv = BasicServ< Conn, App >
 
using ConstBuffer = boost::asio::const_buffer
 
using MutableBuffer = boost::asio::mutable_buffer
 
using EpollEvent = epoll_event
 
using FileHandle = BasicHandle< FilePolicy >
 
using HookList = boost::intrusive::list< Hook, boost::intrusive::constant_time_size< false > >
 
using WatchFileHandle = BasicHandle< WatchFilePolicy >
 
using IoSlot = BasicSlot< CyclTime, int, unsigned >
 
using HistogramPtr = std::unique_ptr< Histogram >
 
using MetricCallbackFunction = std::function< void(CyclTime now, HistogramPtr &&time_hist, HistogramPtr &&work_hist)>
 MetricCallbackFunction implementer is responsible for deleting the Histogram.
 
using LoopCallbackFunction = std::function< void(CyclTime now)>
 LoopCallbackFunction called at end of each Reactor loop, indicating micros taken and work done.
 
using TimerSlot = BasicSlot< CyclTime, Timer & >
 
template<typename ProtocolT >
using BasicEndpoint = boost::asio::generic::basic_endpoint< ProtocolT >
 
using DgramEndpoint = BasicEndpoint< DgramProtocol >
 
using StreamEndpoint = BasicEndpoint< StreamProtocol >
 
template<typename ProtocolT >
using IpEndpoint = boost::asio::ip::basic_endpoint< ProtocolT >
 
using UdpEndpoint = IpEndpoint< UdpProtocol >
 
using TcpEndpoint = IpEndpoint< TcpProtocol >
 
template<typename ProtocolT >
using UnixEndpoint = boost::asio::local::basic_endpoint< ProtocolT >
 
using UnixDgramEndpoint = UnixEndpoint< UnixDgramProtocol >
 
using UnixStreamEndpoint = UnixEndpoint< UnixStreamProtocol >
 
using IpAddr = boost::asio::ip::address
 
using IpAddrV4 = boost::asio::ip::address_v4
 
using IpAddrV6 = boost::asio::ip::address_v6
 
using AddrInfoFuture = std::future< AddrInfoPtr >
 
using AddrInfoPtr = std::unique_ptr< addrinfo, void(*)(addrinfo *)>
 
using IsoDate = IntWrapper< IsoDatePolicy >
 ISO8601 date in yyymmdd format.
 
using JDay = IntWrapper< JDayPolicy >
 Julian day.
 
using LogStream = util::OStream< MaxLogLine >
 Logger callback function.
 
using LogMsgPtr = StoragePtr< MaxLogLine >
 
using PidFile = std::unique_ptr< pidfh, detail::PidFileDeleter >
 
using Seconds = std::chrono::seconds
 
using Decis = std::chrono::duration< int64_t, std::deci >
 
using Millis = std::chrono::milliseconds
 
using Micros = std::chrono::microseconds
 
using Nanos = std::chrono::nanoseconds
 
using NanoTime = Nanos
 
using Duration = Nanos
 
using MonoTime = MonoClock::time_point
 
using WallTime = WallClock::time_point
 
using ErrMsg = OStaticStream< MaxErrSize >
 
using Int16Policy = IntPolicy< std::int16_t >
 
using Int32Policy = IntPolicy< std::int32_t >
 
using Int64Policy = IntPolicy< std::int64_t >
 
using Id16 = IntWrapper< Id16Policy >
 16 bit identifier.
 
using Id32 = IntWrapper< Id32Policy >
 32 bit identifier.
 
using Id64 = IntWrapper< Id64Policy >
 64 bit identifier.
 
template<typename KeyT >
using RobinHash = robin_hood::hash< KeyT >
 Robin Hood hash function template.
 
template<typename KeyT , typename ValueT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using RobinMap = robin_hood::unordered_map< KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N >
 
template<typename KeyT , typename ValueT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using RobinFlatMap = robin_hood::unordered_flat_map< KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N >
 Robin Hood unordered flat map.
 
template<typename KeyT , typename ValueT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using RobinNodeMap = robin_hood::unordered_node_map< KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N >
 Robin Hood unordered node map.
 
template<typename KeyT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using RobinSet = robin_hood::unordered_set< KeyT, HashT, KeyEqualT, MaxLoadFactor100N >
 
template<typename KeyT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using RobinFlatSet = robin_hood::unordered_flat_set< KeyT, HashT, KeyEqualT, MaxLoadFactor100N >
 Robin Hood unordered flat set.
 
template<typename KeyT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using RobinNodeSet = robin_hood::unordered_node_set< KeyT, HashT, KeyEqualT, MaxLoadFactor100N >
 Robin Hood unordered node set.
 
template<std::size_t SizeN>
using StoragePtr = std::unique_ptr< void, detail::StorageDeleter< SizeN > >
 
using OStreamJoiner = std::experimental::ostream_joiner< char >
 
using sv = std::string_view
 
template<std::size_t N>
using Row = std::array< std::string_view, N >
 

Enumerations

enum class  First : bool { No = false , Yes = true }
 
enum class  NoCache : bool { No = false , Yes = true }
 
enum class  Method : int {
  Delete = HTTP_DELETE , Get = HTTP_GET , Head = HTTP_HEAD , Post = HTTP_POST ,
  Put = HTTP_PUT , Connect = HTTP_CONNECT , Options = HTTP_OPTIONS , Trace = HTTP_TRACE ,
  Copy = HTTP_COPY , Lock = HTTP_LOCK , MkCol = HTTP_MKCOL , Move = HTTP_MOVE ,
  PropFind = HTTP_PROPFIND , PropPatch = HTTP_PROPPATCH , Search = HTTP_SEARCH , Unlock = HTTP_UNLOCK ,
  Bind = HTTP_BIND , Rebind = HTTP_REBIND , Unbind = HTTP_UNBIND , Acl = HTTP_ACL ,
  Report = HTTP_REPORT , MkActivity = HTTP_MKACTIVITY , Checkout = HTTP_CHECKOUT , Merge = HTTP_MERGE ,
  MSearch = HTTP_MSEARCH , Notify = HTTP_NOTIFY , Subscribe = HTTP_SUBSCRIBE , Unsubscribe = HTTP_UNSUBSCRIBE ,
  Patch = HTTP_PATCH , Purge = HTTP_PURGE , MkCalendar = HTTP_MKCALENDAR , Link = HTTP_LINK ,
  Unlink = HTTP_UNLINK , Source = HTTP_SOURCE
}
 
enum class  Status : int {
  Ok = HTTP_STATUS_OK , NoContent = HTTP_STATUS_NO_CONTENT , BadRequest = HTTP_STATUS_BAD_REQUEST , Unauthorized = HTTP_STATUS_UNAUTHORIZED ,
  Forbidden = HTTP_STATUS_FORBIDDEN , NotFound = HTTP_STATUS_NOT_FOUND , MethodNotAllowed = HTTP_STATUS_METHOD_NOT_ALLOWED , RequestTimeout = HTTP_STATUS_REQUEST_TIMEOUT ,
  InternalServerError = HTTP_STATUS_INTERNAL_SERVER_ERROR , ServiceUnavailable = HTTP_STATUS_SERVICE_UNAVAILABLE
}
 
enum class  Type : int { Request = HTTP_REQUEST , Response = HTTP_RESPONSE }
 
enum  : unsigned {
  EpollIn = EPOLLIN , EpollOut = EPOLLOUT , EpollRdHup = EPOLLRDHUP , EpollPri = EPOLLPRI ,
  EpollErr = EPOLLERR , EpollHup = EPOLLHUP , EpollEt = EPOLLET , EpollOneShot = EPOLLONESHOT
}
 
enum class  Priority { High = 0 , Low = 1 }
 
enum class  Type : char {
  None = '\0' , CommandLine = '\1' , SimpleString = '+' , Error = '-' ,
  Integer = ':' , BulkString = '$' , Array = '*'
}
 Type is an enumeration of the RESP data-types currently supported. More...
 
enum  : std::size_t {
  CacheLineBits = 6 , CacheLineSize = 1 << CacheLineBits , PageBits = 12 , PageSize = 1 << PageBits ,
  MaxLogLine = 4096
}
 
enum class  LogLevel : int {
  None , Crit , Error , Warn ,
  Metric , Notice , Info , Debug
}
 
enum class  Test : int { Foo = 1 , Bar = 2 , Baz = 4 , Qux = 8 }
 

Functions

int64_t min (const Histogram &h) noexcept
 
int64_t max (const Histogram &h) noexcept
 
int64_t value_at_percentile (const Histogram &h, double percentile) noexcept
 
double mean (const Histogram &h) noexcept
 
double stddev (const Histogram &h) noexcept
 
ostream & operator<< (ostream &os, PutPercentiles pp)
 
auto put_percentiles (const Histogram &h, std::int32_t ticks_per_half_distance, double value_scale) noexcept
 
const std::error_category & error_category () noexcept
 
std::error_code make_error_code (Status status)
 
Status http_status (const std::error_code &ec)
 
const charenum_string (Status status) noexcept
 
const charenum_string (Method method) noexcept
 
std::ostream & operator<< (std::ostream &os, Method method)
 
std::ostream & operator<< (std::ostream &os, Status status)
 
ConstBuffer advance (ConstBuffer buf, std::size_t n) noexcept
 
MutableBuffer advance (MutableBuffer buf, std::size_t n) noexcept
 
template<typename DataT >
void emplace_event (MsgEvent &ev, int type) noexcept
 
template<typename DataT , typename... ArgsT>
void emplace_event (MsgEvent &ev, int type, ArgsT &&... args) noexcept
 
template<typename DataT >
const DataTdata (const MsgEvent &ev) noexcept
 
template<typename DataT >
DataTdata (MsgEvent &ev) noexcept
 
std::size_t file_size (int fd)
 Get file size.
 
mode_t file_mode () noexcept
 Get current file mode.
 
void set_non_block (int fd, std::error_code &ec) noexcept
 
void set_non_block (int fd)
 
template<typename PolicyT >
constexpr bool operator== (const BasicHandle< PolicyT > &lhs, const BasicHandle< PolicyT > &rhs)
 
template<typename PolicyT >
constexpr bool operator!= (const BasicHandle< PolicyT > &lhs, const BasicHandle< PolicyT > &rhs)
 
void dispatch (CyclTime now, const HookList &l) noexcept
 
constexpr bool operator== (WatchFile lhs, WatchFile rhs)
 
constexpr bool operator!= (WatchFile lhs, WatchFile rhs)
 
FileHandle inotify_init (int flags, std::error_code &ec) noexcept
 Initialise an inotify instance.
 
FileHandle inotify_init (std::error_code &ec) noexcept
 Initialise an inotify instance.
 
FileHandle inotify_init (int flags=0)
 
WatchFileHandle inotify_add_watch (int fd, const char *path, std::uint32_t mask, std::error_code &ec) noexcept
 Add a watch to an initialised inotify instance.
 
WatchFileHandle inotify_add_watch (int fd, const char *path, std::uint32_t mask)
 Add a watch to an initialised inotify instance.
 
void intrusive_ptr_release (Timer::Impl *impl) noexcept
 
void intrusive_ptr_add_ref (Timer::Impl *impl) noexcept
 
std::ostream & operator<< (std::ostream &os, const Timer &tmr)
 
constexpr std::uint16_t bswap (std::uint16_t n) noexcept
 
constexpr std::int16_t bswap (std::int16_t n) noexcept
 
constexpr std::uint32_t bswap (std::uint32_t n) noexcept
 
constexpr std::int32_t bswap (std::int32_t n) noexcept
 
constexpr std::uint64_t bswap (std::uint64_t n) noexcept
 
constexpr std::int64_t bswap (std::int64_t n) noexcept
 
template<typename ValueT >
requires std::integral<ValueT>
constexpr ValueT ntoh (ValueT n) noexcept
 
template<typename ValueT >
requires std::integral<ValueT>
constexpr ValueT hton (ValueT n) noexcept
 
template<typename ValueT >
requires std::integral<ValueT>
constexpr ValueT ltoh (ValueT n) noexcept
 
template<typename ValueT >
requires std::integral<ValueT>
constexpr ValueT htol (ValueT n) noexcept
 
AddrInfoPtr parse_endpoint (string_view uri, int type)
 
istream & operator>> (istream &is, DgramEndpoint &ep)
 
istream & operator>> (istream &is, StreamEndpoint &ep)
 
ostream & operator<< (ostream &os, const DgramEndpoint &ep)
 
ostream & operator<< (ostream &os, const StreamEndpoint &ep)
 
DgramEndpoint parse_dgram_endpoint (std::string_view uri)
 
StreamEndpoint parse_stream_endpoint (std::string_view uri)
 
const std::error_category & gai_error_category () noexcept
 
std::error_code make_gai_error_code (int err) noexcept
 
constexpr std::uint16_t get_length (const char *buf, std::endian net_byte_order) noexcept
 
std::uint16_t get_length (ConstBuffer buf, std::endian net_byte_order) noexcept
 
void put_length (char *buf, std::uint16_t len, std::endian net_byte_order) noexcept
 
void put_length (MutableBuffer buf, std::uint16_t len, std::endian net_byte_order) noexcept
 
template<typename FnT >
std::size_t parse_frame (ConstBuffer buf, FnT fn, std::endian net_byte_order)
 
template<typename FnT >
std::size_t parse_frame (std::string_view buf, FnT fn, std::endian net_byte_order)
 
template<typename ProtocolT >
std::pair< IoSock, IoSocksocketpair (ProtocolT protocol)
 
void join_group (int sockfd, const IpMcastGroup &group, std::error_code &ec) noexcept
 Join a multicast group.
 
void join_group (int sockfd, const IpMcastGroup &group)
 Join a multicast group.
 
void join_group (int sockfd, const IpAddr &addr, unsigned ifindex, std::error_code &ec) noexcept
 Join a multicast group.
 
void join_group (int sockfd, const IpAddr &addr, unsigned ifindex)
 Join a multicast group.
 
void join_group (int sockfd, const IpAddr &addr, const char *ifname, std::error_code &ec) noexcept
 Join a multicast group. The system will choose an appropriate interface if ifname is null.
 
void join_group (int sockfd, const IpAddr &addr, const char *ifname)
 Join a multicast group. The system will choose an appropriate interface if ifname is null.
 
void leave_group (int sockfd, const IpMcastGroup &group, std::error_code &ec) noexcept
 Leave a multicast group.
 
void leave_group (int sockfd, const IpMcastGroup &group)
 Leave a multicast group.
 
void leave_group (int sockfd, const IpAddr &addr, unsigned ifindex, std::error_code &ec) noexcept
 Leave a multicast group.
 
void leave_group (int sockfd, const IpAddr &addr, unsigned ifindex)
 Leave a multicast group.
 
void leave_group (int sockfd, const IpAddr &addr, const char *ifname, std::error_code &ec) noexcept
 Leave a multicast group. The system will leave on the first matching interface if ifname is null.
 
void leave_group (int sockfd, const IpAddr &addr, const char *ifname)
 Leave a multicast group. The system will leave on the first matching interface if ifname is null.
 
void set_ip_mcast_if (int sockfd, int family, unsigned ifindex, std::error_code &ec) noexcept
 
void set_ip_mcast_if (int sockfd, int family, unsigned ifindex)
 
void set_ip_mcast_if (int sockfd, int family, const char *ifname, std::error_code &ec) noexcept
 
void set_ip_mcast_if (int sockfd, int family, const char *ifname)
 
void set_ip_mcast_loop (int sockfd, int family, bool enabled, std::error_code &ec) noexcept
 Determines whether sent multicast packets should be looped back to the local sockets.
 
void set_ip_mcast_loop (int sockfd, int family, bool enabled)
 Determines whether sent multicast packets should be looped back to the local sockets.
 
void set_ip_mcast_ttl (int sockfd, int family, int ttl, std::error_code &ec) noexcept
 Set or read the time-to-live value of outgoing multicast packets for this socket.
 
void set_ip_mcast_ttl (int sockfd, int family, int ttl)
 Set or read the time-to-live value of outgoing multicast packets for this socket.
 
RateLimit parse_rate_limit (const string &s)
 
istream & operator>> (istream &is, RateLimit &rl)
 
ostream & operator<< (ostream &os, RateLimit rl)
 
template<typename EndpointT >
EndpointT get_endpoint (AddrInfoFuture &future)
 Wait for future and convert result to endpoint.
 
template<typename ResultT >
bool is_ready (std::future< ResultT > &future)
 Returns true if future is ready.
 
AddrInfoPtr get_unix_addrinfo (std::string_view path, int type)
 Create an addrinfo structure for a Unix domain address.
 
template<typename EndpointT >
void get_sock_name (int sockfd, EndpointT &ep, std::error_code &ec) noexcept
 
template<typename EndpointT >
void get_sock_name (int sockfd, EndpointT &ep)
 
std::error_code get_so_error (int sockfd, std::error_code &ec) noexcept
 
std::error_code get_so_error (int sockfd)
 
int get_so_rcv_buf (int sockfd, std::error_code &ec) noexcept
 
int get_so_rcv_buf (int sockfd)
 
int get_so_snd_buf (int sockfd, std::error_code &ec) noexcept
 
int get_so_snd_buf (int sockfd)
 
bool is_tcp_no_delay (int sockfd, std::error_code &ec) noexcept
 
bool is_tcp_no_delay (int sockfd)
 
void set_so_rcv_buf (int sockfd, int size, std::error_code &ec) noexcept
 
void set_so_rcv_buf (int sockfd, int size)
 
void set_so_reuse_addr (int sockfd, bool enabled, std::error_code &ec) noexcept
 
void set_so_reuse_addr (int sockfd, bool enabled)
 
void set_so_snd_buf (int sockfd, int size, std::error_code &ec) noexcept
 
void set_so_snd_buf (int sockfd, int size)
 
void set_tcp_no_delay (int sockfd, bool enabled, std::error_code &ec) noexcept
 
void set_tcp_no_delay (int sockfd, bool enabled)
 
void set_tcp_syn_nt (int sockfd, int retrans, std::error_code &ec) noexcept
 
void set_tcp_syn_nt (int sockfd, int retrans)
 
void close_all () noexcept
 Close all non-standard file handles.
 
void daemon ()
 Daemonise process. Detach from controlling terminal and run in the background as a system daemon.
 
constexpr auto operator""_ymd (unsigned long long val) noexcept
 
constexpr auto operator""_jd (unsigned long long val) noexcept
 
constexpr auto ymd_to_iso (int year, int mon, int mday) noexcept
 Gregorian to ISO8601 date.
 
constexpr auto ymd_to_jd (int year, int mon, int mday) noexcept
 Gregorian date to Julian day.
 
constexpr auto iso_to_jd (IsoDate iso) noexcept
 ISO8601 to Julian day.
 
constexpr auto jd_to_iso (JDay jd) noexcept
 Julian day to ISO8601.
 
constexpr std::int32_t jd_to_mjd (JDay jd) noexcept
 Juilian day to Modified Julian day. Epoch is November 17, 1858.
 
constexpr auto mjd_to_jd (std::int32_t mjd) noexcept
 Modified Julian day to Julian day. Epoch is November 17, 1858.
 
constexpr std::int32_t jd_to_tjd (JDay jd) noexcept
 Julian day to Truncated Julian day. Epoch is May 24, 1968.
 
constexpr JDay tjd_to_jd (std::int32_t tjd) noexcept
 Truncated Julian day to Julian day. Epoch is May 24, 1968.
 
constexpr WallTime jd_to_time (JDay jd) noexcept
 Julian day to Unix time.
 
constexpr IsoDate maybe_jd_to_iso (JDay jd) noexcept
 Julian day to ISO8601 if argument is non-zero.
 
constexpr JDay maybe_iso_to_jd (IsoDate iso) noexcept
 ISO8601 to Julian day if argument is non-zero.
 
constexpr bool is_week_day (JDay jday) noexcept
 
constexpr bool is_weekend_day (JDay jday) noexcept
 
constexpr auto parse_date (std::string_view sv) noexcept
 
constexpr std::optional< WallTimeparse_time (std::string_view sv) noexcept
 
std::error_code make_error (int err) noexcept
 
constexpr std::size_t ceil_cache_line (std::size_t size) noexcept
 
constexpr std::size_t ceil_page (std::size_t size) noexcept
 
LogStreamlog_stream () noexcept
 
Loggernull_logger () noexcept
 Null logger. This logger does nothing and is effectively /dev/null.
 
Loggerstd_logger () noexcept
 
Loggersys_logger () noexcept
 System logger. This logger calls syslog().
 
const charlog_label (LogLevel level) noexcept
 Return log label for given log level.
 
LogLevel get_log_level () noexcept
 Return current log level.
 
LogLevel set_log_level (LogLevel level) noexcept
 Set log level globally for all threads.
 
Loggerget_logger () noexcept
 Return current logger.
 
Loggerset_logger (Logger &logger) noexcept
 Set logger globally for all threads.
 
void write_log (WallTime ts, LogLevel level, LogMsgPtr &&msg, std::size_t size) noexcept
 
bool is_log_level (LogLevel level) noexcept
 Return true if level is less than or equal to current log level.
 
Loggerset_logger (std::nullptr_t) noexcept
 
std::ostream & operator<< (std::ostream &os, LogLevel level)
 
PidFile open_pid_file (const char *path, mode_t mode)
 
void close_pid_file (PidFile &pf) noexcept
 Close pidfile without removing it. This function should be used when forking daemon processes.
 
void write_pid_file (PidFile &pf)
 Write process' PID into pidfile.
 
void sig_block_all ()
 Block all signals.
 
cpu_set_t parse_cpu_set (string_view s) noexcept
 
int parse_sched_policy (string_view s)
 
void set_thread_attrs (const ThreadConfig &config)
 
TOOLBOX_WEAK Nanos get_time (clockid_t clock_id) noexcept
 
ostream & operator<< (ostream &os, MonoTime t)
 
ostream & operator<< (ostream &os, WallTime t)
 
template<typename RepT , typename PeriodT >
constexpr bool is_zero (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr bool is_zero (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT , typename DurationT >
constexpr DurationT time_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT >
constexpr std::int64_t ms_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT >
constexpr std::int64_t us_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT >
constexpr std::int64_t ns_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT , typename RepT , typename PeriodT >
constexpr auto to_time (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr auto to_time (timeval tv) noexcept
 
template<typename ClockT >
constexpr auto to_time (timespec ts) noexcept
 
template<typename RepT , typename PeriodT >
constexpr timeval to_timeval (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr timeval to_timeval (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename RepT , typename PeriodT >
constexpr timespec to_timespec (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr timespec to_timespec (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename DurationT = Seconds>
auto put_time (WallTime t, const char *fmt) noexcept
 
template<typename DurationT >
std::ostream & operator<< (std::ostream &os, PutTime< DurationT > pt)
 
constexpr bool is_zero (timeval tv) noexcept
 
void clear (timeval &tv) noexcept
 
timeval operator+ (timeval lhs, timeval rhs) noexcept
 
timeval operator- (timeval lhs, timeval rhs) noexcept
 
constexpr bool is_zero (timespec ts) noexcept
 
void clear (timespec &ts) noexcept
 
timespec operator+ (timespec lhs, timespec rhs) noexcept
 
timespec operator- (timespec lhs, timespec rhs) noexcept
 
constexpr auto parse_nanos (std::string_view sv) noexcept
 
constexpr std::optional< Nanosparse_time_only (std::string_view sv) noexcept
 
TOOLBOX_WEAK voidallocate (size_t size)
 
TOOLBOX_WEAK void deallocate (void *ptr, size_t size) noexcept
 
TOOLBOX_API voidallocate (std::size_t size)
 
TOOLBOX_API void deallocate (void *ptr, std::size_t size) noexcept
 
template<typename ValueT , std::size_t SizeN>
constexpr std::size_t array_size (const ValueT(&)[SizeN]) noexcept
 
template<typename ValueT >
constexpr ArrayView< std::remove_volatile_t< ValueT > > make_array_view (const ValueT *ptr, std::size_t len) noexcept
 
template<typename ValueT , std::size_t SizeN>
constexpr ArrayView< std::remove_cv_t< ValueT > > make_array_view (ValueT(&arr)[SizeN]) noexcept
 
template<typename FnT >
std::istream & parse_section (std::istream &is, FnT fn, std::string *name=nullptr)
 
template<typename EnumT >
requires Enum<EnumT>
constexpr EnumT box (typename std::underlying_type_t< EnumT > val) noexcept
 
template<typename EnumT >
requires Enum<EnumT>
constexpr std::underlying_type_t< EnumTunbox (EnumT val) noexcept
 
constexpr Test operator""_test (unsigned long long val) noexcept
 
const charenum_string (Test t)
 
ostream & operator<< (ostream &os, Test t)
 
ErrMsgerr_msg () noexcept
 
template<typename ExceptionT >
auto put_as_json (const ExceptionT &e)
 
template<typename ExceptionT >
auto put_with_code (const ExceptionT &e)
 
template<typename FnT >
auto make_finally (FnT fn) noexcept
 
template<typename PolicyT >
std::size_t hash_value (IntWrapper< PolicyT > wrapper)
 
constexpr Id16 operator""_id16 (unsigned long long val) noexcept
 
constexpr Id32 operator""_id32 (unsigned long long val) noexcept
 
constexpr Id64 operator""_id64 (unsigned long long val) noexcept
 
constexpr bool is_pow2 (std::size_t n) noexcept
 
unsigned next_pow2 (unsigned n) noexcept
 
unsigned long next_pow2 (unsigned long n) noexcept
 
template<int BitsN>
constexpr std::size_t ceil_pow2 (std::size_t size) noexcept
 
double var (const VarAccum &v) noexcept
 
double varp (const VarAccum &v) noexcept
 
double stdev (const VarAccum &v) noexcept
 
double stdevp (const VarAccum &v) noexcept
 
double zscore (double mean, double sd, double val) noexcept
 
double pctile95 (double mean, double sd) noexcept
 
double pctile99 (double mean, double sd) noexcept
 
double pctile999 (double mean, double sd) noexcept
 
constexpr std::size_t ceil (std::size_t dividend, std::size_t divisor) noexcept
 
ostream & operator<< (ostream &out, const Options &options)
 
template<typename DerivedT , typename PolicyT >
void intrusive_ptr_add_ref (const RefCount< DerivedT, PolicyT > *ptr) noexcept
 
template<typename DerivedT , typename PolicyT >
void intrusive_ptr_release (const RefCount< DerivedT, PolicyT > *ptr) noexcept
 
template<typename ValueT , typename... ArgsT>
boost::intrusive_ptr< ValueTmake_intrusive (ArgsT &&... args)
 
template<auto FnT>
constexpr auto bind () noexcept
 
template<typename ClassT >
constexpr auto bind (ClassT *obj) noexcept
 
template<auto MemFnT, typename ClassT = typename FunctionTraits<decltype(MemFnT)>::ClassType>
constexpr auto bind (ClassT *obj) noexcept
 
template<std::size_t SizeN>
StoragePtr< SizeNmake_storage ()
 Returns a block of dynamic storage acquired from the custom allocator.
 
TOOLBOX_API void reset (std::ostream &os) noexcept
 
template<std::size_t MaxN, typename ValueT >
autooperator<< (OStaticStream< MaxN > &os, ValueT &&val)
 
template<auto DelimT, typename ArgT , typename... ArgsT>
void join (std::ostream &os, const ArgT &arg, const ArgsT &... args)
 
template<typename OStreamT , typename FnT >
auto make_stream_inserter (FnT fn)
 Returns a StreamInserter object, automatically deducing functor type from arguments.
 
void ltrim (string_view &s) noexcept
 
void ltrim (string &s) noexcept
 
void rtrim (string_view &s) noexcept
 
void rtrim (string &s) noexcept
 
pair< string_view, string_view > split_pair (string_view s, char delim) noexcept
 
pair< string, string > split_pair (const string &s, char delim)
 
template<typename ValueT >
constexpr ValueT from_string (std::string_view sv)
 
template<typename ValueT >
constexpr ValueT from_string (const std::string &s)
 
template<typename ValueT >
constexpr ValueT from_string (const char *s)
 
template<typename ValueT >
std::string to_string (ValueT &&val)
 
template<typename ValueT >
requires Arithmetic<ValueT>
std::string to_string (ValueT &&val)
 
template<std::size_t SizeN>
constexpr std::string_view to_string_view (const char(&val)[SizeN]) noexcept
 
void trim (std::string_view &s) noexcept
 
void trim (std::string &s) noexcept
 
std::string_view ltrim_copy (std::string_view s) noexcept
 
std::string ltrim_copy (std::string s) noexcept
 
std::string_view rtrim_copy (std::string_view s) noexcept
 
std::string rtrim_copy (std::string s) noexcept
 
std::string_view trim_copy (std::string_view s) noexcept
 
std::string trim_copy (std::string s) noexcept
 
template<char PadC>
constexpr std::size_t pstrlen (const char *src, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t pstrlen (const char(&src)[SizeN]) noexcept
 
template<char PadC>
constexpr std::size_t pstrcpy (char *dst, const char *src, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t pstrcpy (char(&dst)[SizeN], const char *src) noexcept
 
template<char PadC>
constexpr std::size_t pstrcpy (char *dst, std::string_view src, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t pstrcpy (char(&dst)[SizeN], std::string_view src) noexcept
 
template<char PadC>
constexpr std::size_t pstrcpyid (char *dst, std::int64_t id, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t pstrcpyid (char(&dst)[SizeN], std::int64_t id) noexcept
 
template<char PadC>
constexpr std::size_t lpstrlen (const char *src, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t lpstrlen (const char(&src)[SizeN]) noexcept
 
template<char PadC>
constexpr std::size_t lpstrcpy (char *dst, const char *src, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t lpstrcpy (char(&dst)[SizeN], const char *src) noexcept
 
template<char PadC>
constexpr std::size_t lpstrcpy (char *dst, std::string_view src, std::size_t n) noexcept
 
template<char PadC, std::size_t SizeN>
constexpr std::size_t lpstrcpy (char(&dst)[SizeN], std::string_view src) noexcept
 
template<typename... ArgsT>
std::string make_string (ArgsT &&... args)
 
template<std::size_t MaxN>
constexpr std::string_view operator+ (const StringBuf< MaxN > &s) noexcept
 
template<std::size_t MaxN>
std::ostream & operator<< (std::ostream &os, const StringBuf< MaxN > &rhs)
 
template<typename... TagsT, typename... ValuesT>
constexpr bool empty (const detail::Struct< detail::Member< TagsT, ValuesT >... > &s)
 
template<typename... TagsT, typename... ValuesT>
constexpr std::size_t size (const detail::Struct< detail::Member< TagsT, ValuesT >... > &s)
 
template<typename TagT , typename... TagsT, typename... ValuesT>
constexpr bool has (const detail::Struct< detail::Member< TagsT, ValuesT >... > &s, TagT tag={})
 
template<typename TagT , typename... TagsT, typename... ValuesT>
constexpr const autoget (const detail::Struct< detail::Member< TagsT, ValuesT >... > &s, TagT tag={})
 
template<typename TagT , typename... TagsT, typename... ValuesT>
constexpr autoget (detail::Struct< detail::Member< TagsT, ValuesT >... > &s, TagT tag={})
 
template<typename FnT >
constexpr std::size_t parse_line (std::string_view buf, FnT fn)
 
template<std::size_t N>
constexpr void split (std::string_view line, std::string_view delims, Row< N > &row) noexcept
 
bool stob (string_view sv, bool dfl) noexcept
 
double stod (std::string_view sv, double dfl) noexcept
 
template<typename ValueT >
autoremove_const (const ValueT &ref)
 
constexpr bool isdigit (int c) noexcept
 
constexpr int dec_digits (std::int64_t i) noexcept
 
template<typename UIntegerT >
requires std::unsigned_integral<UIntegerT>
constexpr int hex_digits (UIntegerT i) noexcept
 
template<typename ValueT >
requires std::integral<ValueT> || std::same_as<ValueT, double>
constexpr ValueT ston (std::string_view sv) noexcept
 
template<class... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
string get_env (const string &name)
 
ostream & operator<< (ostream &os, Version ver)
 
std::size_t hash_value (toolbox::Version ver)
 

Variables

constexpr char ApplicationJson [] {"application/json"}
 
constexpr char TextHtml [] {"text/html"}
 
constexpr char TextPlain [] {"text/plain"}
 
constexpr Duration NoTimeout {-1}
 
constexpr std::size_t MaxErrSize {511}
 Maximum error message length.
 
constexpr detail::ResetState reset_state {}
 I/O manipulator that resets I/O state.
 
constexpr auto Struct = detail::Struct<>{}
 

Function Documentation

◆ allocate() [1/2]

void * toolbox::allocate ( size_t  size)

Definition at line 25 of file Allocator.cpp.

Referenced by toolbox::util::Allocator::operator new().

◆ deallocate() [1/2]

void toolbox::deallocate ( void ptr,
size_t  size 
)
noexcept

◆ allocate() [2/2]

TOOLBOX_API void * toolbox::allocate ( std::size_t  size)

◆ deallocate() [2/2]

TOOLBOX_API void toolbox::deallocate ( void ptr,
std::size_t  size 
)
noexcept