c++11: introduce tgba::succ(s) to replace tgba::succ_iter(s).

| tgba_succ_iterator* i = aut->succ_iter(s);
| for (i->begin(); !i->done(); i->next())
|   {
|      // ...
|   }
| delete i;

becomes

| for (auto i: aut->succ(s))
|   {
|      // ...
|   }

hiding the begin()/done()/next() interface, taking care of the delete,
and allowing more optimization to come.

* src/tgba/succiter.hh, src/tgba/tgba.hh: Implement the above
new interface.
* iface/gspn/ssp.cc, src/dstarparse/nsa2tgba.cc,
src/saba/sabacomplementtgba.cc, src/tgba/tgbakvcomplement.cc,
src/tgba/tgbamask.cc, src/tgba/tgbasafracomplement.cc,
src/tgba/tgbatba.cc, src/tgbaalgos/compsusp.cc, src/tgbaalgos/cutscc.cc,
src/tgbaalgos/degen.cc, src/tgbaalgos/emptiness.cc,
src/tgbaalgos/isdet.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/minimize.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/safety.cc, src/tgbaalgos/simulation.cc,
src/tgbaalgos/tau03.cc, src/tgbatest/explicit2.cc: Update for
loops.
This commit is contained in:
Alexandre Duret-Lutz 2014-01-25 19:48:28 +01:00
parent f59773e3c7
commit 487cd01d9f
21 changed files with 418 additions and 522 deletions

View file

@ -1,4 +1,5 @@
// Copyright (C) 2012 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -38,16 +39,13 @@ create_tgba_explicit_string(bdd_dict* d)
tgba->create_transition(s1, s2);
(void) t;
tgba_explicit_succ_iterator<state_explicit_string>* it
= tgba->succ_iter(tgba->get_init_state());
for (it->first(); !it->done(); it->next())
for (auto it: tgba->succ(tgba->get_init_state()))
{
state_explicit_string* se = it->current_state();
state_explicit_string* se =
down_cast<state_explicit_string*>(it->current_state());
std::cout << se->label() << std::endl;
se->destroy();
}
delete it;
delete tgba;
}
@ -63,16 +61,13 @@ create_tgba_explicit_number(bdd_dict* d)
tgba->create_transition(s1, s2);
(void) t;
tgba_explicit_succ_iterator<state_explicit_number>* it =
tgba->succ_iter(tgba->get_init_state());
for (it->first(); !it->done(); it->next())
for (auto it: tgba->succ(tgba->get_init_state()))
{
state_explicit_number* s = it->current_state();
state_explicit_number* s =
down_cast<state_explicit_number*>(it->current_state());
std::cout << s->label() << std::endl;
s->destroy();
}
delete it;
delete tgba;
}
@ -89,16 +84,13 @@ create_tgba_explicit_formula(bdd_dict* d, spot::ltl::default_environment& e)
tgba->create_transition(s1, s2);
(void) t;
tgba_explicit_succ_iterator<state_explicit_formula>* it =
tgba->succ_iter(tgba->get_init_state());
for (it->first(); !it->done(); it->next())
for (auto it: tgba->succ(tgba->get_init_state()))
{
state_explicit_formula* s = it->current_state();
state_explicit_formula* s =
down_cast<state_explicit_formula*>(it->current_state());
to_string(s->label(), std::cout) << std::endl;
s->destroy();
}
delete it;
delete tgba;
}