Revamp tgbaexplicit.hh

* src/tgba/tgbaexplicit.hh, src/tgba/tgbaexplicit.cc: Factor most of
the code in an explicit_graph<State, Type> that inherits from type.
The tgba_explicit type<State> now inherits from
explicit_graph<State,tgba>.
* src/ltlvisit/contain.cc, src/neverparse/neverclaimparse.yy
src/tgba/tgbareduc.cc, src/tgba/tgbareduc.hh, src/tgbaalgos/cutscc.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh,
src/tgbaalgos/emptiness.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/minimize.cc,
src/tgbaalgos/powerset.cc, src/tgbaalgos/randomgraph.cc,
src/tgbaalgos/sccfilter.cc, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/explicit.cc,
src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc,
src/tgbatest/mixprod.cc, src/tgbatest/powerset.cc,
src/tgbatest/tgbaread.cc, src/tgbatest/tripprod.cc:
Replace tgba_explicit* by the actual type used.
* src/tgbatest/explicit2.cc: New file.
* src/tgbatest/Makefile.am: Add it.
This commit is contained in:
Pierre PARUTTO 2012-03-06 00:13:15 +01:00 committed by Alexandre Duret-Lutz
parent 9e2b932fe6
commit a15aac2845
27 changed files with 810 additions and 708 deletions

View file

@ -74,7 +74,7 @@ namespace spot
{
dst->destroy();
}
tgba_explicit::transition* t =
state_explicit_string::transition* t =
sub_a->create_transition(cur_format, dst_format);
sub_a->add_conditions(t, sit->current_condition());
sub_a->

View file

@ -57,7 +57,7 @@ namespace spot
std::ostringstream out_name;
out_name << "(#" << out << ") " << this->aut_->format_state(out_s);
tgba_explicit::transition* t =
state_explicit_string::transition* t =
out_->create_transition(in_name.str(), out_name.str());
out_->add_conditions(t, si->current_condition());
out_->add_acceptance_conditions(t, si->current_acceptance_conditions());
@ -69,7 +69,7 @@ namespace spot
} // anonymous
tgba_explicit*
tgba_explicit_string*
tgba_dupexp_bfs(const tgba* aut)
{
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut);
@ -77,7 +77,7 @@ namespace spot
return di.result();
}
tgba_explicit*
tgba_explicit_string*
tgba_dupexp_dfs(const tgba* aut)
{
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut);

View file

@ -29,11 +29,11 @@ namespace spot
/// \brief Build an explicit automata from all states of \a aut,
/// numbering states in bread first order as they are processed.
/// \ingroup tgba_misc
tgba_explicit* tgba_dupexp_bfs(const tgba* aut);
tgba_explicit_string* tgba_dupexp_bfs(const tgba* aut);
/// \brief Build an explicit automata from all states of \a aut,
/// numbering states in depth first order as they are processed.
/// \ingroup tgba_misc
tgba_explicit* tgba_dupexp_dfs(const tgba* aut);
tgba_explicit_string* tgba_dupexp_dfs(const tgba* aut);
}
#endif // SPOT_TGBAALGOS_DUPEXP_HH

View file

@ -302,12 +302,12 @@ namespace spot
const state* s = a->get_init_state();
int number = 1;
tgba_explicit::state* source;
tgba_explicit::state* dest;
state_explicit_string* source;
state_explicit_string* dest;
const tgba_run::steps* l;
bdd seen_acc = bddfalse;
typedef Sgi::hash_map<const state*, tgba_explicit::state*,
typedef Sgi::hash_map<const state*, state_explicit_string*,
state_ptr_hash, state_ptr_equal> state_map;
state_map seen;
@ -380,7 +380,8 @@ namespace spot
else
dest = its->second;
tgba_explicit::transition* t = res->create_transition(source, dest);
state_explicit_string::transition* t =
res->create_transition(source, dest);
res->add_conditions(t, label);
res->add_acceptance_conditions(t, acc);
source = dest;

View file

@ -198,7 +198,7 @@ namespace spot
void
conj_bdd_to_acc(tgba_explicit_formula* a, bdd b,
tgba_explicit::transition* t)
state_explicit_formula::transition* t)
{
assert(b != bddfalse);
while (b != bddtrue)
@ -692,7 +692,7 @@ namespace spot
}
tgba_explicit*
tgba_explicit_formula*
ltl_to_tgba_fm(const formula* f, bdd_dict* dict,
bool exprop, bool symb_merge, bool branching_postponement,
bool fair_loop_approx, const atomic_prop_set* unobs,
@ -945,7 +945,7 @@ namespace spot
}
if (!a->has_state(constant::true_instance()))
formulae_to_translate.insert(constant::true_instance());
tgba_explicit::transition* t =
state_explicit_formula::transition* t =
a->create_transition(now, constant::true_instance());
a->add_condition(t, d.bdd_to_formula(cond_for_true));
}
@ -969,7 +969,7 @@ namespace spot
bdd cond = j->second - cond_for_true;
if (cond == bddfalse) // Skip false transitions.
continue;
tgba_explicit::transition* t =
state_explicit_formula::transition* t =
a->create_transition(now, dest);
a->add_condition(t, d.bdd_to_formula(cond));
d.conj_bdd_to_acc(a, j->first, t);

View file

@ -122,12 +122,13 @@ namespace spot
/// \endverbatim
///
/// \return A spot::tgba_explicit that recognizes the language of \a f.
tgba_explicit* ltl_to_tgba_fm(const ltl::formula* f, bdd_dict* dict,
bool exprop = false, bool symb_merge = true,
bool branching_postponement = false,
bool fair_loop_approx = false,
const ltl::atomic_prop_set* unobs = 0,
int reduce_ltl = ltl::Reduce_None);
tgba_explicit_formula*
ltl_to_tgba_fm(const ltl::formula* f, bdd_dict* dict,
bool exprop = false, bool symb_merge = true,
bool branching_postponement = false,
bool fair_loop_approx = false,
const ltl::atomic_prop_set* unobs = 0,
int reduce_ltl = ltl::Reduce_None);
}
#endif // SPOT_TGBAALGOS_LTL2TGBA_FM_HH

View file

@ -131,7 +131,7 @@ namespace spot
state_num[*hit] = num;
++num;
}
typedef tgba_explicit_number::transition trs;
typedef state_explicit_number::transition trs;
tgba_explicit_number* res = new tgba_explicit_number(a->get_dict());
// For each transition in the initial automaton, add the corresponding
// transition in res.

View file

@ -89,7 +89,7 @@ namespace spot
// Add that transition.
power_set::const_iterator i = seen.find(dest);
int dest_num;
tgba_explicit::transition* t;
state_explicit_number::transition* t;
if (i != seen.end())
{
dest_num = i->second;

View file

@ -53,8 +53,9 @@ namespace spot
}
void
random_labels(tgba_explicit* aut,
tgba_explicit::state* src, const tgba_explicit::state* dest,
random_labels(tgba_explicit_string* aut,
state_explicit_string* src,
const state_explicit_string* dest,
int* props, int props_n, float t,
const std::list<bdd>& accs, float a)
{
@ -84,7 +85,7 @@ namespace spot
if (drand() < a)
ac |= *i;
tgba_explicit::transition* u = aut->create_transition(src, dest);
state_explicit_string::transition* u = aut->create_transition(src, dest);
aut->add_conditions(u, p);
aut->add_acceptance_conditions(u, ac);
}
@ -107,7 +108,7 @@ namespace spot
i != ap->end(); ++i)
props[pi++] = dict->register_proposition(*i, res);
std::vector<tgba_explicit::state*> states(n);
std::vector<state_explicit_string*> states(n);
// Indirect access to state[] to help random selection of successors.
std::vector<int> state_randomizer(n);
@ -153,7 +154,7 @@ namespace spot
while (!nodes_to_process.empty())
{
tgba_explicit::state* src = states[*nodes_to_process.begin()];
state_explicit_string* src = states[*nodes_to_process.begin()];
nodes_to_process.erase(nodes_to_process.begin());
// Choose a random number of successors (at least one), using
@ -195,7 +196,7 @@ namespace spot
state_randomizer[index] = state_randomizer[possibilities];
state_randomizer[possibilities] = x;
tgba_explicit::state* dest = states[x];
state_explicit_string* dest = states[x];
random_labels(res, src, dest, props, props_n, t, accs, a);

View file

@ -30,7 +30,7 @@ namespace spot
namespace
{
static
tgba_explicit::transition*
state_explicit_string::transition*
create_transition(const tgba* aut, tgba_explicit_string* out_aut,
const state* in_s, int in,
const state* out_s, int out)
@ -43,7 +43,7 @@ namespace spot
}
static
tgba_explicit::transition*
state_explicit_formula::transition*
create_transition(const tgba* aut, tgba_explicit_formula* out_aut,
const state* in_s, int, const state* out_s, int)
{
@ -62,6 +62,8 @@ namespace spot
class filter_iter: public tgba_reachable_iterator_depth_first
{
public:
typedef T output_t;
filter_iter(const tgba* a,
const scc_map& sm,
const std::vector<bool>& useless,
@ -94,7 +96,7 @@ namespace spot
const state* out_s, int out,
const tgba_succ_iterator* si)
{
tgba_explicit::transition* t =
typename output_t::state::transition* t =
create_transition(this->aut_, out_, in_s, in, out_s, out);
out_->add_conditions(t, si->current_condition());