Implement spot::future_conditions_collector.

* src/tgba/futurecondcol.hh, src/tgba/futurecondcol.cc:
New files.
* src/tgba/Makefile.am: Adjust.
* src/tgbatest/ltl2tgba.cc: Add option -FC.
This commit is contained in:
Alexandre Duret-Lutz 2009-05-28 17:42:52 +02:00
parent a375972f5c
commit d74578ef6e
5 changed files with 270 additions and 1 deletions

93
src/tgba/futurecondcol.hh Normal file
View file

@ -0,0 +1,93 @@
// Copyright (C) 2009 Laboratoire de recherche et développement de l'Epita.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#ifndef SPOT_TGBA_FUTURECONDCOL_HH
# define SPOT_TGBA_FUTURECONDCOL_HH
#include "tgbaexplicit.hh"
#include "tgbaalgos/scc.hh"
namespace spot
{
/// \brief Wrap a tgba to offer information about upcoming conditions.
/// \ingroup tgba
///
/// This class is a spot::tgba wrapper that simply add a new method,
/// future_conditions(), to any spot::tgba.
///
/// This new methods returns a set of conditions that can be
/// seen on a transitions accessible (maybe indirectly) from
/// the given state.
class future_conditions_collector : public tgba
{
public:
typedef scc_map::cond_set cond_set;
typedef std::vector<cond_set> fc_map;
/// \brief Create a future_conditions_collector wrapper for \a aut.
///
/// If \a show is set to true, then the format_state() method will
/// include the set of conditions computed for the given state in
/// its output string.
future_conditions_collector(const tgba* aut, bool show = false);
virtual ~future_conditions_collector();
const cond_set& future_conditions(const spot::state* s) const;
/// \brief Format a state for output.
///
/// If the constructor was called with \a show set to true, then
/// this method will include the set of conditions computed for \a
/// state by future_conditions() in the output string.
virtual std::string format_state(const state* state) const;
// The following methods simply delegate their work to the wrapped
// tgba.
virtual state* get_init_state() const;
virtual tgba_succ_iterator*
succ_iter(const state* local_state,
const state* global_state = 0,
const tgba* global_automaton = 0) const;
virtual bdd_dict* get_dict() const;
virtual std::string
transition_annotation(const tgba_succ_iterator* t) const;
virtual state* project_state(const state* s, const tgba* t) const;
virtual bdd all_acceptance_conditions() const;
virtual bdd neg_acceptance_conditions() const;
virtual bdd compute_support_conditions(const state* state) const;
virtual bdd compute_support_variables(const state* state) const;
private:
void map_builder_(unsigned s);
const tgba* aut_; // The wrapped TGBA.
fc_map future_conds_; // The map of future conditions for each
// strongly connected component.
scc_map scc_map_; // SCC informations.
bool show_; // Wether to show future conditions
// in the output of format_state().
};
}
#endif // SPOT_TGBA_FUTURECONDCOL_HH