Use 'const formula*' instead of 'formula*' everywhere.

The distinction makes no sense since Spot 0.5, where we switched from
mutable furmulae to immutable formulae.  The difference between
const_visitor and visitor made no sense either.  They have been merged
into one: visitor.

* iface/dve2/dve2check.cc, iface/gspn/ltlgspn.cc,
src/eltlparse/eltlparse.yy, src/eltlparse/public.hh,
src/evtgbatest/ltl2evtgba.cc, src/kripkeparse/kripkeparse.yy,
src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlast/automatop.cc, src/ltlast/automatop.hh, src/ltlast/binop.cc,
src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh,
src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/formula.cc,
src/ltlast/formula.hh, src/ltlast/formula_tree.cc,
src/ltlast/formula_tree.hh, src/ltlast/multop.cc,
src/ltlast/multop.hh, src/ltlast/predecl.hh, src/ltlast/refformula.cc,
src/ltlast/refformula.hh, src/ltlast/unop.cc, src/ltlast/unop.hh,
src/ltlast/visitor.hh, src/ltlenv/declenv.cc, src/ltlenv/declenv.hh,
src/ltlenv/defaultenv.cc, src/ltlenv/defaultenv.hh,
src/ltlenv/environment.hh, src/ltlparse/ltlfile.cc,
src/ltlparse/ltlfile.hh, src/ltlparse/ltlparse.yy,
src/ltlparse/public.hh, src/ltltest/consterm.cc,
src/ltltest/equals.cc, src/ltltest/genltl.cc, src/ltltest/kind.cc,
src/ltltest/length.cc, src/ltltest/randltl.cc, src/ltltest/readltl.cc,
src/ltltest/reduc.cc, src/ltltest/syntimpl.cc,
src/ltltest/tostring.cc, src/ltlvisit/apcollect.cc,
src/ltlvisit/apcollect.hh, src/ltlvisit/clone.cc,
src/ltlvisit/clone.hh, src/ltlvisit/contain.cc,
src/ltlvisit/contain.hh, src/ltlvisit/dotty.cc,
src/ltlvisit/length.cc, src/ltlvisit/lunabbrev.cc,
src/ltlvisit/lunabbrev.hh, src/ltlvisit/mark.cc, src/ltlvisit/mark.hh,
src/ltlvisit/nenoform.cc, src/ltlvisit/nenoform.hh,
src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh,
src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh,
src/ltlvisit/reduce.cc, src/ltlvisit/reduce.hh,
src/ltlvisit/simpfg.cc, src/ltlvisit/simpfg.hh,
src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh,
src/ltlvisit/snf.cc, src/ltlvisit/snf.hh, src/ltlvisit/tostring.cc,
src/ltlvisit/tunabbrev.cc, src/ltlvisit/tunabbrev.hh,
src/ltlvisit/wmunabbrev.cc, src/ltlvisit/wmunabbrev.hh,
src/neverparse/neverclaimparse.yy, src/sabatest/sabacomplementtgba.cc,
src/tgba/bdddict.cc, src/tgba/formula2bdd.cc, src/tgba/taatgba.cc,
src/tgba/taatgba.hh, src/tgbaalgos/eltl2tgba_lacim.cc,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_lacim.cc, src/tgbaalgos/minimize.cc,
src/tgbaalgos/randomgraph.cc, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/ltl2tgba.cc,
src/tgbatest/ltlprod.cc, src/tgbatest/mixprod.cc,
src/tgbatest/randtgba.cc: Massive adjustment!
* src/tgbatest/reductgba.cc: Delete.
This commit is contained in:
Alexandre Duret-Lutz 2012-05-01 23:38:55 +02:00
parent 0f0ada825a
commit bf62d439c9
98 changed files with 1318 additions and 1535 deletions

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 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.
//
@ -71,13 +72,7 @@ namespace spot
}
void
atomic_prop::accept(visitor& v)
{
v.visit(this);
}
void
atomic_prop::accept(const_visitor& v) const
atomic_prop::accept(visitor& v) const
{
v.visit(this);
}
@ -96,18 +91,19 @@ namespace spot
atomic_prop::map atomic_prop::instances;
atomic_prop*
const atomic_prop*
atomic_prop::instance(const std::string& name, environment& env)
{
pair p(name, &env);
// FIXME: Use lower_bound, or a hash_map.
map::iterator i = instances.find(p);
const atomic_prop* ap;
if (i != instances.end())
{
return static_cast<atomic_prop*>(i->second->clone());
}
atomic_prop* ap = new atomic_prop(name, env);
instances[p] = ap;
return static_cast<atomic_prop*>(ap->clone());
ap = i->second;
else
ap = instances[p] = new atomic_prop(name, env);
ap->clone();
return ap;
}
unsigned

View file

@ -45,10 +45,10 @@ namespace spot
public:
/// Build an atomic proposition with name \a name in
/// environment \a env.
static atomic_prop* instance(const std::string& name, environment& env);
static const atomic_prop*
instance(const std::string& name, environment& env);
virtual void accept(visitor& visitor);
virtual void accept(const_visitor& visitor) const;
virtual void accept(visitor& visitor) const;
/// Get the name of the atomic proposition.
const std::string& name() const;
@ -68,7 +68,7 @@ namespace spot
virtual ~atomic_prop();
typedef std::pair<std::string, environment*> pair;
typedef std::map<pair, atomic_prop*> map;
typedef std::map<pair, const atomic_prop*> map;
static map instances;
private:

View file

@ -1,5 +1,6 @@
// Copyright (C) 2008, 2009, 2010, 2011 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE)
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2010, 2011, 2012 Laboratoire de Recherche
// et Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
//
@ -84,36 +85,34 @@ namespace spot
}
void
automatop::accept(visitor& v)
{
v.visit(this);
}
void
automatop::accept(const_visitor& v) const
automatop::accept(visitor& v) const
{
v.visit(this);
}
automatop::map automatop::instances;
automatop*
const automatop*
automatop::instance(const nfa::ptr nfa, vec* v, bool negated)
{
assert(nfa != 0);
triplet p(std::make_pair(nfa, negated), v);
map::iterator i = instances.find(p);
const automatop* res;
if (i != instances.end())
{
// The instance already exists.
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
(*vi)->destroy();
delete v;
return static_cast<automatop*>(i->second->clone());
res = i->second;
}
automatop* res = new automatop(nfa, v, negated);
instances[p] = res;
return static_cast<automatop*>(res->clone());
else
{
res = instances[p] = new automatop(nfa, v, negated);
}
res->clone();
return res;
}
unsigned
@ -128,12 +127,6 @@ namespace spot
return (*children_)[n];
}
formula*
automatop::nth(unsigned n)
{
return (*children_)[n];
}
const spot::ltl::nfa::ptr
automatop::get_nfa() const
{
@ -165,6 +158,5 @@ namespace spot
}
return os;
}
}
}

View file

@ -1,5 +1,6 @@
// Copyright (C) 2008, 2009 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE)
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
//
@ -40,7 +41,7 @@ namespace spot
{
public:
/// List of formulae.
typedef std::vector<formula*> vec;
typedef std::vector<const formula*> vec;
/// \brief Build a spot::ltl::automatop with many children.
///
@ -48,11 +49,10 @@ namespace spot
/// the caller should allocate it with \c new, but not use it
/// (especially not destroy it) after it has been passed to
/// spot::ltl::automatop.
static automatop*
static const automatop*
instance(const nfa::ptr nfa, vec* v, bool negated);
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual void accept(visitor& v) const;
/// Get the number of argument.
unsigned size() const;
@ -60,10 +60,6 @@ namespace spot
///
/// Starting with \a n = 0.
const formula* nth(unsigned n) const;
/// \brief Get the nth argument.
///
/// Starting with \a n = 0.
formula* nth(unsigned n);
/// Get the NFA of this operator.
const spot::ltl::nfa::ptr get_nfa() const;
@ -96,7 +92,7 @@ namespace spot
return *p1.second < *p2.second;
}
};
typedef std::map<triplet, automatop*, tripletcmp> map;
typedef std::map<triplet, const automatop*, tripletcmp> map;
static map instances;
automatop(const nfa::ptr, vec* v, bool negated);

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 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.
//
@ -34,7 +35,7 @@ namespace spot
{
namespace ltl
{
binop::binop(type op, formula* first, formula* second)
binop::binop(type op, const formula* first, const formula* second)
: ref_formula(BinOp), op_(op), first_(first), second_(second)
{
// Beware: (f U g) is a pure eventuality if both operands
@ -270,13 +271,7 @@ namespace spot
}
void
binop::accept(visitor& v)
{
v.visit(this);
}
void
binop::accept(const_visitor& v) const
binop::accept(visitor& v) const
{
v.visit(this);
}
@ -287,24 +282,12 @@ namespace spot
return first_;
}
formula*
binop::first()
{
return first_;
}
const formula*
binop::second() const
{
return second_;
}
formula*
binop::second()
{
return second_;
}
binop::type
binop::op() const
{
@ -344,8 +327,8 @@ namespace spot
binop::map binop::instances;
formula*
binop::instance(type op, formula* first, formula* second)
const formula*
binop::instance(type op, const formula* first, const formula* second)
{
// Sort the operands of commutative operators, so that for
// example the formula instance for 'a xor b' is the same as
@ -544,17 +527,22 @@ namespace spot
pairf pf(first, second);
pair p(op, pf);
// FIXME: Use lower_bound or hash_map.
map::iterator i = instances.find(p);
const binop* res;
if (i != instances.end())
{
// This instance already exists.
first->destroy();
second->destroy();
return static_cast<binop*>(i->second->clone());
res = i->second;
}
binop* ap = new binop(op, first, second);
instances[p] = ap;
return static_cast<binop*>(ap->clone());
else
{
res = instances[p] = new binop(op, first, second);
}
res->clone();
return res;
}
unsigned

View file

@ -106,19 +106,16 @@ namespace spot
/// - [*0] []-> Exp = 1
/// - Exp []-> 1 = 1
/// - boolExp <>-> Exp = !boolExp | Exp
static formula* instance(type op, formula* first, formula* second);
static const formula* instance(type op,
const formula* first,
const formula* second);
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual void accept(visitor& v) const;
/// Get the first operand.
const formula* first() const;
/// Get the first operand.
formula* first();
/// Get the second operand.
const formula* second() const;
/// Get the second operand.
formula* second();
/// Get the type of this operator.
type op() const;
@ -135,18 +132,18 @@ namespace spot
static std::ostream& dump_instances(std::ostream& os);
protected:
typedef std::pair<formula*, formula*> pairf;
typedef std::pair<const formula*, const formula*> pairf;
typedef std::pair<type, pairf> pair;
typedef std::map<pair, binop*> map;
typedef std::map<pair, const binop*> map;
static map instances;
binop(type op, formula* first, formula* second);
binop(type op, const formula* first, const formula* second);
virtual ~binop();
private:
type op_;
formula* first_;
formula* second_;
const formula* first_;
const formula* second_;
};
/// \brief Cast \a f into a binop
@ -154,12 +151,12 @@ namespace spot
/// Cast \a f into a binop iff it is a binop instance. Return 0
/// otherwise. This is faster than \c dynamic_cast.
inline
binop*
is_binop(formula* f)
const binop*
is_binop(const formula* f)
{
if (f->kind() != formula::BinOp)
return 0;
return static_cast<binop*>(f);
return static_cast<const binop*>(f);
}
/// \brief Cast \a f into a binop if it has type \a op.
@ -167,15 +164,13 @@ namespace spot
/// Cast \a f into a binop iff it is a unop instance with operator \a op.
/// Returns 0 otherwise.
inline
binop*
is_binop(formula* f, binop::type op)
const binop*
is_binop(const formula* f, binop::type op)
{
if (f->kind() != formula::BinOp)
return 0;
binop* bo = static_cast<binop*>(f);
if (bo->op() != op)
return 0;
return bo;
if (const binop* bo = is_binop(f))
if (bo->op() == op)
return bo;
return 0;
}
/// \brief Cast \a f into a binop if it has type \a op1 or \a op2.
@ -183,15 +178,12 @@ namespace spot
/// Cast \a f into a binop iff it is a unop instance with operator \a op1 or
/// \a op2. Returns 0 otherwise.
inline
binop*
is_binop(formula* f, binop::type op1, binop::type op2)
const binop*
is_binop(const formula* f, binop::type op1, binop::type op2)
{
if (f->kind() != formula::BinOp)
return 0;
binop* bo = static_cast<binop*>(f);
binop::type op = bo->op();
if (op == op1 || op == op2)
return bo;
if (const binop* bo = is_binop(f))
if (bo->op() == op1 || bo->op() == op2)
return bo;
return 0;
}
@ -199,8 +191,8 @@ namespace spot
///
/// Return 0 otherwise.
inline
binop*
is_U(formula* f)
const binop*
is_U(const formula* f)
{
return is_binop(f, binop::U);
}
@ -209,8 +201,8 @@ namespace spot
///
/// Return 0 otherwise.
inline
binop*
is_M(formula* f)
const binop*
is_M(const formula* f)
{
return is_binop(f, binop::M);
}
@ -219,8 +211,8 @@ namespace spot
///
/// Return 0 otherwise.
inline
binop*
is_R(formula* f)
const binop*
is_R(const formula* f)
{
return is_binop(f, binop::R);
}
@ -229,8 +221,8 @@ namespace spot
///
/// Return 0 otherwise.
inline
binop*
is_W(formula* f)
const binop*
is_W(const formula* f)
{
return is_binop(f, binop::W);
}

View file

@ -33,9 +33,9 @@ namespace spot
{
// Can't build it on startup, because it uses
// constant::true_instance that may not have been built yet...
formula* bunop::one_star_ = 0;
const formula* bunop::one_star_ = 0;
bunop::bunop(type op, formula* child, unsigned min, unsigned max)
bunop::bunop(type op, const formula* child, unsigned min, unsigned max)
: ref_formula(BUnOp), op_(op), child_(child), min_(min), max_(max)
{
props = child->get_props();
@ -95,13 +95,7 @@ namespace spot
}
void
bunop::accept(visitor& v)
{
v.visit(this);
}
void
bunop::accept(const_visitor& v) const
bunop::accept(visitor& v) const
{
v.visit(this);
}
@ -112,12 +106,6 @@ namespace spot
return child_;
}
formula*
bunop::child()
{
return child_;
}
unsigned
bunop::min() const
{
@ -187,8 +175,9 @@ namespace spot
bunop::map bunop::instances;
formula*
bunop::instance(type op, formula* child, unsigned min, unsigned max)
const formula*
bunop::instance(type op, const formula* child,
unsigned min, unsigned max)
{
assert(min <= max);
@ -225,9 +214,8 @@ namespace spot
// - Exp[*i..j][*min..max] = Exp[*i(min)..j(max)]
// if i*(min+1)<=j(min)+1.
if (child->kind() == BUnOp)
if (const bunop* s = is_bunop(child))
{
bunop* s = static_cast<bunop*>(child);
unsigned i = s->min();
unsigned j = s->max();
@ -242,7 +230,7 @@ namespace spot
// (Because i<=j, this entails that the other intervals also
// overlap).
formula* exp = s->child();
const formula* exp = s->child();
if (j == unbounded)
{
min *= i;
@ -283,25 +271,26 @@ namespace spot
child->destroy();
return i->second->clone();
}
bunop* ap = new bunop(op, child, min, max);
instances[p] = ap;
return static_cast<bunop*>(ap->clone());
const bunop* res = instances[p] = new bunop(op, child, min, max);
res->clone();
return res;
}
formula*
bunop::sugar_goto(formula* b, unsigned min, unsigned max)
const formula*
bunop::sugar_goto(const formula* b, unsigned min, unsigned max)
{
assert(b->is_boolean());
// b[->min..max] is implemented as ((!b)[*];b)[*min..max]
formula* s = bunop::instance(bunop::Star,
unop::instance(unop::Not, b->clone()));
const formula* s =
bunop::instance(bunop::Star,
unop::instance(unop::Not, b->clone()));
return bunop::instance(bunop::Star,
multop::instance(multop::Concat, s, b),
min, max);
}
formula*
bunop::sugar_equal(formula* b, unsigned min, unsigned max)
const formula*
bunop::sugar_equal(const formula* b, unsigned min, unsigned max)
{
assert(b->is_boolean());
// b[=0..] = 1[*]
@ -312,12 +301,13 @@ namespace spot
}
// b[=min..max] is implemented as ((!b)[*];b)[*min..max];(!b)[*]
formula* s = bunop::instance(bunop::Star,
unop::instance(unop::Not, b->clone()));
formula* t = bunop::instance(bunop::Star,
multop::instance(multop::Concat,
s->clone(), b),
min, max);
const formula* s =
bunop::instance(bunop::Star,
unop::instance(unop::Not, b->clone()));
const formula* t =
bunop::instance(bunop::Star,
multop::instance(multop::Concat,
s->clone(), b), min, max);
return multop::instance(multop::Concat, t, s);
}

View file

@ -57,10 +57,10 @@ namespace spot
/// These rewriting rules imply that it is not possible to build
/// an LTL formula object that is SYNTACTICALLY equal to one of
/// these left expressions.
static formula* instance(type op,
formula* child,
unsigned min = 0,
unsigned max = unbounded);
static const formula* instance(type op,
const formula* child,
unsigned min = 0,
unsigned max = unbounded);
/// \brief Implement <code>b[->i..j]</code> using the Kleen star.
///
@ -71,9 +71,9 @@ namespace spot
/// [->1..].
///
/// \pre \a child must be a Boolean formula.
static formula* sugar_goto(formula* child,
unsigned min = 1,
unsigned max = unbounded);
static const formula* sugar_goto(const formula* child,
unsigned min = 1,
unsigned max = unbounded);
/// \brief Implement b[=i..j] using the Kleen star.
///
@ -81,17 +81,14 @@ namespace spot
/// <code>((!b)[*];b)[*i..j];(!b)[*]</code>.
///
/// \pre \a child must be a Boolean formula.
static formula* sugar_equal(formula* child,
unsigned min = 0,
unsigned max = unbounded);
static const formula* sugar_equal(const formula* child,
unsigned min = 0,
unsigned max = unbounded);
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual void accept(visitor& v) const;
/// Get the sole operand of this operator.
const formula* child() const;
/// Get the sole operand of this operator.
formula* child();
/// Minimum number of repetition.
unsigned min() const;
@ -122,7 +119,7 @@ namespace spot
/// A global instance is returned, and it should not be
/// destroyed. Remember to clone it if you use it to build a
/// formula.
static formula* one_star()
static const formula* one_star()
{
if (!one_star_)
one_star_ = instance(Star, constant::true_instance());
@ -131,20 +128,20 @@ namespace spot
protected:
typedef std::pair<unsigned, unsigned> pairu;
typedef std::pair<type, formula*> pairo;
typedef std::pair<type, const formula*> pairo;
typedef std::pair<pairo, pairu> pair;
typedef std::map<pair, bunop*> map;
typedef std::map<pair, const bunop*> map;
static map instances;
bunop(type op, formula* child, unsigned min, unsigned max);
bunop(type op, const formula* child, unsigned min, unsigned max);
virtual ~bunop();
private:
type op_;
formula* child_;
const formula* child_;
unsigned min_;
unsigned max_;
static formula* one_star_;
static const formula* one_star_;
};
/// \brief Cast \a f into a bunop.
@ -152,12 +149,12 @@ namespace spot
/// Cast \a f into a bunop iff it is a bunop instance. Return 0
/// otherwise. This is faster than \c dynamic_cast.
inline
bunop*
const bunop*
is_bunop(const formula* f)
{
if (f->kind() != formula::BUnOp)
return 0;
return static_cast<bunop*>(const_cast<formula*>(f));
return static_cast<const bunop*>(f);
}
/// \brief Cast \a f into a bunop if it has type \a op.
@ -165,22 +162,20 @@ namespace spot
/// Cast \a f into a bunop iff it is a bunop instance with operator \a op.
/// Returns 0 otherwise.
inline
bunop*
const bunop*
is_bunop(const formula* f, bunop::type op)
{
if (f->kind() != formula::BUnOp)
return 0;
bunop* bo = static_cast<bunop*>(const_cast<formula*>(f));
if (bo->op() != op)
return 0;
return bo;
if (const bunop* bo = is_bunop(f))
if (bo->op() == op)
return bo;
return 0;
}
/// \brief Cast \a f into a bunop if it is a Star.
///
/// Return 0 otherwise.
inline
bunop*
const bunop*
is_Star(const formula* f)
{
return is_bunop(f, bunop::Star);
@ -190,10 +185,10 @@ namespace spot
///
/// Return 0 otherwise.
inline
bunop*
const bunop*
is_KleenStar(const formula* f)
{
if (bunop* b = is_Star(f))
if (const bunop* b = is_Star(f))
if (b->min() == 0 && b->max() == bunop::unbounded)
return b;
return 0;

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et D<>veloppement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), d<EFBFBD>partement Syst<73>mes R<>partis Coop<6F>ratifs (SRC),
// Universit<EFBFBD> Pierre et Marie Curie.
// 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.
//
@ -106,13 +107,7 @@ namespace spot
}
void
constant::accept(visitor& v)
{
v.visit(this);
}
void
constant::accept(const_visitor& v) const
constant::accept(visitor& v) const
{
v.visit(this);
}

View file

@ -37,8 +37,7 @@ namespace spot
{
public:
enum type { False, True, EmptyWord };
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual void accept(visitor& v) const;
/// Return the value of the constant.
type val() const;
@ -74,12 +73,12 @@ namespace spot
/// Cast \a f into a constant iff it is a constant instance.
/// Return 0 otherwise. This is faster than \c dynamic_cast.
inline
constant*
is_constant(formula* f)
const constant*
is_constant(const formula* f)
{
if (f->kind() != formula::Constant)
return 0;
return static_cast<constant*>(f);
return static_cast<const constant*>(f);
}
}
}

View file

@ -32,11 +32,11 @@ namespace spot
{
size_t formula::max_count = 0;
formula*
const formula*
formula::clone() const
{
const_cast<formula*>(this)->ref_();
return const_cast<formula*>(this);
this->ref_();
return this;
}
formula::~formula()
@ -46,18 +46,18 @@ namespace spot
void
formula::destroy() const
{
if (const_cast<formula*>(this)->unref_())
if (this->unref_())
delete this;
}
void
formula::ref_()
formula::ref_() const
{
// Not reference counted by default.
}
bool
formula::unref_()
formula::unref_() const
{
// Not reference counted by default.
return false;

View file

@ -82,6 +82,7 @@ namespace spot
BUnOp,
AutomatOp };
protected:
formula(opkind k) : count_(max_count++), kind_(k)
{
// If the counter of formulae ever loops, we want to skip the
@ -92,16 +93,15 @@ namespace spot
max_count = 3;
}
/// Entry point for vspot::ltl::visitor instances.
virtual void accept(visitor& v) = 0;
/// Entry point for vspot::ltl::const_visitor instances.
virtual void accept(const_visitor& v) const = 0;
public:
/// Entry point for spot::ltl::visitor instances.
virtual void accept(visitor& v) const = 0;
/// \brief clone this node
///
/// This increments the reference counter of this node (if one is
/// used).
formula* clone() const;
const formula* clone() const;
/// \brief release this node
///
/// This decrements the reference counter of this node (if one is
@ -293,10 +293,10 @@ namespace spot
virtual ~formula();
/// \brief increment reference counter if any
virtual void ref_();
virtual void ref_() const;
/// \brief decrement reference counter if any, return true when
/// the instance must be deleted (usually when the counter hits 0).
virtual bool unref_();
virtual bool unref_() const;
/// \brief The hash key of this formula.
size_t count_;

View file

@ -1,4 +1,5 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -28,8 +29,8 @@ namespace spot
{
namespace formula_tree
{
formula*
instanciate(const node_ptr np, const std::vector<formula*>& v)
const formula*
instanciate(const node_ptr np, const std::vector<const formula*>& v)
{
if (node_atomic* n = dynamic_cast<node_atomic*>(np.get()))
return n->i == True ? constant::true_instance() :

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement
// Copyright (C) 2009, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -76,7 +76,8 @@ namespace spot
/// Instanciate the formula corresponding to the node with
/// atomic propositions taken from \a v.
formula* instanciate(const node_ptr np, const std::vector<formula*>& v);
const formula* instanciate(const node_ptr np,
const std::vector<const formula*>& v);
/// Get the arity.
size_t arity(const node_ptr np);

View file

@ -119,13 +119,7 @@ namespace spot
}
void
multop::accept(visitor& v)
{
v.visit(this);
}
void
multop::accept(const_visitor& v) const
multop::accept(visitor& v) const
{
v.visit(this);
}
@ -142,18 +136,12 @@ namespace spot
return (*children_)[n];
}
formula*
multop::nth(unsigned n)
{
return (*children_)[n];
}
formula*
const formula*
multop::all_but(unsigned n) const
{
unsigned s = size();
vec* v = new vec;
v->reserve(s-1);
v->reserve(s - 1);
for (unsigned pos = 0; pos < n; ++pos)
v->push_back(nth(pos)->clone());
for (unsigned pos = n + 1; pos < s; ++pos)
@ -192,35 +180,37 @@ namespace spot
return 0;
}
void
gather_bool(multop::vec* v, multop::type op)
namespace
{
// Gather all boolean terms.
multop::vec* b = new multop::vec;
multop::vec::iterator i = v->begin();
while (i != v->end())
{
if ((*i)->is_boolean())
{
b->push_back(*i);
i = v->erase(i);
}
else
{
++i;
}
}
// - AndNLM(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
// AndNLM(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
// - AndRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
// AndRat(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
// - OrRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
// AndRat(Exps1...,Exps2...,Exps3...,Or(Bool1,Bool2))
if (!b->empty())
v->push_back(multop::instance(op, b));
else
delete b;
static void
gather_bool(multop::vec* v, multop::type op)
{
// Gather all boolean terms.
multop::vec* b = new multop::vec;
multop::vec::iterator i = v->begin();
while (i != v->end())
{
if ((*i)->is_boolean())
{
b->push_back(*i);
i = v->erase(i);
}
else
{
++i;
}
}
// - AndNLM(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
// AndNLM(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
// - AndRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
// AndRat(Exps1...,Exps2...,Exps3...,And(Bool1,Bool2))
// - OrRat(Exps1...,Bool1,Exps2...,Bool2,Exps3...) =
// AndRat(Exps1...,Exps2...,Exps3...,Or(Bool1,Bool2))
if (!b->empty())
v->push_back(multop::instance(op, b));
else
delete b;
}
}
multop::map multop::instances;
@ -230,7 +220,7 @@ namespace spot
// operator). For instance if `+' designates the OR operator and
// `0' is false (the neutral element for `+') , then `f+f+0' is
// equivalent to `f'.
formula*
const formula*
multop::instance(type op, vec* v)
{
// Inline children of same kind.
@ -252,9 +242,8 @@ namespace spot
i = v->erase(i);
continue;
}
if ((*i)->kind() == MultOp)
if (const multop* p = is_multop(*i))
{
multop* p = static_cast<multop*>(*i);
if (p->op() == op)
{
unsigned ps = p->size();
@ -286,11 +275,11 @@ namespace spot
unsigned orig_size = v->size();
formula* neutral;
formula* neutral2;
formula* abs;
formula* abs2;
formula* weak_abs;
const formula* neutral;
const formula* neutral2;
const formula* abs;
const formula* abs2;
const formula* weak_abs;
switch (op)
{
case And:
@ -343,7 +332,7 @@ namespace spot
// If FExps2... and FExps3 all accept [*0].
{
vec::iterator i = v->begin();
formula* os = bunop::one_star();
const formula* os = bunop::one_star();
while (i != v->end())
{
while (i != v->end() && !(*i)->accepts_eword())
@ -433,7 +422,7 @@ namespace spot
// std::unique(), because we must destroy() any formula we drop.
// Also ignore neutral elements and handle absorbent elements.
{
formula* last = 0;
const formula* last = 0;
vec::iterator i = v->begin();
bool weak_abs_seen = false;
while (i != v->end())
@ -512,11 +501,11 @@ namespace spot
while (i != v->end())
{
vec::iterator fpos = i;
formula* f;
const formula* f;
unsigned min;
unsigned max;
bool changed = false;
if (bunop* is = is_Star(*i))
if (const bunop* is = is_Star(*i))
{
f = is->child();
min = is->min();
@ -531,10 +520,10 @@ namespace spot
++i;
while (i != v->end())
{
formula* f2;
const formula* f2;
unsigned min2;
unsigned max2;
if (bunop* is = is_Star(*i))
if (const bunop* is = is_Star(*i))
{
f2 = is->child();
if (f2 != f)
@ -563,8 +552,8 @@ namespace spot
}
if (changed)
{
formula* newfs = bunop::instance(bunop::Star, f->clone(),
min, max);
const formula* newfs =
bunop::instance(bunop::Star, f->clone(), min, max);
(*fpos)->destroy();
*fpos = newfs;
}
@ -586,7 +575,7 @@ namespace spot
// arguments of a Fusion operator to
// a list with a single formula that
// accepts [*0].
formula* res = (*v)[0];
const formula* res = (*v)[0];
if (op != Fusion || orig_size == 1
|| !res->accepts_eword())
{
@ -600,6 +589,8 @@ namespace spot
// The hash key.
pair p(op, v);
const multop* res;
// FIXME: Use lower_bound or hash_map.
map::iterator i = instances.find(p);
if (i != instances.end())
{
@ -607,19 +598,20 @@ namespace spot
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
(*vi)->destroy();
delete v;
return static_cast<multop*>(i->second->clone());
res = i->second;
}
// This is the first instance of this formula.
// Record the instance in the map,
multop* ap = new multop(op, v);
instances[p] = ap;
return ap->clone();
else
{
// This is the first instance of this formula.
// Record the instance in the map,
res = instances[p] = new multop(op, v);
}
res->clone();
return res;
}
formula*
multop::instance(type op, formula* first, formula* second)
const formula*
multop::instance(type op, const formula* first, const formula* second)
{
vec* v = new vec;
v->push_back(first);

View file

@ -44,7 +44,7 @@ namespace spot
enum type { Or, OrRat, And, AndRat, AndNLM, Concat, Fusion };
/// List of formulae.
typedef std::vector<formula*> vec;
typedef std::vector<const formula*> vec;
/// \brief Build a spot::ltl::multop with two children.
///
@ -57,7 +57,8 @@ namespace spot
/// This functions can perform slight optimizations and
/// may not return an ltl::multop object. See the other
/// instance function for the list of rewritings.
static formula* instance(type op, formula* first, formula* second);
static const formula*
instance(type op, const formula* first, const formula* second);
/// \brief Build a spot::ltl::multop with many children.
///
@ -120,10 +121,9 @@ namespace spot
/// - Fusion(Exp) = Exp
/// - Fusion(Exps1...,BoolExp1...BoolExpN,Exps2,Exps3...) =
/// Fusion(Exps1...,And(BoolExp1...BoolExpN),Exps2,Exps3...)
static formula* instance(type op, vec* v);
static const formula* instance(type op, vec* v);
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual void accept(visitor& v) const;
/// Get the number of children.
unsigned size() const;
@ -131,17 +131,13 @@ namespace spot
///
/// Starting with \a n = 0.
const formula* nth(unsigned n) const;
/// \brief Get the nth child.
///
/// Starting with \a n = 0.
formula* nth(unsigned n);
/// \brief construct a formula without the nth child.
///
/// If the formula \c f is <code>a|b|c|d</code> and <code>d</code>
/// is child number 2, then calling <code>f->all_but(2)</code> will
/// return a new formula <code>a|b|d</code>.
formula* all_but(unsigned n) const;
const formula* all_but(unsigned n) const;
/// Get the type of this operator.
type op() const;
@ -170,7 +166,7 @@ namespace spot
return *p1.second < *p2.second;
}
};
typedef std::map<pair, multop*, paircmp> map;
typedef std::map<pair, const multop*, paircmp> map;
static map instances;
multop(type op, vec* v);
@ -187,12 +183,12 @@ namespace spot
/// Cast \a f into a multop iff it is a multop instance. Return 0
/// otherwise. This is faster than \c dynamic_cast.
inline
multop*
is_multop(formula* f)
const multop*
is_multop(const formula* f)
{
if (f->kind() != formula::MultOp)
return 0;
return static_cast<multop*>(f);
return static_cast<const multop*>(f);
}
/// \brief Cast \a f into a multop if it has type \a op.
@ -200,15 +196,13 @@ namespace spot
/// Cast \a f into a multop iff it is a multop instance with operator \a op.
/// Returns 0 otherwise.
inline
multop*
const multop*
is_multop(const formula* f, multop::type op)
{
if (f->kind() != formula::MultOp)
return 0;
multop* mo = static_cast<multop*>(const_cast<formula*>(f));
if (mo->op() != op)
return 0;
return mo;
if (const multop* mo = is_multop(f))
if (mo->op() == op)
return mo;
return 0;
}
/// \brief Cast \a f into a multop if it has type \a op1 or \a op2.
@ -216,22 +210,20 @@ namespace spot
/// Cast \a f into a multop iff it is a multop instance with
/// operator \a op1 or \a op2. Returns 0 otherwise.
inline
multop*
const multop*
is_multop(const formula* f, multop::type op1, multop::type op2)
{
if (f->kind() != formula::MultOp)
return 0;
multop* mo = static_cast<multop*>(const_cast<formula*>(f));
if (mo->op() != op1 && mo->op() != op2)
return 0;
return mo;
if (const multop* mo = is_multop(f))
if (mo->op() == op1 || mo->op() == op2)
return mo;
return 0;
}
/// \brief Cast \a f into a multop if it is an And.
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_And(const formula* f)
{
return is_multop(f, multop::And);
@ -241,7 +233,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_AndRat(const formula* f)
{
return is_multop(f, multop::AndRat);
@ -251,7 +243,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_AndNLM(const formula* f)
{
return is_multop(f, multop::AndNLM);
@ -261,7 +253,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_Or(const formula* f)
{
return is_multop(f, multop::Or);
@ -271,7 +263,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_OrRat(const formula* f)
{
return is_multop(f, multop::OrRat);
@ -281,7 +273,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_Concat(const formula* f)
{
return is_multop(f, multop::Concat);
@ -291,7 +283,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
multop*
const multop*
is_Fusion(const formula* f)
{
return is_multop(f, multop::Fusion);

View file

@ -1,5 +1,5 @@
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -36,7 +36,6 @@ namespace spot
namespace ltl
{
struct visitor;
struct const_visitor;
class atomic_prop;
class automatop;

View file

@ -1,7 +1,8 @@
// Copyright (C) 2010 Laboratoire de Recherche de Developpement de
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2012 Laboratoire de Recherche de Developpement de
// l'EPITA (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
@ -38,20 +39,20 @@ namespace spot
}
void
ref_formula::ref_()
ref_formula::ref_() const
{
++ref_counter_;
}
bool
ref_formula::unref_()
ref_formula::unref_() const
{
assert(ref_counter_ > 0);
return !--ref_counter_;
}
unsigned
ref_formula::ref_count_()
ref_formula::ref_count_() const
{
return ref_counter_;
}

View file

@ -1,8 +1,9 @@
// Copyright (C) 2010 Laboratoire de Recherche de Developpement de
// l'EPITA (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2012 Laboratoire de Recherche de Developpement
// de l'EPITA (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 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.
//
@ -40,12 +41,12 @@ namespace spot
protected:
virtual ~ref_formula();
ref_formula(opkind k);
void ref_();
bool unref_();
void ref_() const;
bool unref_() const;
/// Number of references to this formula.
unsigned ref_count_();
unsigned ref_count_() const;
private:
unsigned ref_counter_;
mutable unsigned ref_counter_;
};
}

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
// 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.
//
@ -32,7 +33,7 @@ namespace spot
{
namespace ltl
{
unop::unop(type op, formula* child)
unop::unop(type op, const formula* child)
: ref_formula(UnOp), op_(op), child_(child)
{
props = child->get_props();
@ -161,13 +162,7 @@ namespace spot
}
void
unop::accept(visitor& v)
{
v.visit(this);
}
void
unop::accept(const_visitor& v) const
unop::accept(visitor& v) const
{
v.visit(this);
}
@ -178,12 +173,6 @@ namespace spot
return child_;
}
formula*
unop::child()
{
return child_;
}
unop::type
unop::op() const
{
@ -217,8 +206,8 @@ namespace spot
unop::map unop::instances;
formula*
unop::instance(type op, formula* child)
const formula*
unop::instance(type op, const formula* child)
{
// Some trivial simplifications.
@ -227,10 +216,9 @@ namespace spot
case F:
case G:
{
if (child->kind() == UnOp)
if (const unop* u = is_unop(child))
{
// F and G are idempotent.
unop* u = static_cast<unop*>(child);
if (u->op() == op)
return u;
}
@ -258,29 +246,28 @@ namespace spot
return bunop::instance(bunop::Star,
constant::true_instance(), 1);
if (child->kind() == UnOp)
if (const unop* u = is_unop(child))
{
unop* u = static_cast<unop*>(child);
// "Not" is an involution.
if (u->op() == op)
{
formula* c = u->child()->clone();
const formula* c = u->child()->clone();
u->destroy();
return c;
}
// !Closure(Exp) = NegClosure(Exp)
if (u->op() == Closure)
{
formula* c = unop::instance(NegClosure,
u->child()->clone());
const formula* c = unop::instance(NegClosure,
u->child()->clone());
u->destroy();
return c;
}
// !NegClosure(Exp) = Closure(Exp)
if (u->op() == NegClosure)
{
formula* c = unop::instance(Closure,
u->child()->clone());
const formula* c = unop::instance(Closure,
u->child()->clone());
u->destroy();
return c;
}
@ -323,17 +310,21 @@ namespace spot
break;
}
const unop* res;
pair p(op, child);
map::iterator i = instances.find(p);
if (i != instances.end())
{
// This instance already exists.
child->destroy();
return static_cast<unop*>(i->second->clone());
res = i->second;
}
unop* ap = new unop(op, child);
instances[p] = ap;
return static_cast<unop*>(ap->clone());
else
{
res = instances[p] = new unop(op, child);
}
res->clone();
return res;
}
unsigned

View file

@ -87,15 +87,12 @@ namespace spot
/// grammar. Spot cannot read it either. However some
/// BDD-based algorithm may need to negate any constant, so we
/// handle this one as well.
static formula* instance(type op, formula* child);
static const formula* instance(type op, const formula* child);
virtual void accept(visitor& v);
virtual void accept(const_visitor& v) const;
virtual void accept(visitor& v) const;
/// Get the sole operand of this operator.
const formula* child() const;
/// Get the sole operand of this operator.
formula* child();
/// Get the type of this operator.
type op() const;
@ -112,16 +109,16 @@ namespace spot
static std::ostream& dump_instances(std::ostream& os);
protected:
typedef std::pair<type, formula*> pair;
typedef std::map<pair, unop*> map;
typedef std::pair<type, const formula*> pair;
typedef std::map<pair, const unop*> map;
static map instances;
unop(type op, formula* child);
unop(type op, const formula* child);
virtual ~unop();
private:
type op_;
formula* child_;
const formula* child_;
};
@ -130,12 +127,12 @@ namespace spot
/// Cast \a f into a unop iff it is a unop instance. Return 0
/// otherwise. This is faster than \c dynamic_cast.
inline
unop*
const unop*
is_unop(const formula* f)
{
if (f->kind() != formula::UnOp)
return 0;
return static_cast<unop*>(const_cast<formula*>(f));
return static_cast<const unop*>(f);
}
/// \brief Cast \a f into a unop if it has type \a op.
@ -143,22 +140,20 @@ namespace spot
/// Cast \a f into a unop iff it is a unop instance with operator \a op.
/// Returns 0 otherwise.
inline
unop*
const unop*
is_unop(const formula* f, unop::type op)
{
if (f->kind() != formula::UnOp)
return 0;
unop* uo = static_cast<unop*>(const_cast<formula*>(f));
if (uo->op() != op)
return 0;
return uo;
if (const unop* uo = is_unop(f))
if (uo->op() == op)
return uo;
return 0;
}
/// \brief Cast \a f into a unop if it is a Not.
///
/// Return 0 otherwise.
inline
unop*
const unop*
is_Not(const formula* f)
{
return is_unop(f, unop::Not);
@ -168,7 +163,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
unop*
const unop*
is_X(const formula* f)
{
return is_unop(f, unop::X);
@ -178,7 +173,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
unop*
const unop*
is_F(const formula* f)
{
return is_unop(f, unop::F);
@ -188,7 +183,7 @@ namespace spot
///
/// Return 0 otherwise.
inline
unop*
const unop*
is_G(const formula* f)
{
return is_unop(f, unop::G);
@ -198,26 +193,24 @@ namespace spot
///
/// Return 0 otherwise.
inline
unop*
const unop*
is_GF(const formula* f)
{
unop* op = is_G(f);
if (!op)
return 0;
return is_F(op->child());
if (const unop* op = is_G(f))
return is_F(op->child());
return 0;
}
/// \brief Cast \a f into a unop if has the form FG(...).
///
/// Return 0 otherwise.
inline
unop*
const unop*
is_FG(const formula* f)
{
unop* op = is_F(f);
if (!op)
return 0;
return is_G(op->child());
if (const unop* op = is_F(f))
return is_G(op->child());
return 0;
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
// Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -32,38 +32,15 @@ namespace spot
{
namespace ltl
{
/// \brief Formula visitor that can modify the formula.
/// \brief Formula visitor
/// \ingroup ltl_essential
///
/// Writing visitors is the prefered way
/// to traverse a formula, since it doesn't
/// Implementing visitors is the prefered way
/// to traverse a formula, since it does not
/// involve any cast.
///
/// If you do not need to modify the visited formula, inherit from
/// spot::ltl:const_visitor instead.
struct visitor
{
virtual ~visitor() {}
virtual void visit(atomic_prop* node) = 0;
virtual void visit(constant* node) = 0;
virtual void visit(binop* node) = 0;
virtual void visit(unop* node) = 0;
virtual void visit(multop* node) = 0;
virtual void visit(automatop* node) = 0;
virtual void visit(bunop* node) = 0;
};
/// \brief Formula visitor that cannot modify the formula.
///
/// Writing visitors is the prefered way
/// to traverse a formula, since it doesn't
/// involve any cast.
///
/// If you want to modify the visited formula, inherit from
/// spot::ltl:visitor instead.
struct const_visitor
{
virtual ~const_visitor() {}
virtual void visit(const atomic_prop* node) = 0;
virtual void visit(const constant* node) = 0;
virtual void visit(const binop* node) = 0;
@ -72,8 +49,6 @@ namespace spot
virtual void visit(const automatop* node) = 0;
virtual void visit(const bunop* node) = 0;
};
}
}