Bitcoin Core 29.99.0
P2P Digital Currency
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages Concepts
Classes | Namespaces | Typedefs | Functions
util.h File Reference
#include <capnp/schema.h>
#include <cstddef>
#include <functional>
#include <future>
#include <kj/common.h>
#include <kj/exception.h>
#include <kj/string-tree.h>
#include <memory>
#include <string.h>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mp::TypeList< Types >
 Generic utility functions used by capnp code. More...
 
struct  mp::Split< 0, _Second, _First, true >
 Specialization of above (base case) More...
 
struct  mp::Split< index, TypeList< Type, _Second... >, TypeList< _First... >, false >
 Specialization of above (recursive case) More...
 
struct  mp::_Require< SfinaeExpr, Result_ >
 SFINAE helper, see using Require below. More...
 
struct  mp::Priority< priority >
 Function parameter type for prioritizing overloaded function calls that would otherwise be ambiguous. More...
 
struct  mp::Priority< 0 >
 Specialization of above (base case) More...
 
struct  mp::UnlockGuard< Lock >
 Analog to std::lock_guard that unlocks instead of locks. More...
 
struct  mp::DestructorCatcher< T >
 Needed for libc++/macOS compatibility. More...
 
struct  mp::AsyncCallable< Callable >
 Wrapper around callback function for compatibility with std::async. More...
 

Namespaces

namespace  mp
 Functions to serialize / deserialize common bitcoin types.
 

Typedefs

template<typename Callable >
using mp::ResultOf = decltype(std::declval< Callable >()())
 Type helper giving return type of a callable type. More...
 
template<typename T >
using mp::RemoveCvRef = std::remove_cv_t< std::remove_reference_t< T > >
 Substitutue for std::remove_cvref_t. More...
 
template<typename T >
using mp::Decay = std::decay_t< T >
 Type helper abbreviating std::decay. More...
 
template<typename SfinaeExpr , typename Result = void>
using mp::Require = typename _Require< SfinaeExpr, Result >::Result
 SFINAE helper, basically the same as to C++17's void_t, but allowing types other than void to be returned. More...
 
using mp::FdToArgsFn = std::function< std::vector< std::string >(int fd)>
 Callback type used by SpawnProcess below. More...
 

Functions

template<template< typename... > class Class, typename... Types, typename... Args>
Class< Types..., std::remove_reference_t< Args >... > mp::Make (Args &&... args)
 Construct a template class value by deducing template arguments from the types of constructor arguments, so they don't need to be specified manually. More...
 
template<typename T >
const char * mp::TypeName ()
 Return capnp type name with filename prefix removed. More...
 
template<typename Lock , typename Callback >
void mp::Unlock (Lock &lock, Callback &&callback)
 
template<typename Callable >
AsyncCallable< std::remove_reference_t< Callable > > mp::MakeAsyncCallable (Callable &&callable)
 Construct AsyncCallable object. More...
 
std::string mp::ThreadName (const char *exe_name)
 Format current thread name as "{exe_name}-{$pid}/{thread_name}-{$tid}". More...
 
std::string mp::LogEscape (const kj::StringTree &string)
 Escape binary string for use in log so it doesn't trigger unicode decode errors in python unit tests. More...
 
int mp::SpawnProcess (int &pid, FdToArgsFn &&fd_to_args)
 Spawn a new process that communicates with the current process over a socket pair. More...
 
void mp::ExecProcess (const std::vector< std::string > &args)
 Call execvp with vector args. More...
 
int mp::WaitProcess (int pid)
 Wait for a process to exit and return its exit code. More...
 
char * mp::CharCast (char *c)
 
char * mp::CharCast (unsigned char *c)
 
const char * mp::CharCast (const char *c)
 
const char * mp::CharCast (const unsigned char *c)