smats  0.0.1
Satisfability Modulo Arithmetic Theories Symbols
Loading...
Searching...
No Matches
smats::Variables Class Reference

#include <variables.h>

Public Types

using size_type = std::set<Variable>::size_type
 
using iterator = std::set<Variable>::iterator
 
using const_iterator = std::set<Variable>::const_iterator
 
using reverse_iterator = std::set<Variable>::reverse_iterator
 
using const_reverse_iterator = std::set<Variable>::const_reverse_iterator
 

Public Member Functions

 Variables ()=default
 
 Variables (std::initializer_list< Variable > init)
 
size_type size () const
 
bool empty () const
 
void hash (InvocableHashAlgorithm auto &hasher) const noexcept
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
void insert (const Variable &var)
 
template<class InputIt >
void insert (InputIt first, InputIt last)
 
void insert (const Variables &vars)
 
size_type erase (const Variable &key)
 
size_type erase (const Variables &vars)
 
iterator find (const Variable &key)
 
const_iterator find (const Variable &key) const
 
bool contains (const Variable &key) const
 
bool is_subset_of (const Variables &vars) const
 
bool is_superset_of (const Variables &vars) const
 
bool is_strict_subset_of (const Variables &vars) const
 
bool is_strict_superset_of (const Variables &vars) const
 
bool operator== (const Variables &vars) const
 
bool operator< (const Variables &vars) const
 
Variablesoperator+= (const Variables &vars)
 
Variablesoperator+= (const Variable &var)
 
Variablesoperator-= (const Variables &vars)
 
Variablesoperator-= (const Variable &var)
 
Variables operator+ (const Variables &vars) const
 
Variables operator+ (const Variable &var) const
 
Variables operator- (const Variables &vars) const
 
Variables operator- (const Variable &var) const
 
Variables intersect (const Variables &vars) const
 

Private Member Functions

 Variables (std::set< Variable > vars)
 

Private Attributes

std::set< Variablevars_
 Set of variables.
 

Detailed Description

Represents a set of variables.

This class is based on std::set<Variable>, with the addition of some utilities such as set-union (Variables::insert, operator+, operator+=), set-minus (Variables::erase, operator-, operator-=) and subset/superset checking functions (Variables::IsSubsetOf, Variables::IsSupersetOf, Variables::IsStrictSubsetOf, Variables::IsStrictSupersetOf).

Constructor & Destructor Documentation

◆ Variables() [1/3]

smats::Variables::Variables ( )
default

Construct a new Variables object.

◆ Variables() [2/3]

smats::Variables::Variables ( std::initializer_list< Variable > init)

Construct a new Variables object initialized with a list of variables.

Parameters
initinitializer list of variables

◆ Variables() [3/3]

smats::Variables::Variables ( std::set< Variable > vars)
explicitprivate

Construct a new Variables object from a set of variables.

Parameters
varsset of variables

Member Function Documentation

◆ begin() [1/2]

iterator smats::Variables::begin ( )
inline

Get read-only access to the iterator to the beginning of the set.

Returns
iterator to the beginning of the set

◆ begin() [2/2]

const_iterator smats::Variables::begin ( ) const
inlinenodiscard

Get read-only access to the const iterator to the beginning of the set.

Returns
const iterator to the beginning of the set

◆ cbegin()

const_iterator smats::Variables::cbegin ( ) const
inlinenodiscard

Get read-only access to the const iterator to the beginning of the set.

Returns
const iterator to the beginning of the set

◆ cend()

const_iterator smats::Variables::cend ( ) const
inlinenodiscard

Get read-only access to the const iterator to the end of the set.

Returns
const iterator to the end of the set

◆ contains()

bool smats::Variables::contains ( const Variable & key) const
inlinenodiscard

Check whether the variable key is contained in the set.

Parameters
keyvariable to check
Returns
true if the variable key is contained in the set
false if the variable key is not contained in the set

◆ crbegin()

const_reverse_iterator smats::Variables::crbegin ( ) const
inlinenodiscard

Get read-only access to the reverse const iterator to the beginning of the set.

Returns
reverse const iterator to the beginning of the set

◆ crend()

const_reverse_iterator smats::Variables::crend ( ) const
inlinenodiscard

Get read-only access to the reverse const iterator to the end of the set.

Returns
reverse const iterator to the end of the set

◆ empty()

bool smats::Variables::empty ( ) const
inlinenodiscard

Check whether the set is empty.

Returns
true if the set is empty
false if the set is not empty

◆ end() [1/2]

iterator smats::Variables::end ( )
inline

Get read-only access to the iterator to the end of the set.

Returns
iterator to the end of the set

◆ end() [2/2]

const_iterator smats::Variables::end ( ) const
inlinenodiscard

Get read-only access to the const iterator to the end of the set.

Returns
const iterator to the end of the set

◆ erase() [1/2]

size_type smats::Variables::erase ( const Variable & key)
inline

Erases key from a set. Return number of erased elements (0 or 1).

Parameters
keyvariable to erase
Returns
number of erased elements

◆ erase() [2/2]

Variables::size_type smats::Variables::erase ( const Variables & vars)

Erases variables in vars from a set. Return number of erased elements ([0, vars.size()]).

Parameters
varsset of variables
Returns
number of erased elements

◆ find() [1/2]

iterator smats::Variables::find ( const Variable & key)
inline

Finds element with specific key.

Parameters
keyvariable to find
Returns
iterator to the element with key equivalent to key

◆ find() [2/2]

const_iterator smats::Variables::find ( const Variable & key) const
inlinenodiscard

Finds element with specific key.

Parameters
keyvariable to find
Returns
const_iterator to the element with key equivalent to key

◆ hash()

void smats::Variables::hash ( InvocableHashAlgorithm auto & hasher) const
inlinenoexcept

Compute the hash of this variables using the given hasher

Template Parameters
InvocableHashAlgorithmtype of the hash algorithm to use
Parameters
hasherhash algorithm to use

◆ insert() [1/3]

void smats::Variables::insert ( const Variable & var)
inline

Inserts a variable var into a set.

Parameters
varvariable to insert

◆ insert() [2/3]

void smats::Variables::insert ( const Variables & vars)
inline

Inserts variables in vars into a set.

Parameters
varsset of variables

◆ insert() [3/3]

template<class InputIt >
void smats::Variables::insert ( InputIt first,
InputIt last )
inline

Inserts variables in the range [first, last) into a set.

Template Parameters
InputIttype of the iterator
Parameters
firstiterator to the beginning

◆ intersect()

Variables smats::Variables::intersect ( const Variables & vars) const
nodiscard

Return the intersection of two sets of variables.

Parameters
varsset of variables
Returns
intersection of two sets of variables

◆ is_strict_subset_of()

bool smats::Variables::is_strict_subset_of ( const Variables & vars) const
nodiscard

Check whether the this set of variables is strict subset of vars.

Parameters
varsvariable set to compare against
Returns
true if the this set of variables is strict subset of vars
false if the this set of variables is not strict subset of vars

◆ is_strict_superset_of()

bool smats::Variables::is_strict_superset_of ( const Variables & vars) const
nodiscard

Check whether the this set of variables is strict superset of vars.

Parameters
varsvariable set to compare against
Returns
true if the this set of variables is strict superset of vars
false if the this set of variables is not strict superset of vars

◆ is_subset_of()

bool smats::Variables::is_subset_of ( const Variables & vars) const
nodiscard

Check whether the this set of variables is subset of vars.

Parameters
varsvariable set to compare against
Returns
true if the this set of variables is subset of vars
false if the this set of variables is not subset of vars

◆ is_superset_of()

bool smats::Variables::is_superset_of ( const Variables & vars) const
nodiscard

Check whether the this set of variables is superset of vars.

Parameters
varsvariable set to compare against
Returns
true if the this set of variables is superset of vars
false if the this set of variables is not superset of vars

◆ rbegin() [1/2]

reverse_iterator smats::Variables::rbegin ( )
inline

Get read-only access to the reverse iterator to the beginning of the set.

Returns
reverse iterator to the beginning of the set

◆ rbegin() [2/2]

const_reverse_iterator smats::Variables::rbegin ( ) const
inlinenodiscard

Get read-only access to the reverse const iterator to the beginning of the set.

Returns
reverse const iterator to the beginning of the set

◆ rend() [1/2]

reverse_iterator smats::Variables::rend ( )
inline

Get read-only access to the reverse iterator to the end of the set.

Returns
reverse iterator to the end of the set

◆ rend() [2/2]

const_reverse_iterator smats::Variables::rend ( ) const
inlinenodiscard

Get read-only access to the reverse const iterator to the end of the set.

Returns
reverse const iterator to the end of the set

◆ size()

size_type smats::Variables::size ( ) const
inlinenodiscard

Get read-only access to the number of variables of the set.

Returns
number of variables of the set

The documentation for this class was generated from the following files: