* src/tgba/succiter.hh (tgba_succ_iterator::current_state):

Return a state*, not a state_bdd.
* src/tgba/succiterconcrete.hh
(tgba_succ_iterator_concrete::current_state): Return a state_bdd*,
not a state_bdd.
* src/tgba/state.hh (state::as_bdd): New abstract method.
* src/tgba/statebdd.hh (state_bdd::as_bdd): Move definitions ...
* src/tgba/statebdd.cc (state_bdd::as_bdd): ... here.
* src/tgba/tgba.hh: Add Doxygen comments.
(tgba::succ_iter, tgba::get_init_state): Use state*, not state_bdd.
* src/tgba/tgbabddconcrete.hh (tgba_bdd_concrete::get_init_state):
Return a state_bdd*, not a state_bdd.
(tgba_bdd_concrete::get_init_bdd): New method.
(tgba_bdd_concrete::succ_uter): Take a state* as argument.
* src/tgba/tgbabddconcrete.cc: Likewise.
* src/tgba/tgbabddtranslatefactory.cc
(tgba_bdd_translate_factory::tgba_bdd_translate_factory): Use
tgba_bdd_concrete::get_init_bdd.
* src/tgbaalgos/dotty.cc (dotty_state, dotty_rec, dotty): Adjust
to use state* instead of state_bdd.
* src/tgba/succlist.hh: Delete.  (Leftover from a previous
draft.)
This commit is contained in:
Alexandre Duret-Lutz 2003-05-27 10:40:16 +00:00
parent d7e49255d3
commit 3f0e95f061
13 changed files with 139 additions and 64 deletions

View file

@ -1,58 +1,60 @@
#include <map>
#include "tgba/tgba.hh"
#include "dotty.hh"
#include "tgba/bddprint.hh"
namespace spot
{
typedef std::map<int, int> seen_map;
static bool
dotty_state(std::ostream& os,
const tgba& g, state_bdd state, seen_map& m, int& node)
const tgba& g, state* st, seen_map& m, int& node)
{
bdd s = state.as_bdd();
bdd s = st->as_bdd();
seen_map::iterator i = m.find(s.id());
// Already drawn?
if (i != m.end())
{
node = i->second;
return false;
}
node = m.size() + 1;
m[s.id()] = node;
std::cout << " " << node << " [label=\"";
bdd_print_set(os, g.get_dict(), s) << "\"]" << std::endl;
return true;
}
static void
dotty_rec(std::ostream& os,
const tgba& g, state_bdd state, seen_map& m, int father)
const tgba& g, state* st, seen_map& m, int father)
{
tgba_succ_iterator* si = g.succ_iter(state);
tgba_succ_iterator* si = g.succ_iter(st);
for (si->first(); !si->done(); si->next())
{
int node;
state_bdd s = si->current_state();
state* s = si->current_state();
bool recurse = dotty_state(os, g, s, m, node);
os << " " << father << " -> " << node << " [label=\"";
bdd_print_set(os, g.get_dict(), si->current_condition()) << "\\n";
bdd_print_set(os, g.get_dict(), si->current_promise()) << "\"]"
bdd_print_set(os, g.get_dict(), si->current_promise()) << "\"]"
<< std::endl;
if (recurse)
dotty_rec(os, g, s, m, node);
delete s;
}
delete si;
}
std::ostream&
std::ostream&
dotty_reachable(std::ostream& os, const tgba& g)
{
seen_map m;
state_bdd state = g.get_init_state();
state* state = g.get_init_state();
os << "digraph G {" << std::endl;
os << " size=\"7.26,10.69\"" << std::endl;
os << " 0 [label=\"\", style=invis]" << std::endl;
@ -61,6 +63,7 @@ namespace spot
os << " 0 -> " << init << std::endl;
dotty_rec(os, g, state, m, init);
os << "}" << std::endl;
delete state;
return os;
}