|
smats
0.0.1
Satisfability Modulo Arithmetic Theories Symbols
|
#include <environment.h>
Public Types | |
using | key_type = Variable |
using | mapped_type = T |
using | map = std::unordered_map<key_type, T> |
using | value_type = map::value_type |
using | iterator = map::iterator |
using | const_iterator = map::const_iterator |
Public Member Functions | |
Environment ()=default | |
Environment (std::initializer_list< value_type > init) | |
Environment (std::span< const value_type > init) | |
Environment (std::initializer_list< key_type > vars) | |
Environment (std::span< const key_type > vars) | |
Environment (map m) | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
void | insert (const key_type &key, const T &elem) |
void | insert_or_assign (const key_type &key, const T &elem) |
bool | empty () const |
std::size_t | size () const |
Variables | domain () const |
bool | contains (const key_type &key) const |
iterator | find (const key_type &key) |
const_iterator | find (const key_type &key) const |
const T & | at (const key_type &key) const |
T & | operator[] (const key_type &key) |
const T & | operator[] (const key_type &key) const |
bool | operator== (const Environment< T > &other) const |
Private Attributes | |
map | map_ |
map between variables and values | |
Represents a symbolic environment (mapping from a variable to a value).
This class is used when we evaluate symbolic expressions or formulas which include unquantified (free) variables. Here are examples:
T | type of the value |
|
default |
Construct a new environment object.
|
explicit |
|
explicit |
|
explicit |
Construct a new environment object from a list of variables.
Initializes the variables with 0.0.
vars | initializer list of variables |
std::runtime_exception | if vars include a dummy variable. |
|
explicit |
Construct a new environment object from a list of variables.
Initializes the variables with 0.0.
vars | initializer list of variables |
std::runtime_exception | if vars include a dummy variable. |
|
explicit |
Construct a new environment object from the map m
between variables and values.
m | map between variables and values |
std::runtime_exception | if m include a dummy variable or a NaN value. |
|
nodiscard |
Get a reference to the value that is mapped to a key equivalent to key
.
key | key of the element to find |
std::out_of_range | if the key does not exist |
|
inline |
Get read-only access to the iterator to the beginning of the environment.
|
inlinenodiscard |
Get read-only access to the const iterator to the beginning of the environment.
|
inlinenodiscard |
Get read-only access to the const iterator to the beginning of the environment.
|
inlinenodiscard |
Get read-only access to the const iterator to the end of the environment.
|
inlinenodiscard |
Check if the environment contains the key
.
key | key to check |
key
key
|
nodiscard |
Get read-only access to the domain of the environment.
|
inlinenodiscard |
Check whether the environment is empty.
|
inline |
Get read-only access to the iterator to the end of the environment.
|
inlinenodiscard |
Get read-only access to the const iterator to the end of the environment.
|
inline |
Finds element with specific key.
key | key to find |
key
.
|
inlinenodiscard |
Finds element with specific key.
key | key to find |
key
. void smats::Environment< T >::insert | ( | const key_type & | key, |
const T & | elem ) |
Insert a pair (key
, elem
) if this environment doesn't contain key
.
Similar to insert function in map, if the key already exists in this environment, then calling insert(key, elem) doesn't change the existing key-value in this environment.
key | key to insert |
elem | value to insert |
void smats::Environment< T >::insert_or_assign | ( | const key_type & | key, |
const T & | elem ) |
Insert a pair (key
, elem
) or assign elem
to the existing key if it exists.
key | key to insert |
elem | value to insert |
T & smats::Environment< T >::operator[] | ( | const key_type & | key | ) |
Returns a reference to the value that is mapped to a key equivalent to key
, performing an insertion if such key does not already exist.
key | key of the element to find or insert |
const T & smats::Environment< T >::operator[] | ( | const key_type & | key | ) | const |
Returns a constant reference to the value that is mapped to a key equivalent to key
.
key | key of the element to find |
std::out_of_range | if the key does not exist |
|
inlinenodiscard |
Get read-only access to the number of elements of the environment.