From 603c5d603be9180b22c1a9a1e2e5f14d13e12baf Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sat, 31 Mar 2012 17:25:53 +0200 Subject: [PATCH] tgba_explicit: make the new class work with Swig. * src/tgba/tgbaexplicit.hh (explicit_graph, tgba_explicit): Make the transition type explicit. (state_explicit_string::get_iterator): New method. (explicit_graph::get_transition): Use it. (tba): Rename as ... (sba): ... this. * wrap/python/spot.i: Instanciate explicit_graph and tgba_explicit for all three types. --- src/tgba/tgbaexplicit.hh | 18 ++++++++++++------ wrap/python/spot.i | 10 ++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/tgba/tgbaexplicit.hh b/src/tgba/tgbaexplicit.hh index f3c1a3837..66b153319 100644 --- a/src/tgba/tgbaexplicit.hh +++ b/src/tgba/tgbaexplicit.hh @@ -56,10 +56,10 @@ namespace spot } }; - class tba: public tgba + class sba: public tgba { public: - /// A State in a TBA (Transition based Buchi Automaton) is accepting + /// A State in an SBA (State-based Buchi Automaton) is accepting /// iff all outgoing transitions are accepting. virtual bool is_accepting(const spot::state* s) = 0; }; @@ -275,6 +275,12 @@ namespace spot return it_->acceptance_conditions & all_acceptance_conditions_; } + typename State::transitions_t::const_iterator + get_iterator() const + { + return it_; + } + private: const State* start_; typename State::transitions_t::const_iterator it_; @@ -291,9 +297,10 @@ namespace spot typename State::label_hash_t> ls_map; typedef Sgi::hash_map > sl_map; - typedef typename State::transition transition; public: + typedef typename State::transition transition; + explicit_graph(bdd_dict* dict) : ls_(), sl_(), @@ -336,7 +343,7 @@ namespace spot transition* get_transition(const tgba_explicit_succ_iterator* si) { - return const_cast(&(*(si->i_))); + return const_cast(&(*(si->get_iterator()))); } void add_condition(transition* t, const ltl::formula* f) @@ -537,9 +544,8 @@ namespace spot template class tgba_explicit: public explicit_graph { - protected: - typedef typename State::transition transition; public: + typedef typename State::transition transition; typedef State state; tgba_explicit(bdd_dict* dict): diff --git a/wrap/python/spot.i b/wrap/python/spot.i index fa8ad89cf..00a5d30b4 100644 --- a/wrap/python/spot.i +++ b/wrap/python/spot.i @@ -203,6 +203,16 @@ using namespace spot; %include "tgba/tgbaproduct.hh" %include "tgba/tgbatba.hh" +%template(explicit_graph__string_tgba) + spot::explicit_graph; +%template(explicit_graph__number_tgba) + spot::explicit_graph; +%template(explicit_graph__formula_tgba) + spot::explicit_graph; +%template(tgba_explicit__string) spot::tgba_explicit; +%template(tgba_explicit__number) spot::tgba_explicit; +%template(tgba_explicit__formula) spot::tgba_explicit; + %include "tgbaalgos/dottydec.hh" %include "tgbaalgos/dotty.hh" %include "tgbaalgos/dupexp.hh"