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

Namespaces

namespace  detail
 

Classes

class  Alarm
 
struct  Allocator
 
struct  AlwaysFalse
 
class  ArgvLexer
 
class  ArgvSequence
 Utility class that allows an argv array to be treated as a sequence. More...
 
class  ArrayView
 
class  BasicSlot
 
class  BasicTrans
 
class  Config
 Simple config reader with environment variable substitution. More...
 
class  Exception
 
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
 
struct  Id16Policy
 
struct  Id32Policy
 
struct  Id64Policy
 
struct  IntPolicy
 
struct  IntWrapper
 
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 >
 
class  MultiConfig
 
class  NoOp
 
class  Options
 
class  OStaticStream
 
class  OStream
 OStream uses a dynamic storage acquired from the custom allocator. More...
 
struct  overloaded
 
class  Presence
 
class  RefCount
 Base class for atomic referenced counted objects. More...
 
class  RingBuffer
 
class  StaticStreamBuf
 
class  StreamBuf
 StreamBuf uses a dynamic storage acquired from the custom allocator. More...
 
class  StreamInserter
 
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  ThreadSafePolicy
 
struct  ThreadUnsafePolicy
 
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 >
 
class  Value
 
class  VarAccum
 
class  VarSub
 Variable substitution. More...
 
struct  Version
 

Concepts

concept  Arithmetic
 
concept  Enum
 
concept  IsIntWrapper
 

Typedefs

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  Test : int { Foo = 1 , Bar = 2 , Baz = 4 , Qux = 8 }
 

Functions

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 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<>{}
 

Typedef Documentation

◆ ErrMsg

Definition at line 28 of file Exception.hpp.

◆ Int16Policy

Definition at line 33 of file IntTypes.hpp.

◆ Int32Policy

Definition at line 34 of file IntTypes.hpp.

◆ Int64Policy

Definition at line 35 of file IntTypes.hpp.

◆ Id16

16 bit identifier.

Definition at line 281 of file IntTypes.hpp.

◆ Id32

32 bit identifier.

Definition at line 289 of file IntTypes.hpp.

◆ Id64

64 bit identifier.

Definition at line 297 of file IntTypes.hpp.

◆ RobinHash

template<typename KeyT >
using toolbox::util::RobinHash = typedef robin_hood::hash<KeyT>

Robin Hood hash function template.

Definition at line 30 of file RobinHood.hpp.

◆ RobinMap

template<typename KeyT , typename ValueT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using toolbox::util::RobinMap = typedef robin_hood::unordered_map<KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N>

Robin Hood unordered map.

Robin Hood unordered map is a replacement for std::unordered_map which is both faster and more memory efficient for real-world use cases.

Definition at line 38 of file RobinHood.hpp.

◆ RobinFlatMap

template<typename KeyT , typename ValueT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using toolbox::util::RobinFlatMap = typedef robin_hood::unordered_flat_map<KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N>

Robin Hood unordered flat map.

Definition at line 43 of file RobinHood.hpp.

◆ RobinNodeMap

template<typename KeyT , typename ValueT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using toolbox::util::RobinNodeMap = typedef robin_hood::unordered_node_map<KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N>

Robin Hood unordered node map.

Definition at line 49 of file RobinHood.hpp.

◆ RobinSet

template<typename KeyT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using toolbox::util::RobinSet = typedef robin_hood::unordered_set<KeyT, HashT, KeyEqualT, MaxLoadFactor100N>

Robin Hood unordered set.

Robin Hood unordered set is a replacement for std::unordered_set which is both faster and more memory efficient for real-world use cases.

Definition at line 58 of file RobinHood.hpp.

◆ RobinFlatSet

template<typename KeyT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using toolbox::util::RobinFlatSet = typedef robin_hood::unordered_flat_set<KeyT, HashT, KeyEqualT, MaxLoadFactor100N>

Robin Hood unordered flat set.

Definition at line 63 of file RobinHood.hpp.

◆ RobinNodeSet

template<typename KeyT , typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
using toolbox::util::RobinNodeSet = typedef robin_hood::unordered_node_set<KeyT, HashT, KeyEqualT, MaxLoadFactor100N>

Robin Hood unordered node set.

Definition at line 68 of file RobinHood.hpp.

◆ StoragePtr

template<std::size_t SizeN>
using toolbox::util::StoragePtr = typedef std::unique_ptr<void, detail::StorageDeleter<SizeN> >

Definition at line 34 of file Storage.hpp.

◆ OStreamJoiner

using toolbox::util::OStreamJoiner = typedef std::experimental::ostream_joiner<char>

Definition at line 217 of file Stream.hpp.

◆ sv

using toolbox::util::sv = typedef std::string_view

Definition at line 26 of file Tokeniser.hpp.

◆ Row

template<std::size_t N>
using toolbox::util::Row = typedef std::array<std::string_view, N>

Definition at line 97 of file Tokeniser.hpp.

Enumeration Type Documentation

◆ Test

Enumerator
Foo 
Bar 
Baz 
Qux 

Definition at line 30 of file Enum.ut.cpp.

Function Documentation

◆ array_size()

template<typename ValueT , std::size_t SizeN>
constexpr std::size_t toolbox::util::array_size ( const   ValueT(&)[SizeN])
constexprnoexcept

Definition at line 26 of file Array.hpp.

◆ make_array_view() [1/2]

template<typename ValueT >
constexpr ArrayView< std::remove_volatile_t< ValueT > > toolbox::util::make_array_view ( const ValueT ptr,
std::size_t  len 
)
constexprnoexcept

Definition at line 122 of file Array.hpp.

◆ make_array_view() [2/2]

template<typename ValueT , std::size_t SizeN>
constexpr ArrayView< std::remove_cv_t< ValueT > > toolbox::util::make_array_view ( ValueT(&)  arr[SizeN])
constexprnoexcept

Definition at line 129 of file Array.hpp.

◆ parse_section()

template<typename FnT >
std::istream & toolbox::util::parse_section ( std::istream &  is,
FnT  fn,
std::string *  name = nullptr 
)

Definition at line 33 of file Config.hpp.

◆ box()

template<typename EnumT >
requires Enum<EnumT>
constexpr EnumT toolbox::util::box ( typename std::underlying_type_t< EnumT val)
constexprnoexcept

Definition at line 27 of file Enum.hpp.

◆ unbox()

template<typename EnumT >
requires Enum<EnumT>
constexpr std::underlying_type_t< EnumT > toolbox::util::unbox ( EnumT  val)
constexprnoexcept

Definition at line 34 of file Enum.hpp.

◆ operator""_test()

constexpr Test toolbox::util::operator""_test ( unsigned long long  val)
constexprnoexcept

Definition at line 32 of file Enum.ut.cpp.

◆ enum_string()

const char * toolbox::util::enum_string ( Test  t)

Definition at line 37 of file Enum.ut.cpp.

◆ operator<<() [1/5]

ostream & toolbox::util::operator<< ( ostream &  os,
Test  t 
)
inline

Definition at line 52 of file Enum.ut.cpp.

◆ err_msg()

TOOLBOX_API ErrMsg & toolbox::util::err_msg ( )
noexcept

Thread-local error message. This thread-local instance of OStaticStream can be used to format error messages before throwing. Note that the OStaticStream is reset each time this function is called.

Definition at line 57 of file Exception.cpp.

◆ put_as_json()

template<typename ExceptionT >
auto toolbox::util::put_as_json ( const ExceptionT e)

Definition at line 100 of file Exception.hpp.

◆ put_with_code()

template<typename ExceptionT >
auto toolbox::util::put_with_code ( const ExceptionT e)

Definition at line 106 of file Exception.hpp.

◆ make_finally()

template<typename FnT >
auto toolbox::util::make_finally ( FnT  fn)
noexcept

Definition at line 48 of file Finally.hpp.

◆ hash_value() [1/2]

template<typename PolicyT >
std::size_t toolbox::util::hash_value ( IntWrapper< PolicyT wrapper)

Definition at line 260 of file IntTypes.hpp.

◆ operator""_id16()

constexpr Id16 toolbox::util::operator""_id16 ( unsigned long long  val)
constexprnoexcept

Definition at line 283 of file IntTypes.hpp.

◆ operator""_id32()

constexpr Id32 toolbox::util::operator""_id32 ( unsigned long long  val)
constexprnoexcept

Definition at line 291 of file IntTypes.hpp.

◆ operator""_id64()

constexpr Id64 toolbox::util::operator""_id64 ( unsigned long long  val)
constexprnoexcept

Definition at line 299 of file IntTypes.hpp.

◆ is_pow2()

constexpr bool toolbox::util::is_pow2 ( std::size_t  n)
constexprnoexcept
Returns
true if size is a power of two.

Definition at line 29 of file Math.hpp.

◆ next_pow2() [1/2]

unsigned toolbox::util::next_pow2 ( unsigned  n)
inlinenoexcept
Returns
the next power of two.

Definition at line 35 of file Math.hpp.

◆ next_pow2() [2/2]

unsigned long toolbox::util::next_pow2 ( unsigned long  n)
inlinenoexcept
Returns
the next power of two.

Definition at line 41 of file Math.hpp.

◆ ceil_pow2()

template<int BitsN>
constexpr std::size_t toolbox::util::ceil_pow2 ( std::size_t  size)
constexprnoexcept

Definition at line 47 of file Math.hpp.

◆ var()

double toolbox::util::var ( const VarAccum v)
inlinenoexcept

Definition at line 106 of file Math.hpp.

Referenced by toolbox::util::Value::Value(), and toolbox::util::Value::Value().

◆ varp()

double toolbox::util::varp ( const VarAccum v)
inlinenoexcept

Definition at line 111 of file Math.hpp.

◆ stdev()

double toolbox::util::stdev ( const VarAccum v)
inlinenoexcept

Definition at line 116 of file Math.hpp.

◆ stdevp()

double toolbox::util::stdevp ( const VarAccum v)
inlinenoexcept

Definition at line 121 of file Math.hpp.

◆ zscore()

double toolbox::util::zscore ( double  mean,
double  sd,
double  val 
)
inlinenoexcept

Definition at line 126 of file Math.hpp.

◆ pctile95()

double toolbox::util::pctile95 ( double  mean,
double  sd 
)
inlinenoexcept

Definition at line 131 of file Math.hpp.

◆ pctile99()

double toolbox::util::pctile99 ( double  mean,
double  sd 
)
inlinenoexcept

Definition at line 137 of file Math.hpp.

◆ pctile999()

double toolbox::util::pctile999 ( double  mean,
double  sd 
)
inlinenoexcept

Definition at line 143 of file Math.hpp.

◆ ceil()

constexpr std::size_t toolbox::util::ceil ( std::size_t  dividend,
std::size_t  divisor 
)
constexprnoexcept
Returns
the ceiling of dividend / divisor.

Definition at line 150 of file Math.hpp.

◆ operator<<() [2/5]

TOOLBOX_API std::ostream & toolbox::util::operator<< ( ostream &  out,
const Options options 
)

Definition at line 112 of file Options.cpp.

◆ intrusive_ptr_add_ref()

void toolbox::util::intrusive_ptr_add_ref ( const RefCount< DerivedT, PolicyT > *  ptr)
noexcept

Definition at line 89 of file RefCount.hpp.

◆ intrusive_ptr_release()

void toolbox::util::intrusive_ptr_release ( const RefCount< DerivedT, PolicyT > *  ptr)
noexcept

Definition at line 95 of file RefCount.hpp.

◆ make_intrusive()

template<typename ValueT , typename... ArgsT>
boost::intrusive_ptr< ValueT > toolbox::util::make_intrusive ( ArgsT &&...  args)

Definition at line 101 of file RefCount.hpp.

◆ bind() [1/3]

template<auto FnT>
constexpr auto toolbox::util::bind ( )
constexprnoexcept

Definition at line 92 of file Slot.hpp.

Referenced by toolbox::util::Alarm::Alarm(), toolbox::util::StringBuf< MaxN >::append(), toolbox::util::ArrayView< ValueT >::ArrayView(), toolbox::util::ArrayView< ValueT >::ArrayView(), toolbox::util::ArrayView< ValueT >::ArrayView(), toolbox::util::StringBuf< MaxN >::assign(), toolbox::util::TaskQueue< TaskT >::clear(), toolbox::util::TransTraits< TargetT >::commit(), toolbox::util::StreamBuf< MaxN >::data(), toolbox::util::StaticStreamBuf< MaxN >::data(), toolbox::util::StreamBuf< MaxN >::empty(), toolbox::util::StaticStreamBuf< MaxN >::empty(), toolbox::util::RingBuffer< ValueT >::fetch(), toolbox::util::TypeTraits< DgramEndpoint >::from_string(), toolbox::util::TypeTraits< StreamEndpoint >::from_string(), toolbox::util::TypeTraits< std::string >::from_string(), toolbox::util::TypeTraits< std::chrono::duration< RepT, PeriodT > >::from_string(), toolbox::util::TypeTraits< WallTime >::from_string(), toolbox::util::TypeTraits< Version >::from_string(), toolbox::util::TypeTraits< std::chrono::duration< RepT, PeriodT > >::from_string(), toolbox::util::TypeTraits< WallTime >::from_string(), toolbox::util::TypeTraits< ValueT >::from_string(), toolbox::util::TypeTraits< ValueT >::from_string(), toolbox::util::Config::get(), toolbox::util::Config::get(), toolbox::util::OStream< MaxN >::make_storage(), toolbox::util::Tokeniser::next(), toolbox::util::detail::StorageDeleter< SizeN >::operator()(), toolbox::util::StringBuf< MaxN >::operator+=(), toolbox::util::StringBuf< MaxN >::operator+=(), toolbox::util::StringBuf< MaxN >::operator<=>(), toolbox::util::Alarm::operator=(), toolbox::util::StringBuf< MaxN >::operator=(), toolbox::util::StringBuf< MaxN >::operator=(), toolbox::util::StringBuf< MaxN >::operator=(), toolbox::util::StringBuf< MaxN >::operator==(), toolbox::util::ArrayView< ValueT >::operator[](), toolbox::util::OStaticStream< MaxN >::OStaticStream(), toolbox::util::OStream< MaxN >::OStream(), toolbox::util::Options::parse(), toolbox::util::ArgvLexer::pop_value(), toolbox::util::RingBuffer< ValueT >::push(), toolbox::util::TaskQueue< TaskT >::push(), toolbox::util::MultiConfig::read(), toolbox::util::RefCount< DerivedT, PolicyT >::release(), toolbox::util::StreamBuf< MaxN >::release_storage(), toolbox::util::Presence< DerivedT >::required(), toolbox::util::StreamBuf< MaxN >::reset(), toolbox::util::StaticStreamBuf< MaxN >::reset(), toolbox::util::Tokeniser::reset(), toolbox::util::TransTraits< TargetT >::rollback(), toolbox::util::TaskQueue< TaskT >::run(), toolbox::util::StreamBuf< MaxN >::set_storage(), toolbox::util::OStream< MaxN >::set_storage(), toolbox::util::StreamBuf< MaxN >::size(), toolbox::util::StaticStreamBuf< MaxN >::size(), toolbox::util::TransTraits< TargetT >::start(), toolbox::util::TaskQueue< TaskT >::stop(), toolbox::util::StreamBuf< MaxN >::StreamBuf(), toolbox::util::StringBuf< MaxN >::StringBuf(), toolbox::util::StringBuf< MaxN >::StringBuf(), toolbox::util::StringBuf< MaxN >::StringBuf(), toolbox::util::ArrayView< ValueT >::swap(), toolbox::util::Version::swap(), toolbox::util::Exception::to_json(), toolbox::util::Tokeniser::Tokeniser(), toolbox::util::Value::Value(), toolbox::util::Value::Value(), and toolbox::util::RingBuffer< ValueT >::write().

◆ bind() [2/3]

template<typename ClassT >
constexpr auto toolbox::util::bind ( ClassT *  obj)
constexprnoexcept

Definition at line 100 of file Slot.hpp.

◆ bind() [3/3]

template<auto MemFnT, typename ClassT = typename FunctionTraits<decltype(MemFnT)>::ClassType>
constexpr auto toolbox::util::bind ( ClassT *  obj)
constexprnoexcept

Definition at line 108 of file Slot.hpp.

◆ make_storage()

template<std::size_t SizeN>
StoragePtr< SizeN > toolbox::util::make_storage ( )

Returns a block of dynamic storage acquired from the custom allocator.

Definition at line 38 of file Storage.hpp.

◆ reset()

TOOLBOX_API void toolbox::util::reset ( std::ostream &  os)
noexcept

◆ operator<<() [3/5]

template<std::size_t MaxN, typename ValueT >
auto & toolbox::util::operator<< ( OStaticStream< MaxN > &  os,
ValueT &&  val 
)

Definition at line 211 of file Stream.hpp.

◆ join()

template<auto DelimT, typename ArgT , typename... ArgsT>
void toolbox::util::join ( std::ostream &  os,
const ArgT arg,
const ArgsT &...  args 
)

Definition at line 220 of file Stream.hpp.

◆ make_stream_inserter()

template<typename OStreamT , typename FnT >
auto toolbox::util::make_stream_inserter ( FnT  fn)

Returns a StreamInserter object, automatically deducing functor type from arguments.

Definition at line 59 of file StreamInserter.hpp.

◆ ltrim() [1/2]

TOOLBOX_API void toolbox::util::ltrim ( string_view &  s)
noexcept

Definition at line 27 of file String.cpp.

◆ ltrim() [2/2]

TOOLBOX_API void toolbox::util::ltrim ( string &  s)
noexcept

Definition at line 33 of file String.cpp.

◆ rtrim() [1/2]

TOOLBOX_API void toolbox::util::rtrim ( string_view &  s)
noexcept

Definition at line 39 of file String.cpp.

◆ rtrim() [2/2]

TOOLBOX_API void toolbox::util::rtrim ( string &  s)
noexcept

Definition at line 45 of file String.cpp.

◆ split_pair() [1/2]

TOOLBOX_API std::pair< std::string_view, std::string_view > toolbox::util::split_pair ( string_view  s,
char  delim 
)
noexcept

Definition at line 51 of file String.cpp.

Referenced by toolbox::util::TypeTraits< Version >::from_string().

◆ split_pair() [2/2]

TOOLBOX_API std::pair< std::string, std::string > toolbox::util::split_pair ( const string &  s,
char  delim 
)

Definition at line 64 of file String.cpp.

◆ from_string() [1/3]

template<typename ValueT >
constexpr ValueT toolbox::util::from_string ( std::string_view  sv)
constexpr

Definition at line 31 of file String.hpp.

◆ from_string() [2/3]

template<typename ValueT >
constexpr ValueT toolbox::util::from_string ( const std::string &  s)
constexpr

Definition at line 39 of file String.hpp.

◆ from_string() [3/3]

template<typename ValueT >
constexpr ValueT toolbox::util::from_string ( const char s)
constexpr

Definition at line 46 of file String.hpp.

◆ to_string() [1/2]

template<typename ValueT >
std::string toolbox::util::to_string ( ValueT &&  val)

Definition at line 54 of file String.hpp.

◆ to_string() [2/2]

template<typename ValueT >
requires Arithmetic<ValueT>
std::string toolbox::util::to_string ( ValueT &&  val)

Definition at line 64 of file String.hpp.

◆ to_string_view()

template<std::size_t SizeN>
constexpr std::string_view toolbox::util::to_string_view ( const char(&)  val[SizeN])
constexprnoexcept

Definition at line 71 of file String.hpp.

◆ trim() [1/2]

void toolbox::util::trim ( std::string_view &  s)
inlinenoexcept

Definition at line 84 of file String.hpp.

◆ trim() [2/2]

void toolbox::util::trim ( std::string &  s)
inlinenoexcept

Definition at line 90 of file String.hpp.

◆ ltrim_copy() [1/2]

std::string_view toolbox::util::ltrim_copy ( std::string_view  s)
inlinenoexcept

Definition at line 96 of file String.hpp.

◆ ltrim_copy() [2/2]

std::string toolbox::util::ltrim_copy ( std::string  s)
inlinenoexcept

Definition at line 102 of file String.hpp.

◆ rtrim_copy() [1/2]

std::string_view toolbox::util::rtrim_copy ( std::string_view  s)
inlinenoexcept

Definition at line 108 of file String.hpp.

◆ rtrim_copy() [2/2]

std::string toolbox::util::rtrim_copy ( std::string  s)
inlinenoexcept

Definition at line 114 of file String.hpp.

◆ trim_copy() [1/2]

std::string_view toolbox::util::trim_copy ( std::string_view  s)
inlinenoexcept

Definition at line 120 of file String.hpp.

◆ trim_copy() [2/2]

std::string toolbox::util::trim_copy ( std::string  s)
inlinenoexcept

Definition at line 126 of file String.hpp.

◆ pstrlen() [1/2]

template<char PadC>
constexpr std::size_t toolbox::util::pstrlen ( const char src,
std::size_t  n 
)
constexprnoexcept

Returns the length of right-padded string.

Template Parameters
PadCThe character used for padding.
Parameters
srcThe source string.
nThe maximum size of the source string.
Returns
the length of src if less than n, otherwise n.

Definition at line 143 of file String.hpp.

◆ pstrlen() [2/2]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::pstrlen ( const char(&)  src[SizeN])
constexprnoexcept

Returns the length of right-padded string.

Template Parameters
PadCThe character used for padding.
SizeNThe maximum size of the source string.
Parameters
srcThe source string.
Returns
the length of src.

Definition at line 163 of file String.hpp.

◆ pstrcpy() [1/4]

template<char PadC>
constexpr std::size_t toolbox::util::pstrcpy ( char dst,
const char src,
std::size_t  n 
)
constexprnoexcept

Copy src string to right-padded buffer dst.

Template Parameters
PadCThe character used for padding.
Parameters
dstThe destination buffer.
srcThe source string.
nThe maximum size of the destination buffer.
Returns
the number of bytes copied to the destination buffer.

Definition at line 175 of file String.hpp.

◆ pstrcpy() [2/4]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::pstrcpy ( char(&)  dst[SizeN],
const char src 
)
constexprnoexcept

Copy src string to right-padded buffer dst.

Template Parameters
PadCThe character used for padding.
SizeNThe maximum size of the destination buffer.
Parameters
dstThe destination buffer.
srcThe source string.
Returns
the number of bytes copied to the destination buffer.

Definition at line 206 of file String.hpp.

◆ pstrcpy() [3/4]

template<char PadC>
constexpr std::size_t toolbox::util::pstrcpy ( char dst,
std::string_view  src,
std::size_t  n 
)
constexprnoexcept

Copy src string to right-padded buffer dst.

Template Parameters
PadCThe character used for padding.
Parameters
dstThe destination buffer.
srcThe source string.
nThe maximum size of the destination buffer.
Returns
the number of bytes copied to the destination buffer.

Definition at line 218 of file String.hpp.

◆ pstrcpy() [4/4]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::pstrcpy ( char(&)  dst[SizeN],
std::string_view  src 
)
constexprnoexcept

Copy src string to right-padded buffer dst.

Template Parameters
PadCThe character used for padding.
SizeNThe maximum size of the destination buffer.
Parameters
dstThe destination buffer.
srcThe source string.
Returns
the number of bytes copied to the destination buffer.

Definition at line 237 of file String.hpp.

◆ pstrcpyid() [1/2]

template<char PadC>
constexpr std::size_t toolbox::util::pstrcpyid ( char dst,
std::int64_t  id,
std::size_t  n 
)
constexprnoexcept

Definition at line 243 of file String.hpp.

◆ pstrcpyid() [2/2]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::pstrcpyid ( char(&)  dst[SizeN],
std::int64_t  id 
)
constexprnoexcept

Definition at line 257 of file String.hpp.

◆ lpstrlen() [1/2]

template<char PadC>
constexpr std::size_t toolbox::util::lpstrlen ( const char src,
std::size_t  n 
)
constexprnoexcept

Returns the length of left-padded string.

Template Parameters
PadCThe character used for padding.
Parameters
srcThe source string.
nThe maximum size of the source string.
Returns
the length of src if less than n, otherwise n.

Definition at line 268 of file String.hpp.

◆ lpstrlen() [2/2]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::lpstrlen ( const char(&)  src[SizeN])
constexprnoexcept

Returns the length of left-padded string.

Template Parameters
PadCThe character used for padding.
SizeNThe maximum size of the source string.
Parameters
srcThe source string.
Returns
the length of src.

Definition at line 283 of file String.hpp.

◆ lpstrcpy() [1/4]

template<char PadC>
constexpr std::size_t toolbox::util::lpstrcpy ( char dst,
const char src,
std::size_t  n 
)
constexprnoexcept

Copy src string to left-padded buffer dst.

Template Parameters
PadCThe character used for padding.
Parameters
dstThe destination buffer.
srcThe source string.
nThe maximum size of the destination buffer.
Returns
the number of bytes copied to the destination buffer.

Definition at line 295 of file String.hpp.

◆ lpstrcpy() [2/4]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::lpstrcpy ( char(&)  dst[SizeN],
const char src 
)
constexprnoexcept

Copy src string to left-padded buffer dst.

Template Parameters
PadCThe character used for padding.
SizeNThe maximum size of the destination buffer.
Parameters
dstThe destination buffer.
srcThe source string.
Returns
the number of bytes copied to the destination buffer.

Definition at line 314 of file String.hpp.

◆ lpstrcpy() [3/4]

template<char PadC>
constexpr std::size_t toolbox::util::lpstrcpy ( char dst,
std::string_view  src,
std::size_t  n 
)
constexprnoexcept

Copy src string to left-padded buffer dst.

Template Parameters
PadCThe character used for padding.
Parameters
dstThe destination buffer.
srcThe source string.
nThe maximum size of the destination buffer.
Returns
the number of bytes copied to the destination buffer.

Definition at line 326 of file String.hpp.

◆ lpstrcpy() [4/4]

template<char PadC, std::size_t SizeN>
constexpr std::size_t toolbox::util::lpstrcpy ( char(&)  dst[SizeN],
std::string_view  src 
)
constexprnoexcept

Copy src string to left-padded buffer dst.

Template Parameters
PadCThe character used for padding.
SizeNThe maximum size of the destination buffer.
Parameters
dstThe destination buffer.
srcThe source string.
Returns
the number of bytes copied to the destination buffer.

Definition at line 345 of file String.hpp.

◆ make_string()

template<typename... ArgsT>
std::string toolbox::util::make_string ( ArgsT &&...  args)

Definition at line 351 of file String.hpp.

◆ operator+()

template<std::size_t MaxN>
constexpr std::string_view toolbox::util::operator+ ( const StringBuf< MaxN > &  s)
constexprnoexcept

Definition at line 130 of file StringBuf.hpp.

◆ operator<<() [4/5]

template<std::size_t MaxN>
std::ostream & toolbox::util::operator<< ( std::ostream &  os,
const StringBuf< MaxN > &  rhs 
)

Definition at line 136 of file StringBuf.hpp.

◆ empty()

template<typename... TagsT, typename... ValuesT>
constexpr bool toolbox::util::empty ( const detail::Struct< detail::Member< TagsT, ValuesT >... > &  s)
constexpr

Definition at line 92 of file Struct.hpp.

◆ size()

template<typename... TagsT, typename... ValuesT>
constexpr std::size_t toolbox::util::size ( const detail::Struct< detail::Member< TagsT, ValuesT >... > &  s)
constexpr

◆ has()

template<typename TagT , typename... TagsT, typename... ValuesT>
constexpr bool toolbox::util::has ( const detail::Struct< detail::Member< TagsT, ValuesT >... > &  s,
TagT  tag = {} 
)
constexpr

Definition at line 104 of file Struct.hpp.

◆ get() [1/2]

template<typename TagT , typename... TagsT, typename... ValuesT>
constexpr const auto & toolbox::util::get ( const detail::Struct< detail::Member< TagsT, ValuesT >... > &  s,
TagT  tag = {} 
)
constexpr

Definition at line 110 of file Struct.hpp.

◆ get() [2/2]

template<typename TagT , typename... TagsT, typename... ValuesT>
constexpr auto & toolbox::util::get ( detail::Struct< detail::Member< TagsT, ValuesT >... > &  s,
TagT  tag = {} 
)
constexpr

Definition at line 116 of file Struct.hpp.

◆ parse_line()

template<typename FnT >
constexpr std::size_t toolbox::util::parse_line ( std::string_view  buf,
FnT  fn 
)
constexpr

Definition at line 86 of file Tokeniser.hpp.

◆ split()

template<std::size_t N>
constexpr void toolbox::util::split ( std::string_view  line,
std::string_view  delims,
Row< N > &  row 
)
constexprnoexcept

Definition at line 100 of file Tokeniser.hpp.

◆ stob()

TOOLBOX_API bool toolbox::util::stob ( string_view  sv,
bool  dfl 
)
noexcept

Definition at line 26 of file Utility.cpp.

Referenced by toolbox::util::TypeTraits< bool >::from_string().

◆ stod()

TOOLBOX_API double toolbox::util::stod ( std::string_view  sv,
double  dfl 
)
noexcept

Definition at line 89 of file Utility.cpp.

Referenced by toolbox::util::TypeTraits< double >::from_string().

◆ remove_const()

template<typename ValueT >
auto & toolbox::util::remove_const ( const ValueT ref)
inline

Definition at line 33 of file Utility.hpp.

◆ isdigit()

constexpr bool toolbox::util::isdigit ( int  c)
constexprnoexcept

Definition at line 38 of file Utility.hpp.

◆ dec_digits()

constexpr int toolbox::util::dec_digits ( std::int64_t  i)
constexprnoexcept

Returns the number of decimal digits in a positive, signed integer.

Parameters
iInteger value.
Returns
the number of decimal digits.
Todo:
consider adding support for negative integers.

Definition at line 49 of file Utility.hpp.

Referenced by toolbox::util::Version::size().

◆ hex_digits()

template<typename UIntegerT >
requires std::unsigned_integral<UIntegerT>
constexpr int toolbox::util::hex_digits ( UIntegerT  i)
constexprnoexcept

Returns the number of hexadecimal digits in a positive integer.

Template Parameters
UIntegerTInteger type.
Parameters
iInteger value.
Returns
the number of hexadecimal digits.
Todo:
consider adding support for negative integers.

Definition at line 76 of file Utility.hpp.

◆ ston()

template<typename ValueT >
requires std::integral<ValueT> || std::same_as<ValueT, double>
constexpr ValueT toolbox::util::ston ( std::string_view  sv)
constexprnoexcept

Definition at line 91 of file Utility.hpp.

◆ overloaded()

template<class... Ts>
toolbox::util::overloaded ( Ts...  ) -> overloaded< Ts... >

◆ get_env()

TOOLBOX_API std::string toolbox::util::get_env ( const string &  name)

Definition at line 25 of file VarSub.cpp.

◆ operator<<() [5/5]

TOOLBOX_API std::ostream & toolbox::util::operator<< ( ostream &  os,
Version  ver 
)

Definition at line 25 of file Version.cpp.

◆ hash_value() [2/2]

std::size_t toolbox::util::hash_value ( toolbox::Version  ver)
inline

Definition at line 83 of file Version.hpp.

Variable Documentation

◆ MaxErrSize

constexpr std::size_t toolbox::util::MaxErrSize {511}
constexpr

Maximum error message length.

Definition at line 26 of file Exception.hpp.

◆ reset_state

constexpr detail::ResetState toolbox::util::reset_state {}
constexpr

I/O manipulator that resets I/O state.

Definition at line 34 of file Stream.hpp.

◆ Struct

constexpr auto toolbox::util::Struct = detail::Struct<>{}
constexpr

Definition at line 89 of file Struct.hpp.