22#include <boost/asio.hpp>
23#include <boost/thread.hpp>
24#include <boost/thread/null_mutex.hpp>
46template<
typename Key,
typename Mapped,
typename Hash = boost::hash<Key>,
typename Pred = std::equal_to<Key>>
48template<
typename Key,
typename Hash = boost::hash<Key>,
typename Pred = std::equal_to<Key>>
53class Rnd_gen_uniform_range_base;
54template<
typename range_t>
55class Rnd_gen_uniform_range;
56template<
typename range_t>
57class Rnd_gen_uniform_range_mt;
59template<
typename Value>
62template<
typename Target_ptr,
63 typename Const_target_ptr
64 =
typename std::pointer_traits<Target_ptr>::template rebind<typename Target_ptr::element_type const>>
65class Shared_ptr_alias_holder;
69class Unique_id_holder;
87namespace this_thread = boost::this_thread;
202using Timer = boost::asio::basic_waitable_timer<Fine_clock>;
264template<
typename Mutex>
274template<
typename Shared_mutex>
340template<
typename Key,
typename Mapped,
typename Hash,
typename Pred>
352template<
typename Key,
typename Hash,
typename Pred>
481template<
typename Const_buffer_sequence>
482std::ostream&
buffers_to_ostream(std::ostream& os,
const Const_buffer_sequence& data,
const std::string& indentation,
483 size_t bytes_per_line = 0);
500template<
typename Const_buffer_sequence>
501std::string
buffers_dump_string(
const Const_buffer_sequence& data,
const std::string& indentation,
502 size_t bytes_per_line = 0);
553template<
typename Time_unit,
typename N_items>
554double to_mbit_per_sec(N_items items_per_time,
size_t bits_per_item = 8);
568template<
typename Integer>
569Integer
ceil_div(Integer dividend, Integer divisor);
593template<
typename Cleanup_func>
611bool in_closed_range(T
const & min_val, T
const & val, T
const & max_val);
680template<
typename Container>
681bool key_exists(
const Container& container,
const typename Container::key_type& key);
709template<
typename Minuend,
typename Subtrahend>
710bool subtract_with_floor(Minuend* minuend,
const Subtrahend& subtrahend,
const Minuend& floor = 0);
732template<
typename From,
typename To>
754template<
typename Map,
typename Sequence>
776template<
typename Map,
typename Sequence>
778 (Sequence
const & src_seq, Map* target_map,
779 const Function<
typename Map::mapped_type (
size_t)>& idx_to_map_val_func);
806template<
typename ...T>
823template<
typename ...T>
841template<
typename T1,
typename ...T_rest>
842void feed_args_to_ostream(std::ostream* os, T1
const & ostream_arg1, T_rest
const &... remaining_ostream_args);
907template<
typename Enum>
908Enum
istream_to_enum(std::istream* is_ptr, Enum enum_default, Enum enum_sentinel,
909 bool accept_num_encoding =
true,
bool case_sensitive =
false,
910 Enum enum_lowest = Enum(0));
951#define FLOW_UTIL_WHERE_AM_I() \
952 FLOW_UTIL_WHERE_AM_I_FROM_ARGS(::flow::util::get_last_path_segment \
953 (::flow::util::String_view(__FILE__, sizeof(__FILE__) - 1)), \
954 ::flow::util::String_view(__FUNCTION__, sizeof(__FUNCTION__) - 1), \
971#define FLOW_UTIL_WHERE_AM_I_STR() \
972 ::flow::util::get_where_am_i_str(::flow::util::get_last_path_segment \
973 (::flow::util::String_view(__FILE__, sizeof(__FILE__) - 1)), \
974 ::flow::util::String_view(__FUNCTION__, sizeof(__FUNCTION__) - 1), \
1079#define FLOW_UTIL_SEMICOLON_SAFE(ARG_func_macro_definition) \
1082 ARG_func_macro_definition \
An object of this class is a map that combines the lookup speed of a boost::unordered_map<> and order...
An object of this class is a set that combines the lookup speed of an unordered_set<> and ordering an...
Flow module containing miscellaneous general-use facilities that don't fit into any other Flow module...
boost::unique_lock< Mutex_recursive > Lock_guard_recursive
(Deprecated given C++1x) Short-hand for advanced-capability RAII lock guard for Mutex_recursive mutex...
bool in_closed_open_range(T const &min_val, T const &val, T const &max_val)
Returns true if and only if the given value is within the given range, given as a [low,...
bool key_exists(const Container &container, const typename Container::key_type &key)
Returns true if and only if the given key is present at least once in the given associative container...
void beautify_chrono_ostream(std::ostream *os_ptr)
Sets certain chrono-related formatting on the given ostream that results in a consistent,...
Auto_cleanup setup_auto_cleanup(const Cleanup_func &func)
Provides a way to execute arbitrary (cleanup) code at the exit of the current block.
Thread::id Thread_id
Short-hand for an OS-provided ID of a util::Thread.
void sequence_to_inverted_lookup_map(Sequence const &src_seq, Map *target_map, const Function< typename Map::mapped_type(size_t)> &idx_to_map_val_func)
Similar to the 2-arg overload of sequence_to_inverted_lookup_map() but with the ability to store a va...
double to_mbit_per_sec(N_items items_per_time, size_t bits_per_item)
Utility that converts a bandwidth in arbitrary units in both numerator and denominator to the same ba...
std::string buffers_dump_string(const Const_buffer_sequence &data, const std::string &indentation, size_t bytes_per_line)
Identical to buffers_to_ostream() but returns an std::string instead of writing to a given ostream.
Enum istream_to_enum(std::istream *is_ptr, Enum enum_default, Enum enum_sentinel, bool accept_num_encoding, bool case_sensitive, Enum enum_lowest)
Deserializes an enum class value from a standard input stream.
boost::asio::ip::address_v6 Ip_address_v6
Short-hand for the IPv6 address type.
boost::asio::ip::address_v4 Ip_address_v4
Short-hand for the IPv4 address type.
bool subtract_with_floor(Minuend *minuend, const Subtrahend &subtrahend, const Minuend &floor)
Performs *minuend -= subtrahend, subject to a floor of floor.
size_t deep_size(const std::string &val)
Estimate of memory footprint of the given value, including memory allocated on its behalf – but exclu...
boost::unique_lock< Mutex > Lock_guard
Short-hand for advanced-capability RAII lock guard for any mutex, ensuring exclusive ownership of tha...
boost::shared_mutex Mutex_shared_non_recursive
Short-hand for non-reentrant, shared-or-exclusive mutex.
size_t size_unit_convert(From num_froms)
Answers the question what's the smallest integer number of Tos sufficient to verbatim store the given...
std::string ostream_op_string(T const &... ostream_args)
Equivalent to ostream_op_to_string() but returns a new string by value instead of writing to the call...
boost::shared_lock< Mutex_shared_non_recursive > Lock_guard_shared_non_recursive_sh
(Deprecated given C++1x) Short-hand for shared mode advanced-capability RAII lock guard for Mutex_sha...
Integer ceil_div(Integer dividend, Integer divisor)
Returns the result of the given non-negative integer divided by a positive integer,...
void swap(Basic_blob< Allocator, S_SHARING_ALLOWED > &blob1, Basic_blob< Allocator, S_SHARING_ALLOWED > &blob2, log::Logger *logger_ptr)
Equivalent to blob1.swap(blob2).
bool in_open_open_range(T const &min_val, T const &val, T const &max_val)
Returns true if and only if the given value is within the given range, given as a (low,...
bool in_open_closed_range(T const &min_val, T const &val, T const &max_val)
Returns true if and only if the given value is within the given range, given as a (low,...
void ostream_op_to_string(std::string *target_str, T const &... ostream_args)
Writes to the specified string, as if the given arguments were each passed, via << in sequence,...
boost::unique_lock< Mutex_non_recursive > Lock_guard_non_recursive
(Deprecated given C++1x) Short-hand for advanced-capability RAII lock guard for Mutex_non_recursive m...
boost::recursive_mutex Mutex_recursive
Short-hand for reentrant, exclusive mutex.
boost::unique_lock< Mutex_shared_non_recursive > Lock_guard_shared_non_recursive_ex
(Deprecated given C++1x) Short-hand for exclusive mode advanced-capability RAII lock guard for Mutex_...
boost::shared_lock< Mutex_noop_shared_non_recursive > Lock_guard_noop_shared_non_recursive_sh
(Deprecated given C++1x) Equivalent to Lock_guard_shared_non_recursive_sh but applied to Mutex_noop_s...
std::ostream & buffers_to_ostream(std::ostream &os, const Const_buffer_sequence &data, const std::string &indentation, size_t bytes_per_line)
Writes a multi- or single-line string representation of the provided binary data to an output stream,...
Task_engine::strand Strand
Short-hand for boost.asio strand, an ancillary class that works with Task_engine for advanced task sc...
bool in_closed_range(T const &min_val, T const &val, T const &max_val)
Returns true if and only if the given value is within the given range, inclusive.
boost::shared_ptr< void > Auto_cleanup
Helper type for setup_auto_cleanup().
boost::shared_lock< Shared_mutex > Shared_lock_guard
Short-hand for shared mode advanced-capability RAII lock guard, particuarly for Mutex_shared_non_recu...
boost::chrono::microseconds time_since_posix_epoch()
Get the current POSIX (Unix) time as a duration from the Epoch time point.
boost::unique_lock< Mutex_noop_shared_non_recursive > Lock_guard_noop_shared_non_recursive_ex
(Deprecated given C++1x) Equivalent to Lock_guard_shared_non_recursive_ex but applied to Mutex_noop_s...
boost::mutex Mutex_non_recursive
Short-hand for non-reentrant, exclusive mutex. ("Reentrant" = one can lock an already-locked-in-that-...
boost::asio::io_service Task_engine
Short-hand for boost.asio event service, the central class of boost.asio.
boost::asio::basic_waitable_timer< Fine_clock > Timer
boost.asio timer.
boost::null_mutex Mutex_noop_shared_non_recursive
Short-hand for a mutex type equivalent to util::Mutex_shared_non_recursive – except that the lock/unl...
boost::thread Thread
Short-hand for standard thread class.
boost::asio::ip::udp::endpoint Udp_endpoint
Short-hand for the UDP endpoint (IP/port) type.
void feed_args_to_ostream(std::ostream *os, T1 const &ostream_arg1, T_rest const &... remaining_ostream_args)
"Induction step" version of variadic function template that simply outputs arguments 2+ via << to the...