util

The contents of this module can be included with the header hpx/modules/util.hpp. These headers may be used by user-code but are not guaranteed stable (neither header location nor contents). You are using these at your own risk. If you wish to use non-public functionality from a module we strongly suggest only including the module header hpx/modules/util.hpp, not the particular header in which the functionality you would like to use is defined. See Public API for a list of names that are part of the public HPX API.

namespace hpx
namespace util

Functions

std::size_t calculate_fanout(std::size_t size, std::size_t local_fanout)
namespace hpx
namespace util

Functions

std::uint64_t get_and_reset_value(std::uint64_t &value, bool reset)
std::int64_t get_and_reset_value(std::int64_t &value, bool reset)
template<typename T>
T get_and_reset_value(std::atomic<T> &value, bool reset)
std::vector<std::int64_t> get_and_reset_value(std::vector<std::int64_t> &value, bool reset)
namespace hpx
namespace util

Functions

template<typename DestType, typename Config, typename std::enable_if<!std::is_same<DestType, std::string>::value, bool>::type = false>
DestType get_entry_as(Config const &config, std::string const &key, DestType const &dflt)
namespace hpx
namespace util

Functions

template<typename Iterator>
bool insert_checked(std::pair<Iterator, bool> const &r)

Helper function for writing predicates that test whether an std::map insertion succeeded. This inline template function negates the need to explicitly write the sometimes lengthy std::pair<Iterator, bool> type.

Return

This function returns r.second.

Parameters
  • r: [in] The return value of a std::map insert operation.

template<typename Iterator>
bool insert_checked(std::pair<Iterator, bool> const &r, Iterator &it)

Helper function for writing predicates that test whether an std::map insertion succeeded. This inline template function negates the need to explicitly write the sometimes lengthy std::pair<Iterator, bool> type.

Return

This function returns r.second.

Parameters
  • r: [in] The return value of a std::map insert operation.

  • r: [out] A reference to an Iterator, which is set to r.first.

namespace hpx
namespace util
class ios_flags_saver

Public Types

typedef ::std::ios_base state_type
typedef ::std::ios_base::fmtflags aspect_type

Public Functions

ios_flags_saver(state_type &s)
ios_flags_saver(state_type &s, aspect_type const &a)
~ios_flags_saver()
ios_flags_saver(ios_flags_saver const&)
ios_flags_saver &operator=(ios_flags_saver const&)
void restore()

Private Members

state_type &s_save_
const aspect_type a_save_
namespace hpx
namespace util
struct manage_config

Public Types

typedef std::map<std::string, std::string> map_type

Public Functions

manage_config(std::vector<std::string> const &cfg)
void add(std::vector<std::string> const &cfg)
template<typename T>
T get_value(std::string const &key, T dflt = T()) const

Public Members

map_type config_
namespace hpx
namespace util

Functions

std::string regex_from_pattern(std::string const &pattern, error_code &ec = throws)
namespace hpx
namespace util

Functions

bool parse_sed_expression(std::string const &input, std::string &search, std::string &replace)

Parse a sed command.

Return

true if the parsing was successful, false otherwise.

Note

Currently, only supports search and replace syntax (s/search/replace/)

Parameters
  • input: [in] The content to parse.

  • search: [out] If the parsing is successful, this string is set to the search expression.

  • search: [out] If the parsing is successful, this string is set to the replace expression.

struct sed_transform
#include <sed_transform.hpp>

An unary function object which applies a sed command to its subject and returns the resulting string.

Note

Currently, only supports search and replace syntax (s/search/replace/)

Public Functions

sed_transform(std::string const &search, std::string const &replace)
sed_transform(std::string const &expression)
std::string operator()(std::string const &input) const
operator bool() const
bool operator!() const

Private Members

std::shared_ptr<command> command_