rename src/ as spot/ and use include <spot/...>
* NEWS: Mention the change. * src/: Rename as ... * spot/: ... this, adjust all headers to include <spot/...> instead of "...", and adjust all Makefile.am to search headers from the top-level directory. * HACKING: Add conventions about #include. * spot/sanity/style.test: Add a few more grep to catch cases that do not follow these conventions. * .gitignore, Makefile.am, README, bench/stutter/Makefile.am, bench/stutter/stutter_invariance_formulas.cc, bench/stutter/stutter_invariance_randomgraph.cc, configure.ac, debian/rules, doc/Doxyfile.in, doc/Makefile.am, doc/org/.dir-locals.el.in, doc/org/g++wrap.in, doc/org/init.el.in, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut03.org, doc/org/tut10.org, doc/org/tut20.org, doc/org/tut21.org, doc/org/tut22.org, doc/org/tut30.org, iface/ltsmin/Makefile.am, iface/ltsmin/kripke.test, iface/ltsmin/ltsmin.cc, iface/ltsmin/ltsmin.hh, iface/ltsmin/modelcheck.cc, wrap/python/Makefile.am, wrap/python/ajax/spotcgi.in, wrap/python/spot_impl.i, wrap/python/tests/ltl2tgba.py, wrap/python/tests/randgen.py, wrap/python/tests/run.in: Adjust.
This commit is contained in:
parent
1fddfe60ec
commit
f120dd3206
529 changed files with 1308 additions and 1262 deletions
34
spot/kripke/Makefile.am
Normal file
34
spot/kripke/Makefile.am
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
## Copyright (C) 2009, 2011, 2013, 2014, 2015 Laboratoire de Recherche
|
||||
## et Developpement de l'Epita (LRDE).
|
||||
##
|
||||
## 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) $(BUDDY_CPPFLAGS)
|
||||
AM_CXXFLAGS = $(WARNING_CXXFLAGS)
|
||||
|
||||
kripkedir = $(pkgincludedir)/kripke
|
||||
|
||||
kripke_HEADERS = \
|
||||
fairkripke.hh \
|
||||
fwd.hh \
|
||||
kripke.hh \
|
||||
kripkegraph.hh
|
||||
|
||||
noinst_LTLIBRARIES = libkripke.la
|
||||
libkripke_la_SOURCES = \
|
||||
fairkripke.cc \
|
||||
kripke.cc
|
||||
57
spot/kripke/fairkripke.cc
Normal file
57
spot/kripke/fairkripke.cc
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2010, 2014 Laboratoire de Recherche et
|
||||
// Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <spot/kripke/fairkripke.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
fair_kripke_succ_iterator::fair_kripke_succ_iterator
|
||||
(const bdd& cond, acc_cond::mark_t acc_cond)
|
||||
: cond_(cond), acc_cond_(acc_cond)
|
||||
{
|
||||
}
|
||||
|
||||
fair_kripke_succ_iterator::~fair_kripke_succ_iterator()
|
||||
{
|
||||
}
|
||||
|
||||
bdd
|
||||
fair_kripke_succ_iterator::cond() const
|
||||
{
|
||||
// Do not assert(!done()) here. It is OK to call
|
||||
// this function on a state without successor.
|
||||
return cond_;
|
||||
}
|
||||
|
||||
acc_cond::mark_t
|
||||
fair_kripke_succ_iterator::acc() const
|
||||
{
|
||||
// Do not assert(!done()) here. It is OK to call
|
||||
// this function on a state without successor.
|
||||
return acc_cond_;
|
||||
}
|
||||
|
||||
bdd
|
||||
fair_kripke::compute_support_conditions(const state* s) const
|
||||
{
|
||||
return state_condition(s);
|
||||
}
|
||||
|
||||
}
|
||||
108
spot/kripke/fairkripke.hh
Normal file
108
spot/kripke/fairkripke.hh
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2010, 2013, 2014, 2015 Laboratoire de Recherche et
|
||||
// Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spot/twa/twa.hh>
|
||||
#include <spot/kripke/fwd.hh>
|
||||
|
||||
/// \addtogroup kripke Kripke Structures
|
||||
/// \ingroup twa
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// \ingroup kripke
|
||||
/// \brief Iterator code for a Fair Kripke structure.
|
||||
///
|
||||
/// This iterator can be used to simplify the writing
|
||||
/// of an iterator on a Fair Kripke structure (or lookalike).
|
||||
///
|
||||
/// If you inherit from this iterator, you should only
|
||||
/// redefine
|
||||
///
|
||||
/// - fair_kripke_succ_iterator::first()
|
||||
/// - fair_kripke_succ_iterator::next()
|
||||
/// - fair_kripke_succ_iterator::done()
|
||||
/// - fair_kripke_succ_iterator::dst()
|
||||
///
|
||||
/// This class implements fair_kripke_succ_iterator::cond(),
|
||||
/// and fair_kripke_succ_iterator::acc().
|
||||
class SPOT_API fair_kripke_succ_iterator : public twa_succ_iterator
|
||||
{
|
||||
public:
|
||||
/// \brief Constructor
|
||||
///
|
||||
/// The \a cond and \a acc_cond arguments will be those returned
|
||||
/// by fair_kripke_succ_iterator::cond(),
|
||||
/// and fair_kripke_succ_iterator::acc().
|
||||
fair_kripke_succ_iterator(const bdd& cond, acc_cond::mark_t acc_cond);
|
||||
virtual ~fair_kripke_succ_iterator();
|
||||
|
||||
virtual bdd cond() const;
|
||||
virtual acc_cond::mark_t acc() const;
|
||||
protected:
|
||||
bdd cond_;
|
||||
acc_cond::mark_t acc_cond_;
|
||||
};
|
||||
|
||||
/// \ingroup kripke
|
||||
/// \brief Interface for a Fair Kripke structure.
|
||||
///
|
||||
/// A Kripke structure is a graph in which each node (=state) is
|
||||
/// labeled by a conjunction of atomic proposition, and a set of
|
||||
/// acceptance conditions.
|
||||
///
|
||||
/// Such a structure can be seen as spot::tgba by pushing all labels
|
||||
/// to the outgoing transitions.
|
||||
///
|
||||
/// A programmer that develops an instance of Fair Kripke structure
|
||||
/// needs just provide an implementation for the following methods:
|
||||
///
|
||||
/// - kripke::get_init_state()
|
||||
/// - kripke::succ_iter()
|
||||
/// - kripke::state_condition()
|
||||
/// - kripke::state_acceptance_conditions()
|
||||
/// - kripke::format_state()
|
||||
/// - and optionally kripke::transition_annotation()
|
||||
///
|
||||
/// The other methods of the tgba interface are supplied by this
|
||||
/// class and need not be defined.
|
||||
///
|
||||
/// See also spot::fair_kripke_succ_iterator.
|
||||
class SPOT_API fair_kripke: public twa
|
||||
{
|
||||
public:
|
||||
fair_kripke(const bdd_dict_ptr& d)
|
||||
: twa(d)
|
||||
{
|
||||
}
|
||||
|
||||
/// \brief The condition that label the state \a s.
|
||||
///
|
||||
/// This should be a conjunction of atomic propositions.
|
||||
virtual bdd state_condition(const state* s) const = 0;
|
||||
|
||||
/// \brief The set of acceptance conditions that label the state \a s.
|
||||
virtual acc_cond::mark_t
|
||||
state_acceptance_conditions(const state* s) const = 0;
|
||||
|
||||
protected:
|
||||
virtual bdd compute_support_conditions(const state* s) const;
|
||||
};
|
||||
}
|
||||
37
spot/kripke/fwd.hh
Normal file
37
spot/kripke/fwd.hh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
|
||||
// l'Epita (LRDE).
|
||||
//
|
||||
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
class fair_kripke;
|
||||
typedef std::shared_ptr<fair_kripke> fair_kripke_ptr;
|
||||
typedef std::shared_ptr<const fair_kripke> const_fair_kripke_ptr;
|
||||
|
||||
class kripke;
|
||||
typedef std::shared_ptr<const kripke> const_kripke_ptr;
|
||||
typedef std::shared_ptr<kripke> tgba_kripke_ptr;
|
||||
|
||||
class kripke_explicit;
|
||||
typedef std::shared_ptr<const kripke_explicit> const_kripke_explicit_ptr;
|
||||
typedef std::shared_ptr<kripke_explicit> kripke_explicit_ptr;
|
||||
}
|
||||
54
spot/kripke/kripke.cc
Normal file
54
spot/kripke/kripke.cc
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2010, 2014 Laboratoire de Recherche et
|
||||
// Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <spot/kripke/kripke.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
kripke_succ_iterator::~kripke_succ_iterator()
|
||||
{
|
||||
}
|
||||
|
||||
bdd
|
||||
kripke_succ_iterator::cond() const
|
||||
{
|
||||
// Do not assert(!done()) here. It is OK to call
|
||||
// this function on a state without successor.
|
||||
return cond_;
|
||||
}
|
||||
|
||||
acc_cond::mark_t
|
||||
kripke_succ_iterator::acc() const
|
||||
{
|
||||
// Do not assert(!done()) here. It is OK to call
|
||||
// this function on a state without successor.
|
||||
return 0U;
|
||||
}
|
||||
|
||||
kripke::~kripke()
|
||||
{
|
||||
}
|
||||
|
||||
acc_cond::mark_t
|
||||
kripke::state_acceptance_conditions(const state*) const
|
||||
{
|
||||
return 0U;
|
||||
}
|
||||
}
|
||||
106
spot/kripke/kripke.hh
Normal file
106
spot/kripke/kripke.hh
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2009, 2010, 2013, 2014 Laboratoire de Recherche et
|
||||
// Developpement 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <spot/kripke/fairkripke.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
||||
/// \ingroup kripke
|
||||
/// \brief Iterator code for Kripke structure
|
||||
///
|
||||
/// This iterator can be used to simplify the writing
|
||||
/// of an iterator on a Kripke structure (or lookalike).
|
||||
///
|
||||
/// If you inherit from this iterator, you should only
|
||||
/// redefine
|
||||
///
|
||||
/// - kripke_succ_iterator::first()
|
||||
/// - kripke_succ_iterator::next()
|
||||
/// - kripke_succ_iterator::done()
|
||||
/// - kripke_succ_iterator::dst()
|
||||
///
|
||||
/// This class implements kripke_succ_iterator::cond(),
|
||||
/// and kripke_succ_iterator::acc().
|
||||
class SPOT_API kripke_succ_iterator : public twa_succ_iterator
|
||||
{
|
||||
public:
|
||||
/// \brief Constructor
|
||||
///
|
||||
/// The \a cond argument will be the one returned
|
||||
/// by kripke_succ_iterator::cond().
|
||||
kripke_succ_iterator(const bdd& cond)
|
||||
: cond_(cond)
|
||||
{
|
||||
}
|
||||
|
||||
void recycle(const bdd& cond)
|
||||
{
|
||||
cond_ = cond;
|
||||
}
|
||||
|
||||
virtual ~kripke_succ_iterator();
|
||||
|
||||
virtual bdd cond() const;
|
||||
virtual acc_cond::mark_t acc() const;
|
||||
protected:
|
||||
bdd cond_;
|
||||
};
|
||||
|
||||
/// \ingroup kripke
|
||||
/// \brief Interface for a Kripke structure
|
||||
///
|
||||
/// A Kripke structure is a graph in which each node (=state) is
|
||||
/// labeled by a conjunction of atomic proposition.
|
||||
///
|
||||
/// Such a structure can be seen as spot::tgba without
|
||||
/// any acceptance condition.
|
||||
///
|
||||
/// A programmer that develops an instance of Kripke structure needs
|
||||
/// just provide an implementation for the following methods:
|
||||
///
|
||||
/// - kripke::get_init_state()
|
||||
/// - kripke::succ_iter()
|
||||
/// - kripke::state_condition()
|
||||
/// - kripke::format_state()
|
||||
/// - and optionally kripke::transition_annotation()
|
||||
///
|
||||
/// The other methods of the tgba interface (like those dealing with
|
||||
/// acceptance conditions) are supplied by this kripke class and
|
||||
/// need not be defined.
|
||||
///
|
||||
/// See also spot::kripke_succ_iterator.
|
||||
class SPOT_API kripke: public fair_kripke
|
||||
{
|
||||
public:
|
||||
kripke(const bdd_dict_ptr& d)
|
||||
: fair_kripke(d)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~kripke();
|
||||
|
||||
virtual acc_cond::mark_t state_acceptance_conditions(const state*) const;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<kripke> kripke_ptr;
|
||||
typedef std::shared_ptr<const kripke> const_kripke_ptr;
|
||||
}
|
||||
282
spot/kripke/kripkegraph.hh
Normal file
282
spot/kripke/kripkegraph.hh
Normal file
|
|
@ -0,0 +1,282 @@
|
|||
// -*- coding: utf-8 -*-
|
||||
// Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche
|
||||
// et Développement de l'Epita (LRDE)
|
||||
//
|
||||
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iosfwd>
|
||||
#include <spot/kripke/kripke.hh>
|
||||
#include <spot/graph/graph.hh>
|
||||
#include <spot/tl/formula.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
/// \brief Concrete class for kripke_graph states.
|
||||
struct SPOT_API kripke_graph_state: public spot::state
|
||||
{
|
||||
public:
|
||||
kripke_graph_state(bdd cond = bddfalse) noexcept
|
||||
: cond_(cond)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~kripke_graph_state() noexcept
|
||||
{
|
||||
}
|
||||
|
||||
virtual int compare(const spot::state* other) const
|
||||
{
|
||||
auto o = down_cast<const kripke_graph_state*>(other);
|
||||
assert(o);
|
||||
|
||||
// Do not simply return "other - this", it might not fit in an int.
|
||||
if (o < this)
|
||||
return -1;
|
||||
if (o > this)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual size_t hash() const
|
||||
{
|
||||
return
|
||||
reinterpret_cast<const char*>(this) - static_cast<const char*>(nullptr);
|
||||
}
|
||||
|
||||
virtual kripke_graph_state*
|
||||
clone() const
|
||||
{
|
||||
return const_cast<kripke_graph_state*>(this);
|
||||
}
|
||||
|
||||
virtual void destroy() const
|
||||
{
|
||||
}
|
||||
|
||||
bdd cond() const
|
||||
{
|
||||
return cond_;
|
||||
}
|
||||
|
||||
void cond(bdd c)
|
||||
{
|
||||
cond_ = c;
|
||||
}
|
||||
|
||||
private:
|
||||
bdd cond_;
|
||||
};
|
||||
|
||||
template<class Graph>
|
||||
class SPOT_API kripke_graph_succ_iterator final: public kripke_succ_iterator
|
||||
{
|
||||
private:
|
||||
typedef typename Graph::edge edge;
|
||||
typedef typename Graph::state_data_t state;
|
||||
const Graph* g_;
|
||||
edge t_;
|
||||
edge p_;
|
||||
public:
|
||||
kripke_graph_succ_iterator(const Graph* g,
|
||||
const typename Graph::state_storage_t* s):
|
||||
kripke_succ_iterator(s->cond()),
|
||||
g_(g),
|
||||
t_(s->succ)
|
||||
{
|
||||
}
|
||||
|
||||
~kripke_graph_succ_iterator()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void recycle(const typename Graph::state_storage_t* s)
|
||||
{
|
||||
cond_ = s->cond();
|
||||
t_ = s->succ;
|
||||
}
|
||||
|
||||
virtual bool first()
|
||||
{
|
||||
p_ = t_;
|
||||
return p_;
|
||||
}
|
||||
|
||||
virtual bool next()
|
||||
{
|
||||
p_ = g_->edge_storage(p_).next_succ;
|
||||
return p_;
|
||||
}
|
||||
|
||||
virtual bool done() const
|
||||
{
|
||||
return !p_;
|
||||
}
|
||||
|
||||
virtual kripke_graph_state* dst() const
|
||||
{
|
||||
assert(!done());
|
||||
return const_cast<kripke_graph_state*>
|
||||
(&g_->state_data(g_->edge_storage(p_).dst));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// \class kripke_graph
|
||||
/// \brief Kripke Structure.
|
||||
class SPOT_API kripke_graph : public kripke
|
||||
{
|
||||
public:
|
||||
typedef digraph<kripke_graph_state, void> graph_t;
|
||||
typedef graph_t::edge_storage_t edge_storage_t;
|
||||
protected:
|
||||
graph_t g_;
|
||||
mutable unsigned init_number_;
|
||||
public:
|
||||
kripke_graph(const bdd_dict_ptr& d)
|
||||
: kripke(d), init_number_(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~kripke_graph()
|
||||
{
|
||||
get_dict()->unregister_all_my_variables(this);
|
||||
}
|
||||
|
||||
unsigned num_states() const
|
||||
{
|
||||
return g_.num_states();
|
||||
}
|
||||
|
||||
unsigned num_edges() const
|
||||
{
|
||||
return g_.num_edges();
|
||||
}
|
||||
|
||||
void set_init_state(graph_t::state s)
|
||||
{
|
||||
assert(s < num_states());
|
||||
init_number_ = s;
|
||||
}
|
||||
|
||||
graph_t::state get_init_state_number() const
|
||||
{
|
||||
if (num_states() == 0)
|
||||
const_cast<graph_t&>(g_).new_state();
|
||||
return init_number_;
|
||||
}
|
||||
|
||||
virtual const kripke_graph_state* get_init_state() const
|
||||
{
|
||||
if (num_states() == 0)
|
||||
const_cast<graph_t&>(g_).new_state();
|
||||
return state_from_number(init_number_);
|
||||
}
|
||||
|
||||
/// \brief Allow to get an iterator on the state we passed in
|
||||
/// parameter.
|
||||
virtual kripke_graph_succ_iterator<graph_t>*
|
||||
succ_iter(const spot::state* st) const
|
||||
{
|
||||
auto s = down_cast<const typename graph_t::state_storage_t*>(st);
|
||||
assert(s);
|
||||
assert(!s->succ || g_.valid_trans(s->succ));
|
||||
|
||||
if (this->iter_cache_)
|
||||
{
|
||||
auto it =
|
||||
down_cast<kripke_graph_succ_iterator<graph_t>*>(this->iter_cache_);
|
||||
it->recycle(s);
|
||||
this->iter_cache_ = nullptr;
|
||||
return it;
|
||||
}
|
||||
return new kripke_graph_succ_iterator<graph_t>(&g_, s);
|
||||
|
||||
}
|
||||
|
||||
graph_t::state
|
||||
state_number(const state* st) const
|
||||
{
|
||||
auto s = down_cast<const typename graph_t::state_storage_t*>(st);
|
||||
assert(s);
|
||||
return s - &g_.state_storage(0);
|
||||
}
|
||||
|
||||
const kripke_graph_state*
|
||||
state_from_number(graph_t::state n) const
|
||||
{
|
||||
return &g_.state_data(n);
|
||||
}
|
||||
|
||||
kripke_graph_state*
|
||||
state_from_number(graph_t::state n)
|
||||
{
|
||||
return &g_.state_data(n);
|
||||
}
|
||||
|
||||
std::string format_state(unsigned n) const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << n;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
virtual std::string format_state(const state* st) const
|
||||
{
|
||||
return format_state(state_number(st));
|
||||
}
|
||||
|
||||
/// \brief Get the condition on the state
|
||||
virtual bdd state_condition(const state* s) const
|
||||
{
|
||||
return down_cast<const kripke_graph_state*>(s)->cond();
|
||||
}
|
||||
|
||||
edge_storage_t& edge_storage(unsigned t)
|
||||
{
|
||||
return g_.edge_storage(t);
|
||||
}
|
||||
|
||||
const edge_storage_t edge_storage(unsigned t) const
|
||||
{
|
||||
return g_.edge_storage(t);
|
||||
}
|
||||
|
||||
unsigned new_state(bdd cond)
|
||||
{
|
||||
return g_.new_state(cond);
|
||||
}
|
||||
|
||||
unsigned new_states(unsigned n, bdd cond)
|
||||
{
|
||||
return g_.new_states(n, cond);
|
||||
}
|
||||
|
||||
unsigned new_edge(unsigned src, unsigned dst)
|
||||
{
|
||||
return g_.new_edge(src, dst);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<kripke_graph> kripke_graph_ptr;
|
||||
|
||||
inline kripke_graph_ptr
|
||||
make_kripke_graph(const bdd_dict_ptr& d)
|
||||
{
|
||||
return std::make_shared<kripke_graph>(d);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue