File utils.hh

Defines

PRINT_VERBOSE_LVL(lvl, title, x)

macro for debug outputs

PRINT_VERBOSE_LVL_LN(lvl, title, x)
DEBUG_PRINT(x)
DEBUG_PRINT_LN(x)
DEBUG_VM_HIGH_PRINT(x)
DEBUG_VM_HIGH_PRINT_LN(x)
DEBUG_VM_LOW_PRINT(x)
DEBUG_VM_LOW_PRINT_LN(x)
WARN_PRINT(x)
namespace mata

Main namespace including structs and algorithms for all automata.

In particular, this includes:

  1. Alphabets,

  2. Formula graphs and nodes,

  3. Mintermization,

  4. Closed sets.

Variables

unsigned LOG_VERBOSITY

log verbosity

const std::string g_GIT_SHA1

git sha

class BoolVector : public std::vector<uint8_t>
#include <utils.hh>

Representation of bool vector by a vector of uint8_t.

Public Functions

inline BoolVector(size_t size, bool value)
BoolVector(const BoolVector&) = default
BoolVector(BoolVector&&) noexcept = default
BoolVector() = default
inline BoolVector(std::initializer_list<uint8_t> uint8_ts)
inline explicit BoolVector(const std::vector<uint8_t> &uint8_ts)
BoolVector &operator=(const BoolVector&) = default
BoolVector &operator=(BoolVector&&) noexcept = default
inline size_t count() const

Count the number of set elements.

template<typename T>
inline T &get_elements(T &element_set)

Public Static Functions

template<typename T>
static inline T *get_elements(T *element_set, const BoolVector &bool_vec)
namespace utils

SparseSet.h Implements a class template of a sparse set of unsigned integers.

Non-automata-related structures and algorithms.

In particular, this includes:

  1. Predicates,

  2. Ordered Vectors,

  3. Iterators,

  4. Printers,

  5. Other helper functions.

Author

Sam Griffiths www.computist.xyz https://gist.github.com/sjgriffiths/06732c6076b9db8a7cf4dfe3a7aed43a

Functions

inline std::string replace_all(const std::string &input, const std::string &needle, const std::string &replace)

Replace all occurrences of a substring in a string.

Parameters:
  • input – The input string

  • needle – The substring to be replaced

  • replace – The replacement string

Returns:

A new string with all occurrences of the substring replaced.

template<class T>
bool are_disjoint(const std::set<T> &lhs, const std::set<T> &rhs)

Are two sets disjoint?

template<class T, class Cont>
bool is_in(const T &elem, const Cont &cont)

Is there an element in a container?

template<class T>
inline size_t hash_combine(size_t lhs, const T &rhs)

Combine two hash values.

Values taken from http://www.boost.org/doc/libs/1_64_0/boost/functional/hash/hash.hpp

TODO: fix to be more suitable for 64b

template<typename It>
size_t hash_range(It first, It last)

Hashes a range.

Inspired by http://www.boost.org/doc/libs/1_64_0/boost/functional/hash/hash.hpp

template<class T, class K>
inline bool haskey(const T &cont, const K &key)

checks whether a container with find contains a key

template<template<class, class, class...> class Map, class T1, class T2, class ...Args>
Map<T2, T1> invert_map(const Map<T1, T2> &mp)

inverts a map (should work for std::map and std::unordered_map)

template<class Vector>
inline void reserve_on_insert(Vector &vec, size_t needed_capacity = 0, size_t extension = 32)
template<class Vector, typename Index>
void defragment(Vector &vec, const std::vector<Index> &renaming)
template<class Vector, typename Index>
void rename(Vector &vec, const std::vector<Index> &renaming)
template<class Vector, typename Fun>
void filter_indexes(Vector &vec, const Fun &&is_staying)
template<class Vector, typename Fun>
void filter(Vector &vec, const Fun &&is_staying)
template<class Vector>
inline void sort_and_rmdupl(Vector &vec)
template<class Tuple, size_t N>
struct TuplePrinter
#include <utils.hh>

Public Static Functions

static inline std::string print(const Tuple &t)
template<class Tuple>
struct TuplePrinter<Tuple, 1>
#include <utils.hh>

Public Static Functions

static inline std::string print(const Tuple &t)
namespace std

Functions

template<class A>
std::string to_string(const A &value)

arbitrary type with the << operator

template<class A>
std::string to_string(const std::set<A> &st)

set to string

template<class A>
std::string to_string(const std::vector<A> &vec)

Vector to string.

template<class A>
std::string to_string(const std::list<A> &vec)

List to string.

template<class A>
std::string to_string(const std::stack<A> &stck)

stack to string

template<class A>
std::string to_string(const std::function<A> &fun)

function to string

template<class A, class B>
std::string to_string(const std::pair<A, B> &p)
template<class A, class B>
std::string to_string(const std::map<A, B> &mp)

map to string

template<class A, class B>
std::string to_string(const std::unordered_map<A, B> &unmap)

unordered_map to string

template<class A, class B>
std::string to_string(const std::unordered_multimap<A, B> &unmap)

unordered_multimap to string

inline std::string to_string(char ch)

Character to string.

inline std::string to_string(const std::string &str)

String to string.

template<class ...Ts>
std::string to_string(const std::tuple<Ts...> &tup)

tuple to string

template<class A, class B>
struct hash<std::pair<A, B>>
#include <utils.hh>

A hasher for pairs.

Public Functions

inline size_t operator()(const std::pair<A, B> &k) const
template<class A>
struct hash<std::set<A>>
#include <utils.hh>

A hasher for sets.

Public Functions

inline size_t operator()(const std::set<A> &cont) const
template<class A>
struct hash<std::vector<A>>
#include <utils.hh>

A hasher for vectors.

Public Functions

inline size_t operator()(const std::vector<A> &cont) const