mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities Namespace Reference

Namespaces

namespace  detail
 
namespace  tools
 The namespace for command line tool classes.
 

Classes

class  big_natural_number
 
class  block_allocator
 Fixed-size block allocator compatible with the STL allocator interface. More...
 
class  cache_metric
 A helper class to keep track of the number of hits and misses for cache-like data structures. More...
 
class  cartesian_product_view
 Cartesian product of two ranges, should be available in C++23. More...
 
class  command_line_parser
 Main parsing component for command line strings as well as interface to the results of parsing. The input is a specification of an interface. More...
 
class  execution_timer
 Simple timer to time the CPU time used by a piece of code. More...
 
class  fifo_policy
 
class  file_format
 
class  fixed_size_cache
 A cache keeps track of key-value pairs similar to a map. The difference is that a cache has (an optional) maximum size and a policy that determines what element gets evicted when the cache is full. More...
 
struct  forall
 Checks whether condition holds for all types passed as variadic template. More...
 
struct  forall< Cond, Conds... >
 
class  function_cache
 A cache keeps track of key-value pairs similar to a map. The difference is that a cache has (an optional) maximum size and a policy that determines what element gets evicted when the cache is full. More...
 
struct  function_traits
 
struct  function_traits< ReturnType(ClassType::*)(Args...) const >
 
class  hashtable
 A set that assigns each element an unique index. More...
 
class  ibitstream
 The counterpart of obitstream, guarantees that the same data is read as has been written when calling the read operators in the same sequence as the corresponding write operators. More...
 
class  indexed_set
 A set that assigns each element an unique index. More...
 
class  interface_description
 Command line interface description component. More...
 
struct  is_applicable
 
struct  is_applicable2
 
struct  is_applicable2< FunctionType, ArgumentType1, ArgumentType2, typename std::invoke_result_t< FunctionType, ArgumentType1, ArgumentType2 > >
 
struct  is_applicable< FunctionType, ArgumentType, typename std::invoke_result_t< FunctionType, ArgumentType > >
 
struct  is_constant_function_yielding
 
struct  is_constant_function_yielding< FunctionType, ResultType, typename std::is_convertible< typename std::invoke_result_t< FunctionType >::type, ResultType > >
 
struct  is_iterable
 A typetrait that is std::true_type iff std::begin() and std::end() can be called on type T. More...
 
struct  is_iterable< T, std::void_t< decltype(std::begin(std::declval< T >())), decltype(std::end(std::declval< T >()))> >
 
struct  is_iterator
 A typetrait that is std::true_type iff the given type has the iterator traits. More...
 
class  mutex
 This is simply an exclusive lock based on the standard library with the ability to perform no locks when thread safety is not desired. More...
 
class  no_policy
 A policy that replaces an arbitrary (but not random) element. More...
 
class  noncopyable
 Inherit from this class to prevent it from being copyable. More...
 
class  number_postfix_generator
 Identifier generator that generates names consisting of a prefix followed by a number. For each prefix an index is maintained, that is incremented after each call to operator()(prefix). More...
 
class  obitstream
 A bitstream provides per bit writing of data to any stream (including stdout). More...
 
class  probabilistic_arbitrary_precision_fraction
 This class contains labels for probabilistic transistions, consisting of a numerator and a denominator as a string of digits. More...
 
class  process_pool
 A pool of worker processes that process line-oriented requests. More...
 
class  progress_meter
 Displays progress messages for a task that performs a fixed number of steps. More...
 
class  replacement_policy
 An interface to implement a replacement policy for the fixed_size_cache. More...
 
class  shared_mutex
 
struct  shared_mutex_data
 
class  shared_reference
 A reference counted reference to a shared_reference_counted object. More...
 
class  shared_reference_counted
 Stores a reference count that can be incremented and decremented. More...
 
struct  skip
 The skip operation with a variable number of arguments. More...
 
class  stack_array
 Provides (a subset of) the interface of std::array<T> for a portion of preallocated memory. Can be used to interface with a portion of memory allocated on the stack,. More...
 
class  tagged_pointer
 A pointer storage object that uses a least significant bit as a mark. Can be used by objects that are 8 bytes aligned in memory. More...
 
class  ThreadLocal
 Per-object thread-local storage container. More...
 
class  unordered_map
 A class for a map of keys to values in T based using the simple hash table set implementation. More...
 
class  unordered_set
 A unordered_set with a subset of the interface of std::unordered_set that only stores a single pointer for each element. More...
 
class  zip_view
 

Concepts

concept  HasIteratorTraits
 A concept for whether type T has iterator traits defined.
 

Typedefs

using lock_guard = std::unique_lock< shared_mutex >
 An exclusive lock guard for the shared_mutex, as in the standard library.
 
using shared_guard = std::shared_lock< shared_mutex >
 A shared lock guard for the shared_mutex, as in the standard library.
 
template<typename Key , typename T , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = mcrl2::utilities::block_allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using unordered_map_large = unordered_map< Key, T, Hash, Equals, Allocator, ThreadSafe, Resize >
 A specialization for large unordered maps that uses the block_allocator internally by default.
 
template<typename Key , typename T >
using fifo_cache = fixed_size_cache< fifo_policy< mcrl2::utilities::unordered_map< Key, T > > >
 
template<typename F , typename Args >
using fifo_function_cache = function_cache< fifo_policy< mcrl2::utilities::unordered_map< Args, decltype(std::declval< F >()(std::declval< Args >()))> >, F, Args >
 
template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = mcrl2::utilities::block_allocator<Key>, bool ThreadSafe = false>
using unordered_set_large = unordered_set< Key, Hash, Equals, Allocator, ThreadSafe >
 A specialization for large unordered sets that uses the block_allocator internally by default.
 

Functions

template<typename T >
std::string to_string (const T &x)
 Transform parameter into string.
 
std::vector< std::string > split_paragraphs (const std::string &text)
 Split a string into paragraphs.
 
std::vector< std::string > split (const std::string &line, const std::string &separators)
 Split the text.
 
std::list< std::string > split_actions (const std::string &s)
 Split a string on commas that occur outside parentheses.
 
std::string read_text (const std::string &filename, bool warn=false)
 Read text from a file.
 
std::string read_text (std::istream &in)
 Read text from a stream.
 
std::string remove_comments (const std::string &text)
 Remove comments from a text (everything from '' until end of line).
 
std::string remove_whitespace (const std::string &text)
 Removes whitespace from a string.
 
std::string regex_replace (const std::string &src, const std::string &dest, const std::string &text)
 Regular expression replacement in a string.
 
std::vector< std::string > regex_split (const std::string &text, const std::string &sep)
 Split a string using a regular expression separator.
 
std::string trim_copy (const std::string &text)
 Remove all trailing and leading spaces from the input.
 
void trim (std::string &text)
 Remove all trailing and leading spaces from the input.
 
template<typename Container >
std::string string_join (const Container &c, const std::string &separator)
 Joins a sequence of strings. This is a replacement for boost::algorithm::join, since it gives stack overflow errors with Visual C++ express 9.0 under some circumstances.
 
std::string word_wrap_text (const std::string &text, unsigned int max_line_length=78)
 Apply word wrapping to a text.
 
bool is_numeric_string (const std::string &s)
 Test if a string is a number.
 
void number2string (std::size_t number, std::string &buffer, std::size_t start_position)
 Convert a number to a string in the buffer starting at position start_position.
 
std::string number2string (std::size_t number)
 Convert a number to string.
 
template<typename T >
constexpr std::size_t integer_encoding_size ()
 
template<typename T >
requires std::is_integral_v<T>
static constexpr bool is_power_of_two (T value)
 
template<typename T >
requires std::is_integral_v<T>
static T round_up_to_power_of_two (T value)
 
template<typename Iter >
std::string substring (const std::string &s, Iter first, Iter last)
 
interface_description::mandatory_argument< std::string > make_mandatory_argument (std::string const &name, std::string const &default_value)
 
interface_description::mandatory_argument< std::string > make_mandatory_argument (std::string const &name)
 
interface_description::optional_argument< std::string > make_optional_argument (std::string const &name, std::string const &default_value)
 Creates an optional option argument specification object.
 
static std::string mark_name_in_usage (std::string const &usage, const std::string &begin, const std::string &end)
 
std::string copyright_period ()
 toolset copyright period description
 
template<typename ArgumentType >
interface_description::optional_argument< ArgumentType > make_optional_argument (std::string const &name, std::string const &default_value)
 Creates an optional option argument specification object.
 
template<typename ArgumentType >
interface_description::mandatory_argument< ArgumentType > make_mandatory_argument (std::string const &name)
 Creates a mandatory option argument specification object.
 
static std::vector< std::string > word_wrap_line (const std::string &line, unsigned int max_line_length)
 Apply word wrapping to a text that doesn't contain newlines.
 
std::string get_toolset_version ()
 Get the toolset revision.
 
std::string get_executable_path ()
 Returns the absolute path to the running executable, resolved against symbolic links where possible.
 
std::string get_executable_basename ()
 Returns the directory containing the running executable.
 
std::string pp (const big_natural_number &l)
 
std::ostream & operator<< (std::ostream &ss, const big_natural_number &l)
 
void swap (big_natural_number &x, big_natural_number &y) noexcept
 Standard overload of swap.
 
float bytes_to_megabytes (std::size_t bytes)
 
template<typename T >
void print_performance_statistics (const T &unordered_set)
 Prints various information for unordered_set like data structures.
 
bool has_extension (const std::string &filename, const std::string &extension)
 Returns true if the given filename has the extension ext. The extension does not start with a dot.
 
std::string file_extension (const std::string &filename)
 Returns the file extension for the given path.
 
std::ostream & operator<< (std::ostream &stream, const file_format &format)
 
bool file_exists (const std::string &filename)
 
std::size_t ceil_log2 (std::size_t n)
 
std::size_t power_size_t (const std::size_t n_in, const std::size_t m_in)
 
template<typename T >
bool is_odd (T t)
 
template<typename T >
bool is_even (T t)
 
std::size_t parse_natural_number (const std::string &text)
 Parses a natural number from a string.
 
std::vector< std::size_t > parse_natural_number_sequence (const std::string &text)
 Parses a sequence of natural numbers (separated by spaces) from a string.
 
std::string pp (const probabilistic_arbitrary_precision_fraction &l)
 
std::ostream & operator<< (std::ostream &out, const probabilistic_arbitrary_precision_fraction &x)
 
template<typename Graph , typename Iter >
std::vector< std::size_t > reachable_nodes (const Graph &g, Iter first, Iter last)
 Compute reachable nodes in a graph.
 
template<typename SequenceContainer , typename OutIter , typename SequenceFunction , typename Assign >
void foreach_sequence (const SequenceContainer &X, OutIter i, SequenceFunction f, Assign assign)
 Algorithm for generating sequences. Given a sequence [X1, ..., Xn], where each element Xi is a sequence as well, this function generates all sequences [x1, ..., xn], where xi is an element of Xi for all i = 1 ... n. For each of these sequences the function f is called. The assign parameter gives the user control over how each sequence is built.
 
template<typename SequenceContainer , typename OutIter , typename SequenceFunction >
void foreach_sequence (const SequenceContainer &X, OutIter i, SequenceFunction f)
 Algorithm for generating sequences. Given a sequence [X1, ..., Xn], where each element Xi is a sequence as well, this function generates all sequences [x1, ..., xn], where xi is an element of Xi for all i = 1 ... n. For each of these sequences the function f is called.
 
template<typename T >
T * tag (const T *p)
 Applies a tag to a pointer.
 
template<typename T >
T * tag (const detail::atomic_wrapper< T * > &p)
 
template<typename T >
T * pointer (const T *p)
 
template<typename T >
T * pointer (const detail::atomic_wrapper< T * > &p)
 
template<typename T >
bool tagged (const T *p)
 
template<typename T >
bool tagged (const detail::atomic_wrapper< T * > &p)
 
char rand_alnum ()
 Generate a random alphanumeric character.
 
std::string rand_alnum_str (const std::string::size_type n)
 Generate a random string of length n.
 
bool file_exists (const char *filename)
 
std::string temporary_filename (std::string const &prefix="")
 Get filename with random suffix.
 
template<typename Range1 , typename Range2 >
auto cartesian_product (Range1 r1, Range2 r2)
 
template<typename Range1 , typename Range2 >
auto zip (Range1 r1, Range2 r2)
 

Variables

template<typename T >
constexpr bool is_iterable_v = is_iterable<T>::value
 
template<typename T >
constexpr bool is_iterator_v = is_iterator<T>::value
 
static constexpr std::size_t minimum_size = 4UL
 
static constexpr bool EnableReferenceCountMetrics = false
 Enable to count the number of reference count changes.
 
static constexpr bool EnableLockfreeInsertion = true
 Enables lockfree implementation of emplace.
 
static constexpr long BucketsPerMutex = 256
 Number of buckets per mutex.
 

Typedef Documentation

◆ fifo_cache

template<typename Key , typename T >
using mcrl2::utilities::fifo_cache = typedef fixed_size_cache<fifo_policy<mcrl2::utilities::unordered_map<Key, T> >>

Definition at line 147 of file fixed_size_cache.h.

◆ fifo_function_cache

template<typename F , typename Args >
using mcrl2::utilities::fifo_function_cache = typedef function_cache< fifo_policy<mcrl2::utilities::unordered_map<Args, decltype(std::declval<F>()(std::declval<Args>()))> >, F, Args>

Definition at line 150 of file fixed_size_cache.h.

◆ lock_guard

using mcrl2::utilities::lock_guard = typedef std::unique_lock<shared_mutex>

An exclusive lock guard for the shared_mutex, as in the standard library.

Definition at line 327 of file shared_mutex.h.

◆ shared_guard

using mcrl2::utilities::shared_guard = typedef std::shared_lock<shared_mutex>

A shared lock guard for the shared_mutex, as in the standard library.

Definition at line 330 of file shared_mutex.h.

◆ unordered_map_large

template<typename Key , typename T , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = mcrl2::utilities::block_allocator<Key>, bool ThreadSafe = false, bool Resize = true>
using mcrl2::utilities::unordered_map_large = typedef unordered_map<Key, T, Hash, Equals, Allocator, ThreadSafe, Resize>

A specialization for large unordered maps that uses the block_allocator internally by default.

Definition at line 266 of file unordered_map.h.

◆ unordered_set_large

template<typename Key , typename Hash = std::hash<Key>, typename Equals = std::equal_to<Key>, typename Allocator = mcrl2::utilities::block_allocator<Key>, bool ThreadSafe = false>
using mcrl2::utilities::unordered_set_large = typedef unordered_set<Key, Hash, Equals, Allocator, ThreadSafe>

A specialization for large unordered sets that uses the block_allocator internally by default.

Definition at line 397 of file unordered_set.h.

Function Documentation

◆ bytes_to_megabytes()

float mcrl2::utilities::bytes_to_megabytes ( std::size_t  bytes)
inline

Definition at line 26 of file unordered_set_implementation.h.

◆ cartesian_product()

template<typename Range1 , typename Range2 >
auto mcrl2::utilities::cartesian_product ( Range1  r1,
Range2  r2 
)

Definition at line 117 of file views.h.

◆ ceil_log2()

std::size_t mcrl2::utilities::ceil_log2 ( std::size_t  n)
inline

Definition at line 26 of file math.h.

◆ copyright_period()

std::string mcrl2::utilities::copyright_period ( )
inline

toolset copyright period description

Definition at line 32 of file command_line_interface.h.

◆ file_exists() [1/2]

bool mcrl2::utilities::file_exists ( const char *  filename)
inline

Definition at line 52 of file test_utilities.h.

◆ file_exists() [2/2]

bool mcrl2::utilities::file_exists ( const std::string &  filename)
inline

Definition at line 106 of file file_utility.h.

◆ file_extension()

std::string mcrl2::utilities::file_extension ( const std::string &  filename)
inline

Returns the file extension for the given path.

Definition at line 37 of file file_utility.h.

◆ foreach_sequence() [1/2]

template<typename SequenceContainer , typename OutIter , typename SequenceFunction >
void mcrl2::utilities::foreach_sequence ( const SequenceContainer &  X,
OutIter  i,
SequenceFunction  f 
)

Algorithm for generating sequences. Given a sequence [X1, ..., Xn], where each element Xi is a sequence as well, this function generates all sequences [x1, ..., xn], where xi is an element of Xi for all i = 1 ... n. For each of these sequences the function f is called.

Parameters
XA sequence.
iAn output iterator to where the generated sequences are written.
fA function that is called for each generated sequence.

Definition at line 99 of file sequence.h.

◆ foreach_sequence() [2/2]

template<typename SequenceContainer , typename OutIter , typename SequenceFunction , typename Assign >
void mcrl2::utilities::foreach_sequence ( const SequenceContainer &  X,
OutIter  i,
SequenceFunction  f,
Assign  assign 
)

Algorithm for generating sequences. Given a sequence [X1, ..., Xn], where each element Xi is a sequence as well, this function generates all sequences [x1, ..., xn], where xi is an element of Xi for all i = 1 ... n. For each of these sequences the function f is called. The assign parameter gives the user control over how each sequence is built.

Parameters
XA sequence.
iAn output iterator to where the generated sequences are written.
fA function that is called for each generated sequence.
assignThe assign operation is called to assign values to the generated sequence.

Definition at line 78 of file sequence.h.

◆ get_executable_basename()

std::string mcrl2::utilities::get_executable_basename ( )
inline

Returns the directory containing the running executable.

Returns
A string

Definition at line 89 of file basename.h.

◆ get_executable_path()

std::string mcrl2::utilities::get_executable_path ( )
inline

Returns the absolute path to the running executable, resolved against symbolic links where possible.

Returns
The path, or an empty string when it could not be determined.

Definition at line 44 of file basename.h.

◆ get_toolset_version()

std::string mcrl2::utilities::get_toolset_version ( )

Get the toolset revision.

Returns
A string representation of the toolset revision

Definition at line 22 of file toolset_version.cpp.

◆ has_extension()

bool mcrl2::utilities::has_extension ( const std::string &  filename,
const std::string &  extension 
)
inline

Returns true if the given filename has the extension ext. The extension does not start with a dot.

Definition at line 24 of file file_utility.h.

◆ integer_encoding_size()

template<typename T >
constexpr std::size_t mcrl2::utilities::integer_encoding_size ( )
constexpr
Returns
The number of bits needed to represent a value of type T in most significant bit encoding.

Definition at line 22 of file bitstream.h.

◆ is_even()

template<typename T >
bool mcrl2::utilities::is_even ( T  t)

Definition at line 64 of file math.h.

◆ is_numeric_string()

bool mcrl2::utilities::is_numeric_string ( const std::string &  s)

Test if a string is a number.

Parameters
sA string of text.
Returns
True if s is of the form "0 | -? [1-9][0-9]*", false otherwise

Definition at line 209 of file text_utility.cpp.

◆ is_odd()

template<typename T >
bool mcrl2::utilities::is_odd ( T  t)

Definition at line 58 of file math.h.

◆ is_power_of_two()

template<typename T >
requires std::is_integral_v<T>
static constexpr bool mcrl2::utilities::is_power_of_two ( T  value)
staticconstexpr
Returns
True when the given value is a power of two.

Definition at line 24 of file power_of_two.h.

◆ make_mandatory_argument() [1/3]

template<typename ArgumentType >
interface_description::mandatory_argument< ArgumentType > mcrl2::utilities::make_mandatory_argument ( std::string const &  name)

Creates a mandatory option argument specification object.

Definition at line 1001 of file command_line_interface.h.

◆ make_mandatory_argument() [2/3]

interface_description::mandatory_argument< std::string > mcrl2::utilities::make_mandatory_argument ( std::string const &  name)

Definition at line 333 of file command_line_interface.cpp.

◆ make_mandatory_argument() [3/3]

interface_description::mandatory_argument< std::string > mcrl2::utilities::make_mandatory_argument ( std::string const &  name,
std::string const &  default_value 
)

Creates an object that specifies an option with a mandatory argument. Specifying the option in a command also requires specification of an option argument.

Parameters
[in]namea placeholder for referencing the argument in textual descriptions
Returns
a basic_argument derived object that represents an untyped mandatory option argument

The following example demonstrates the effect of an option with optional argument:

add_option("recursive", make_mandatory_argument("DEPTH"),
"stop at recursion level DEPTH", 'r');
interface_description::mandatory_argument< std::string > make_mandatory_argument(std::string const &name, std::string const &default_value)

The result is a command line interface with parsing behaviour:

   tool                     (effect: options("recursive").count() == 0)
   tool --recursive         (effect: parsing fails)
   tool -r                  (effect: parsing fails)
   tool --recursive=3       (effect: options("recursive").count() == 1 && option_argument("recursive") == 3)
   tool -r3                 (effect: options("recursive").count() == 1 && option_argument("recursive") == 3)
 **/
interface_description::mandatory_argument<std::string> make_mandatory_argument(std::string const& name);

/** \brief Creates a mandatory typed option argument specification object
 *
 * \see make_mandatory_argument(std::string const&)
 **/
template<typename ArgumentType>
interface_description::mandatory_argument<ArgumentType> make_mandatory_argument(std::string const& name,
  std::string const& standard_value)
{
  return interface_description::mandatory_argument<ArgumentType>(name, standard_value);
}

/**
 * Creates an object that specifies an option with a mandatory argument.
 * Specifying the option in a command also requires specification of an
 * option argument. The default value is substituted by the
 * option_argument() and option_argument_as() methods when the option is
 * not part of the parsed command.
 *
 * \param[in] name a placeholder for referencing the argument in textual descriptions
 * \return a basic_argument derived object that represents an untyped mandatory option argument
 *
 * The following example demonstrates the effect of an option with optional argument:
 * \code
 *  add_option("recursive", make_mandatory_argument("DEPTH", "2"),
 *                         "stop at recursion level DEPTH (default 2)", 'r');
 * \endcode
 * The result is a command line interface with parsing behaviour:
 * \verbatim
   tool                     (effect: options("recursive").count() == 0 && option_argument("recursive") == 2)
   tool --recursive         (effect: options("recursive").count() == 0 && option_argument("recursive") == 2)
   tool -r                  (effect: options("recursive").count() == 0 && option_argument("recursive") == 2)
   tool --recursive=3       (effect: options("recursive").count() == 1 && option_argument("recursive") == 3)
   tool -r3                 (effect: options("recursive").count() == 1 && option_argument("recursive") == 3)
 * 

Definition at line 326 of file command_line_interface.cpp.

◆ make_optional_argument() [1/2]

interface_description::optional_argument< std::string > mcrl2::utilities::make_optional_argument ( std::string const &  name,
std::string const &  default_value 
)

Creates an optional option argument specification object.

Creates an object that specifies an option with an optional typed argument. The default value is automatically substituted when the user specifies the option but does not specify an option argument.

Parameters
[in]namea placeholder for referencing the argument in textual descriptions
[in]default_valuethe default value
Returns
a basic_argument derived object that represents an untyped optional option argument

The following example demonstrates the effect of an option with optional argument:

add_option("recursive", make_optional_argument("DEPTH", "2"),
"stop at recursion level DEPTH (default 2)", 'r');
interface_description::optional_argument< std::string > make_optional_argument(std::string const &name, std::string const &default_value)
Creates an optional option argument specification object.

The result is a command line interface with parsing behaviour:

  tool                     (effect: options("recursive").count() == 0)
  tool --recursive         (effect: options("recursive").count() == 1 && option_argument("recursive") == 2)
  tool -r                  (effect: options("recursive").count() == 1 && option_argument("recursive") == 2)
  tool --recursive=3       (effect: options("recursive").count() == 1 && option_argument("recursive") == 3)
  tool -r3                 (effect: options("recursive").count() == 1 && option_argument("recursive") == 3)
* 

Definition at line 340 of file command_line_interface.cpp.

◆ make_optional_argument() [2/2]

template<typename ArgumentType >
interface_description::optional_argument< ArgumentType > mcrl2::utilities::make_optional_argument ( std::string const &  name,
std::string const &  default_value 
)

Creates an optional option argument specification object.

Definition at line 966 of file command_line_interface.h.

◆ mark_name_in_usage()

static std::string mcrl2::utilities::mark_name_in_usage ( std::string const &  usage,
const std::string &  begin,
const std::string &  end 
)
inlinestatic

Definition at line 484 of file command_line_interface.cpp.

◆ number2string() [1/2]

std::string mcrl2::utilities::number2string ( std::size_t  number)
inline

Convert a number to string.

This function is much faster than std::to_string and its use is therefore preferred in those cases were performance counts.

Parameters
numberA number to be transformed.

Definition at line 209 of file text_utility.h.

◆ number2string() [2/2]

void mcrl2::utilities::number2string ( std::size_t  number,
std::string &  buffer,
std::size_t  start_position 
)
inline

Convert a number to a string in the buffer starting at position start_position.

Parameters
numberThe number to be converted.
bufferA buffer in which the string will be stored that is sufficiently large.
start_positionThe first position where a number is written.

Definition at line 179 of file text_utility.h.

◆ operator<<() [1/3]

std::ostream & mcrl2::utilities::operator<< ( std::ostream &  out,
const probabilistic_arbitrary_precision_fraction &  x 
)
inline

◆ operator<<() [2/3]

std::ostream & mcrl2::utilities::operator<< ( std::ostream &  ss,
const big_natural_number &  l 
)
inline

Definition at line 697 of file big_numbers.h.

◆ operator<<() [3/3]

std::ostream & mcrl2::utilities::operator<< ( std::ostream &  stream,
const file_format &  format 
)
inline

Definition at line 100 of file file_utility.h.

◆ parse_natural_number()

std::size_t mcrl2::utilities::parse_natural_number ( const std::string &  text)
inline

Parses a natural number from a string.

Definition at line 68 of file parse_numbers.h.

◆ parse_natural_number_sequence()

std::vector< std::size_t > mcrl2::utilities::parse_natural_number_sequence ( const std::string &  text)
inline

Parses a sequence of natural numbers (separated by spaces) from a string.

Definition at line 97 of file parse_numbers.h.

◆ pointer() [1/2]

template<typename T >
T * mcrl2::utilities::pointer ( const detail::atomic_wrapper< T * > &  p)

Definition at line 45 of file tagged_pointer.h.

◆ pointer() [2/2]

template<typename T >
T * mcrl2::utilities::pointer ( const T *  p)
Returns
The original pointer that can be deferenced.

Definition at line 39 of file tagged_pointer.h.

◆ power_size_t()

std::size_t mcrl2::utilities::power_size_t ( const std::size_t  n_in,
const std::size_t  m_in 
)
inline

Definition at line 40 of file math.h.

◆ pp() [1/2]

std::string mcrl2::utilities::pp ( const big_natural_number &  l)
inline

Definition at line 751 of file big_numbers.h.

◆ pp() [2/2]

std::string mcrl2::utilities::pp ( const probabilistic_arbitrary_precision_fraction &  l)
inline

◆ print_performance_statistics()

template<typename T >
void mcrl2::utilities::print_performance_statistics ( const T &  unordered_set)

Prints various information for unordered_set like data structures.

Definition at line 237 of file unordered_set_implementation.h.

◆ rand_alnum()

char mcrl2::utilities::rand_alnum ( )
inline

Generate a random alphanumeric character.

Definition at line 27 of file test_utilities.h.

◆ rand_alnum_str()

std::string mcrl2::utilities::rand_alnum_str ( const std::string::size_type  n)
inline

Generate a random string of length n.

Definition at line 43 of file test_utilities.h.

◆ reachable_nodes()

template<typename Graph , typename Iter >
std::vector< std::size_t > mcrl2::utilities::reachable_nodes ( const Graph &  g,
Iter  first,
Iter  last 
)

Compute reachable nodes in a graph.

Parameters
gA graph.
firstIterator to the first node.
lastIterator to the last node.
Returns
The indices of the nodes that are reachable from the nodes given by the range of vertex descriptors [first, last].

Definition at line 58 of file reachable_nodes.h.

◆ read_text() [1/2]

std::string mcrl2::utilities::read_text ( const std::string &  filename,
bool  warn = false 
)

Read text from a file.

Parameters
filenameA string
warnIf true, a warning is printed to standard error if the file is not found
Returns
The contents of the file

Definition at line 65 of file text_utility.cpp.

◆ read_text() [2/2]

std::string mcrl2::utilities::read_text ( std::istream &  in)
inline

Read text from a stream.

Parameters
inAn input stream
Returns
The text read from the stream

Definition at line 102 of file text_utility.h.

◆ regex_replace()

std::string mcrl2::utilities::regex_replace ( const std::string &  src,
const std::string &  dest,
const std::string &  text 
)

Regular expression replacement in a string.

Parameters
srcA string
destA string
textA string
Returns
The transformed string

Definition at line 119 of file text_utility.cpp.

◆ regex_split()

std::vector< std::string > mcrl2::utilities::regex_split ( const std::string &  text,
const std::string &  sep 
)

Split a string using a regular expression separator.

Parameters
textA string
sepA string
Returns
The splitted string

Definition at line 128 of file text_utility.cpp.

◆ remove_comments()

std::string mcrl2::utilities::remove_comments ( const std::string &  text)

Remove comments from a text (everything from '' until end of line).

Parameters
textA string
Returns
The removal result

Definition at line 95 of file text_utility.cpp.

◆ remove_whitespace()

std::string mcrl2::utilities::remove_whitespace ( const std::string &  text)

Removes whitespace from a string.

Parameters
textA string
Returns
The removal result

Definition at line 107 of file text_utility.cpp.

◆ round_up_to_power_of_two()

template<typename T >
requires std::is_integral_v<T>
static T mcrl2::utilities::round_up_to_power_of_two ( T  value)
static
Returns
The smallest power of two that is larger than the given value.

Definition at line 33 of file power_of_two.h.

◆ split()

std::vector< std::string > mcrl2::utilities::split ( const std::string &  line,
const std::string &  separators 
)

Split the text.

Parameters
lineA string
separatorsA string
Returns
The splitted text

Definition at line 54 of file text_utility.cpp.

◆ split_actions()

std::list< std::string > mcrl2::utilities::split_actions ( const std::string &  s)
inline

Split a string on commas that occur outside parentheses.

This is intended for comma separated lists of actions or parameters, in which commas inside parentheses must not split the list.

Parameters
sA string
Returns
The substrings of s that are separated by commas occurring outside parentheses

Definition at line 60 of file text_utility.h.

◆ split_paragraphs()

std::vector< std::string > mcrl2::utilities::split_paragraphs ( const std::string &  text)

Split a string into paragraphs.

Parameters
textA string
Returns
The paragraphs of text

Definition at line 26 of file text_utility.cpp.

◆ string_join()

template<typename Container >
std::string mcrl2::utilities::string_join ( const Container &  c,
const std::string &  separator 
)

Joins a sequence of strings. This is a replacement for boost::algorithm::join, since it gives stack overflow errors with Visual C++ express 9.0 under some circumstances.

Definition at line 150 of file text_utility.h.

◆ substring()

template<typename Iter >
std::string mcrl2::utilities::substring ( const std::string &  s,
Iter  first,
Iter  last 
)

Definition at line 21 of file command_line_interface.cpp.

◆ swap()

void mcrl2::utilities::swap ( big_natural_number &  x,
big_natural_number &  y 
)
inlinenoexcept

Standard overload of swap.

Definition at line 724 of file big_numbers.h.

◆ tag() [1/2]

template<typename T >
T * mcrl2::utilities::tag ( const detail::atomic_wrapper< T * > &  p)

Definition at line 32 of file tagged_pointer.h.

◆ tag() [2/2]

template<typename T >
T * mcrl2::utilities::tag ( const T *  p)

Applies a tag to a pointer.

Returns
A pointer where one bit that is unused is set to one.

Definition at line 26 of file tagged_pointer.h.

◆ tagged() [1/2]

template<typename T >
bool mcrl2::utilities::tagged ( const detail::atomic_wrapper< T * > &  p)

Definition at line 58 of file tagged_pointer.h.

◆ tagged() [2/2]

template<typename T >
bool mcrl2::utilities::tagged ( const T *  p)
Returns
True iff this pointer has been tagged.

Definition at line 52 of file tagged_pointer.h.

◆ temporary_filename()

std::string mcrl2::utilities::temporary_filename ( std::string const &  prefix = "")
inline

Get filename with random suffix.

Warning
is prone to race conditions

Definition at line 61 of file test_utilities.h.

◆ to_string()

template<typename T >
std::string mcrl2::utilities::to_string ( const T &  x)
inline

Transform parameter into string.

Parameters
xSome expression
Precondition
type T has operator <<
Returns
The string representation of x.

Definition at line 35 of file text_utility.h.

◆ trim()

void mcrl2::utilities::trim ( std::string &  text)

Remove all trailing and leading spaces from the input.

Parameters
textA string

Definition at line 222 of file text_utility.cpp.

◆ trim_copy()

std::string mcrl2::utilities::trim_copy ( const std::string &  text)

Remove all trailing and leading spaces from the input.

Parameters
textA string
Returns
The trimmed string

Definition at line 217 of file text_utility.cpp.

◆ word_wrap_line()

static std::vector< std::string > mcrl2::utilities::word_wrap_line ( const std::string &  line,
unsigned int  max_line_length 
)
static

Apply word wrapping to a text that doesn't contain newlines.

Parameters
lineA string of text.
max_line_lengthThe maximum line length.
Returns
The wrapped text.

Definition at line 154 of file text_utility.cpp.

◆ word_wrap_text()

std::string mcrl2::utilities::word_wrap_text ( const std::string &  text,
unsigned int  max_line_length = 78 
)

Apply word wrapping to a text.

Parameters
textA string of text.
max_line_lengthThe maximum line length.
Returns
The wrapped text.

Definition at line 185 of file text_utility.cpp.

◆ zip()

template<typename Range1 , typename Range2 >
auto mcrl2::utilities::zip ( Range1  r1,
Range2  r2 
)

Definition at line 219 of file views.h.

Variable Documentation

◆ BucketsPerMutex

constexpr long mcrl2::utilities::BucketsPerMutex = 256
staticconstexpr

Number of buckets per mutex.

Definition at line 27 of file unordered_set.h.

◆ EnableLockfreeInsertion

constexpr bool mcrl2::utilities::EnableLockfreeInsertion = true
staticconstexpr

Enables lockfree implementation of emplace.

Definition at line 24 of file unordered_set.h.

◆ EnableReferenceCountMetrics

constexpr bool mcrl2::utilities::EnableReferenceCountMetrics = false
staticconstexpr

Enable to count the number of reference count changes.

Definition at line 25 of file shared_reference.h.

◆ is_iterable_v

template<typename T >
constexpr bool mcrl2::utilities::is_iterable_v = is_iterable<T>::value
constexpr

Definition at line 51 of file type_traits.h.

◆ is_iterator_v

template<typename T >
constexpr bool mcrl2::utilities::is_iterator_v = is_iterator<T>::value
constexpr

Definition at line 54 of file type_traits.h.

◆ minimum_size

constexpr std::size_t mcrl2::utilities::minimum_size = 4UL
staticconstexpr

Definition at line 24 of file unordered_set_implementation.h.