tgba_digraph: force selection of properties kept on copy

* src/tgba/tgba.hh: Declare a prop_set to specify the types.
* src/tgba/tgbagraph.hh: Use prop_set for all copy constructors.
* iface/ltsmin/ltsmin.cc, src/bin/autfilt.cc, src/bin/randaut.cc,
src/tgbaalgos/are_isomorphic.cc, src/tgbaalgos/closure.cc,
src/tgbaalgos/complete.cc, src/tgbaalgos/degen.cc,
src/tgbaalgos/dotty.cc, src/tgbaalgos/dtgbacomp.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh,
src/tgbaalgos/sccfilter.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/stutterize.cc, src/tgbatest/checkpsl.cc,
src/tgbatest/emptchk.cc, src/tgbatest/ltl2tgba.cc,
wrap/python/spot.i,src/graphtest/tgbagraph.test: Adjust all uses.
This commit is contained in:
Alexandre Duret-Lutz 2014-12-23 19:35:08 +01:00
parent 77cb836e47
commit 87c2b291ed
21 changed files with 309 additions and 162 deletions

View file

@ -29,6 +29,7 @@
#include <memory>
#include <unordered_map>
#include <functional>
#include <array>
#include "misc/casts.hh"
#include "misc/hash.hh"
@ -734,24 +735,45 @@ namespace spot
is.deterministic = val;
}
// This is no default value here on purpose. This way any time we
// add a new property we cannot to update every call to prop_copy().
void prop_copy(const const_tgba_ptr& other,
bool state_based,
bool single_acc,
bool inherently_weak,
bool deterministic)
struct prop_set
{
if (state_based)
bool state_based;
bool single_acc;
bool inherently_weak;
bool deterministic;
static prop_set all()
{
return { true, true, true, true };
}
};
// There is no default value here on purpose. This way any time we
// add a new property we have to update every call to prop_copy().
void prop_copy(const const_tgba_ptr& other, prop_set p)
{
if (p.state_based)
prop_state_based_acc(other->has_state_based_acc());
if (single_acc)
if (p.single_acc)
prop_single_acc_set(other->has_single_acc_set());
if (inherently_weak)
if (p.inherently_weak)
prop_inherently_weak(other->is_inherently_weak());
if (deterministic)
if (p.deterministic)
prop_deterministic(other->is_deterministic());
}
void prop_keep(prop_set p)
{
if (!p.state_based)
prop_state_based_acc(false);
if (!p.single_acc)
prop_single_acc_set(false);
if (!p.inherently_weak)
prop_inherently_weak(false);
if (!p.deterministic)
prop_deterministic(false);
}
};
/// \addtogroup tgba_representation TGBA representations

View file

@ -186,13 +186,13 @@ namespace spot
{
}
explicit tgba_digraph(const const_tgba_digraph_ptr& other)
explicit tgba_digraph(const const_tgba_digraph_ptr& other, prop_set p)
: tgba(other->get_dict()),
g_(other->g_), init_number_(other->init_number_)
{
copy_acceptance_conditions_of(other);
copy_ap_of(other);
prop_copy(other, true, true, true, true);
prop_copy(other, p);
}
virtual ~tgba_digraph()
@ -489,23 +489,26 @@ namespace spot
return std::make_shared<tgba_digraph>(dict);
}
inline tgba_digraph_ptr make_tgba_digraph(const tgba_digraph_ptr& aut)
inline tgba_digraph_ptr make_tgba_digraph(const tgba_digraph_ptr& aut,
tgba::prop_set p)
{
return std::make_shared<tgba_digraph>(aut);
return std::make_shared<tgba_digraph>(aut, p);
}
inline tgba_digraph_ptr make_tgba_digraph(const const_tgba_digraph_ptr& aut)
inline tgba_digraph_ptr make_tgba_digraph(const const_tgba_digraph_ptr& aut,
tgba::prop_set p)
{
return std::make_shared<tgba_digraph>(aut);
return std::make_shared<tgba_digraph>(aut, p);
}
inline tgba_digraph_ptr make_tgba_digraph(const const_tgba_ptr& aut)
inline tgba_digraph_ptr make_tgba_digraph(const const_tgba_ptr& aut,
tgba::prop_set p)
{
auto p = std::dynamic_pointer_cast<const tgba_digraph>(aut);
if (p)
return std::make_shared<tgba_digraph>(p);
auto a = std::dynamic_pointer_cast<const tgba_digraph>(aut);
if (a)
return std::make_shared<tgba_digraph>(a, p);
else
return tgba_dupexp_dfs(aut);
return tgba_dupexp_dfs(aut, p);
}
}