spot
1.99.4
|
Map BDD variables to formulae. More...
#include <twa/bdddict.hh>
Classes | |
struct | bdd_info |
Public Types | |
enum | var_type { anon = 0, var, acc } |
typedef std::map< formula, int > | fv_map |
Formula-to-BDD-variable maps. More... | |
typedef std::map< int, formula > | vf_map |
BDD-variable-to-formula maps. More... | |
typedef std::set< const void * > | ref_set |
BDD-variable reference counts. More... | |
typedef std::vector< bdd_info > | bdd_info_map |
Public Member Functions | |
~bdd_dict () | |
Destroy the BDD dict. More... | |
formula | oneacc_to_formula (bdd oneacc) const |
Convert one acceptance condition into the associated formula. More... | |
formula | oneacc_to_formula (int var) const |
Convert one acceptance condition into the associated formula. More... | |
void | unregister_all_my_variables (const void *me) |
Release all variables used by an object. More... | |
std::ostream & | dump (std::ostream &os) const |
Dump all variables for debugging. More... | |
void | assert_emptiness () const |
Make sure the dictionary is empty. More... | |
int | register_proposition (formula f, const void *for_me) |
Register an atomic proposition. More... | |
template<typename T > | |
int | register_proposition (formula f, std::shared_ptr< T > for_me) |
int | has_registered_proposition (formula f, const void *me) |
whether a proposition has already been registered More... | |
template<typename T > | |
int | has_registered_proposition (formula f, std::shared_ptr< T > for_me) |
int | register_acceptance_variable (formula f, const void *for_me) |
Register an acceptance variable. More... | |
template<typename T > | |
int | register_acceptance_variable (formula f, std::shared_ptr< T > for_me) |
void | register_acceptance_variables (bdd f, const void *for_me) |
Register BDD variables as acceptance variables. More... | |
template<typename T > | |
void | register_acceptance_variables (bdd f, std::shared_ptr< T > for_me) |
int | register_anonymous_variables (int n, const void *for_me) |
Register anonymous BDD variables. More... | |
template<typename T > | |
int | register_anonymous_variables (int n, std::shared_ptr< T > for_me) |
void | register_all_variables_of (const void *from_other, const void *for_me) |
Duplicate the variable usage of another object. More... | |
template<typename T > | |
void | register_all_variables_of (const void *from_other, std::shared_ptr< T > for_me) |
template<typename T > | |
void | register_all_variables_of (std::shared_ptr< T > from_other, const void *for_me) |
template<typename T , typename U > | |
void | register_all_variables_of (std::shared_ptr< T > from_other, std::shared_ptr< U > for_me) |
void | register_all_propositions_of (const void *from_other, const void *for_me) |
Register the same propositions as another object. More... | |
template<typename T > | |
void | register_all_propositions_of (const void *from_other, std::shared_ptr< T > for_me) |
template<typename T > | |
void | register_all_propositions_of (std::shared_ptr< T > from_other, const void *for_me) |
template<typename T , typename U > | |
void | register_all_propositions_of (std::shared_ptr< T > from_other, std::shared_ptr< U > for_me) |
void | unregister_all_typed_variables (var_type type, const void *me) |
Release all variables of a given type, used by an object. More... | |
template<typename T > | |
void | unregister_all_typed_variables (var_type type, std::shared_ptr< T > me) |
void | unregister_variable (int var, const void *me) |
Release a variable used by me. More... | |
template<typename T > | |
void | unregister_variable (int var, std::shared_ptr< T > me) |
Public Attributes | |
fv_map | var_map |
Maps atomic propositions to BDD variables. More... | |
fv_map | acc_map |
Maps acceptance conditions to BDD variables. More... | |
bdd_info_map | bdd_map |
Map BDD variables to formulae.
The BDD library uses integers to designate Boolean variables in its decision diagrams. This class is used to map such integers to objects actually used in Spot. These objects are usually atomic propositions, but they can also be acceptance conditions.
When a BDD variable is registered using a bdd_dict, it is always associated to a "user" (or "owner") object. This is done by supplying the bdd_dict with a pointer to the intended user of the variable. When the user object dies, it should release the BDD variables it was using by calling (for instance) unregister_all_my_variables(), giving the same pointer. Variables can also by unregistered one by one using unregister_variable().
typedef std::map<formula, int> spot::bdd_dict::fv_map |
Formula-to-BDD-variable maps.
typedef std::set<const void*> spot::bdd_dict::ref_set |
BDD-variable reference counts.
typedef std::map<int, formula> spot::bdd_dict::vf_map |
BDD-variable-to-formula maps.
spot::bdd_dict::~bdd_dict | ( | ) |
Destroy the BDD dict.
This always calls assert_emptiness() to diagnose cases where variables have not been unregistered.
void spot::bdd_dict::assert_emptiness | ( | ) | const |
Make sure the dictionary is empty.
This will print diagnostics if the dictionary is not empty. Use for debugging. This is called automatically by the destructor. When Spot is compiled in development mode (i.e., with ./configure –enable-devel
), this function will abort if the dictionary is not empty.
The errors detected by this function usually indicate missing calls to unregister_variable() or unregister_all_my_variables().
std::ostream& spot::bdd_dict::dump | ( | std::ostream & | os | ) | const |
Dump all variables for debugging.
os | The output stream. |
int spot::bdd_dict::has_registered_proposition | ( | formula | f, |
const void * | me | ||
) |
whether a proposition has already been registered
If f has been registered for me, this returns a non-negative value that is the BDD variable number. Otherwise this returns -1.
formula spot::bdd_dict::oneacc_to_formula | ( | bdd | oneacc | ) | const |
Convert one acceptance condition into the associated formula.
This version accepts a conjunction of Acc variables, in which only one must be positive. This positive variable will be converted back into the associated formula.
The returned formula is not cloned, and is valid until the BDD variable used in oneacc are unregistered.
formula spot::bdd_dict::oneacc_to_formula | ( | int | var | ) | const |
Convert one acceptance condition into the associated formula.
This version takes the number of a BDD variable that must has been returned by a call to register_acceptance_variable().
The returned formula is not cloned, and is valid until the BDD variable var is unregistered.
int spot::bdd_dict::register_acceptance_variable | ( | formula | f, |
const void * | for_me | ||
) |
Register an acceptance variable.
Return (and maybe allocate) a BDD variable designating an acceptance set associated to formula f. The for_me argument should point to the object using this BDD variable, this is used for reference counting. It is perfectly safe to call this function several time with the same arguments.
void spot::bdd_dict::register_acceptance_variables | ( | bdd | f, |
const void * | for_me | ||
) |
Register BDD variables as acceptance variables.
Register all variables occurring in f as acceptance variables used by for_me. This assumes that these acceptance variables are already known from the dictionary (i.e., they have already been registered by register_acceptance_variable() for another automaton).
void spot::bdd_dict::register_all_propositions_of | ( | const void * | from_other, |
const void * | for_me | ||
) |
Register the same propositions as another object.
This tells this dictionary that the for_me object will be using the same BDD variable used for atomic propositions by the from_other object. This ensures that the variables won't be freed when from_other is deleted if from_other is still alive.
void spot::bdd_dict::register_all_variables_of | ( | const void * | from_other, |
const void * | for_me | ||
) |
Duplicate the variable usage of another object.
This tells this dictionary that the for_me object will be using the same BDD variables as the from_other objects. This ensures that the variables won't be freed when from_other is deleted if from_other is still alive.
int spot::bdd_dict::register_anonymous_variables | ( | int | n, |
const void * | for_me | ||
) |
Register anonymous BDD variables.
Return (and maybe allocate) n consecutive BDD variables which will be used only by for_me.
int spot::bdd_dict::register_proposition | ( | formula | f, |
const void * | for_me | ||
) |
Register an atomic proposition.
Return (and maybe allocate) a BDD variable designating formula f. The for_me argument should point to the object using this BDD variable, this is used for reference counting. It is perfectly safe to call this function several time with the same arguments.
void spot::bdd_dict::unregister_all_my_variables | ( | const void * | me | ) |
Release all variables used by an object.
Usually called in the destructor if me.
void spot::bdd_dict::unregister_all_typed_variables | ( | var_type | type, |
const void * | me | ||
) |
Release all variables of a given type, used by an object.
void spot::bdd_dict::unregister_variable | ( | int | var, |
const void * | me | ||
) |
Release a variable used by me.
fv_map spot::bdd_dict::acc_map |
Maps acceptance conditions to BDD variables.
fv_map spot::bdd_dict::var_map |
Maps atomic propositions to BDD variables.