Simplify copying of atomic propositions in new tgba_digraph.

* src/tgba/bdddict.cc, src/tgba/bdddict.hh
(register_all_propositions_of): New method.
* src/tgba/tgbagraph.hh (copy_ap_of): New method.
* src/dstarparse/dra2ba.cc, src/dstarparse/nra2nba.cc,
src/dstarparse/nsa2tgba.cc, src/tgbaalgos/degen.cc,
src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/emptiness.cc,
src/tgbaalgos/minimize.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/sccfilter.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/stripacc.cc: Simplify using copy_ap_of.
This commit is contained in:
Alexandre Duret-Lutz 2014-08-13 14:21:16 +02:00
parent 917f70073f
commit 10e5c62386
16 changed files with 65 additions and 61 deletions

View file

@ -245,18 +245,31 @@ namespace spot
bdd_dict::register_all_variables_of(const void* from_other,
const void* for_me)
{
bdd_info_map::iterator i;
for (i = bdd_map.begin(); i != bdd_map.end(); ++i)
auto j = priv_->free_anonymous_list_of.find(from_other);
if (j != priv_->free_anonymous_list_of.end())
priv_->free_anonymous_list_of[for_me] = j->second;
for (auto& i: bdd_map)
{
ref_set& s = i->refs;
ref_set& s = i.refs;
if (s.find(from_other) != s.end())
s.insert(for_me);
}
bdd_dict_priv::free_anonymous_list_of_type::const_iterator j =
priv_->free_anonymous_list_of.find(from_other);
if (j != priv_->free_anonymous_list_of.end())
priv_->free_anonymous_list_of[for_me] = j->second;
}
void
bdd_dict::register_all_propositions_of(const void* from_other,
const void* for_me)
{
for (auto& i: bdd_map)
{
if (i.type != var_type::var)
continue;
ref_set& s = i.refs;
if (s.find(from_other) != s.end())
s.insert(for_me);
}
}
void

View file

@ -169,12 +169,22 @@ namespace spot
/// \brief Duplicate the variable usage of another object.
///
/// This tells this dictionary that the \a for_me object
/// will be using the same BDD variables as the \a from_other objects.
/// This ensure that the variables won't be freed when \a from_other
/// is deleted if \a from_other is still alive.
/// This tells this dictionary that the \a for_me object will be
/// using the same BDD variables as the \a from_other objects.
/// This ensures that the variables won't be freed when \a
/// from_other is deleted if \a from_other is still alive.
void register_all_variables_of(const void* from_other, const void* for_me);
/// \brief Register the same propositions as another object.
///
/// This tells this dictionary that the \a for_me object will be
/// using the same BDD variable used for atomic propositions by
/// the \a from_other object. This ensures that the variables
/// won't be freed when \a from_other is deleted if \a from_other
/// is still alive.
void register_all_propositions_of(const void* from_other,
const void* for_me);
/// \brief Release all variables used by an object.
///
/// Usually called in the destructor if \a me.

View file

@ -351,6 +351,11 @@ namespace spot
set_acceptance_conditions(a->neg_acceptance_conditions());
}
void copy_ap_of(const tgba* a)
{
dict_->register_all_propositions_of(a, this);
}
virtual bdd all_acceptance_conditions() const
{
return all_acceptance_conditions_;