Make it easier to convert acc-conditions to associated formulae.

This is motivated by the fact that sog-its used the low-level data
structures used by the bdd_dict to do such work, and broke because of
the recent changes in this area.

* src/tgba/bdddict.cc, src/tgba/bdddict.hh (oneacc_to_formula):
New method.
* src/tgbaalgos/save.cc: Use it.
This commit is contained in:
Alexandre Duret-Lutz 2012-05-22 17:57:12 +02:00
parent 8893f34da1
commit ebf4d2585d
3 changed files with 49 additions and 22 deletions

View file

@ -159,7 +159,6 @@ namespace spot
register_acceptance_variables(bdd_low(f), for_me);
}
int
bdd_dict::register_clone_acc(int v, const void* for_me)
{
@ -178,6 +177,26 @@ namespace spot
return res;
}
const ltl::formula*
bdd_dict::oneacc_to_formula(int var) const
{
assert(unsigned(var) < bdd_map.size());
const bdd_info& i = bdd_map[var];
assert(i.type == acc);
return i.f;
}
const ltl::formula*
bdd_dict::oneacc_to_formula(bdd oneacc) const
{
assert(oneacc != bddfalse);
while (bdd_high(oneacc) == bddfalse)
{
oneacc = bdd_low(oneacc);
assert(oneacc != bddfalse);
}
return oneacc_to_formula(bdd_var(oneacc));
}
int
bdd_dict::register_anonymous_variables(int n, const void* for_me)

View file

@ -148,6 +148,27 @@ namespace spot
/// automaton).
void register_acceptance_variables(bdd f, const void* for_me);
/// \brief 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 \a oneacc are unregistered.
const ltl::formula* oneacc_to_formula(bdd oneacc) const;
/// \brief 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 \a var is unregistered.
const ltl::formula* oneacc_to_formula(int var) const;
/// \brief Register anonymous BDD variables.
///
/// Return (and maybe allocate) \a n consecutive BDD variables which