From 3a70b57067718e4560febd5c0e733d6ea78e518c Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 8 Jan 2015 23:05:13 +0100 Subject: [PATCH] projrun: modernize * src/tgbaalgos/emptiness.hh (step): Add constructors... * src/tgbaalgos/projrun.cc: ... to simplify this. --- src/tgbaalgos/emptiness.hh | 10 +++++++++- src/tgbaalgos/projrun.cc | 29 +++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/tgbaalgos/emptiness.hh b/src/tgbaalgos/emptiness.hh index e411498a2..0b3e97a2f 100644 --- a/src/tgbaalgos/emptiness.hh +++ b/src/tgbaalgos/emptiness.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et +// Copyright (C) 2011, 2013, 2014, 2015 Laboratoire de Recherche et // Developpement de l'Epita (LRDE). // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), // département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -270,6 +270,14 @@ namespace spot const state* s; bdd label; acc_cond::mark_t acc; + + step(const state* s, bdd label, acc_cond::mark_t acc) + : s(s), label(label), acc(acc) + { + } + step() + { + } }; typedef std::list steps; diff --git a/src/tgbaalgos/projrun.cc b/src/tgbaalgos/projrun.cc index 278b42b65..79bf35f4b 100644 --- a/src/tgbaalgos/projrun.cc +++ b/src/tgbaalgos/projrun.cc @@ -1,5 +1,8 @@ -// Copyright (C) 2004, 2014 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// -*- coding: utf-8 -*- +// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement +// de l'Epita (LRDE) +// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -30,22 +33,12 @@ namespace spot const const_tgba_run_ptr& run) { auto res = std::make_shared(); - for (tgba_run::steps::const_iterator i = run->prefix.begin(); - i != run->prefix.end(); ++i) - { - tgba_run::step s = { a_run->project_state(i->s, a_proj), - i->label, - i->acc }; - res->prefix.push_back(s); - } - for (tgba_run::steps::const_iterator i = run->cycle.begin(); - i != run->cycle.end(); ++i) - { - tgba_run::step s = { a_run->project_state(i->s, a_proj), - i->label, - i->acc }; - res->cycle.push_back(s); - } + for (auto& i: run->prefix) + res->prefix.emplace_back(a_run->project_state(i.s, a_proj), + i.label, i.acc); + for (auto& i: run->cycle) + res->prefix.emplace_back(a_run->project_state(i.s, a_proj), + i.label, i.acc); return res; } }