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,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -36,8 +36,8 @@ namespace spot
{
~succ_iter_filtered()
{
for (first(); !done(); next())
it_->dest->destroy();
for (auto& t: trans_)
t.dest->destroy();
}
void first()
@ -138,15 +138,11 @@ namespace spot
tgba_succ_iterator*
tgba_mask::succ_iter(const state* local_state,
const state* global_state,
const tgba* global_automaton) const
const state*,
const tgba*) const
{
tgba_succ_iterator* it = original_->succ_iter(local_state,
global_state,
global_automaton);
succ_iter_filtered* res = new succ_iter_filtered;
for (it->first(); !it->done(); it->next())
for (auto it: original_->succ(local_state))
{
const state* s = it->current_state();
if (!wanted(s))
@ -159,7 +155,6 @@ namespace spot
it->current_acceptance_conditions() };
res->trans_.push_back(t);
}
delete it;
return res;
}