* src/ltlast/atomic_prop.hh, src/ltlast/binop.hh,
src/ltlast/constant.hh, src/ltlast/formula.hh, src/ltlast/multop.hh, src/ltlast/unop.hh, src/ltlast/visitor.hh, src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh, src/ltlparse/public.hh, src/ltlvisit/clone.hh, src/ltlvisit/dotty.hh, src/ltlvisit/dump.hh, src/ltlvisit/equals.hh, src/ltlvisit/lunabbrev.hh, src/ltlvisit/nenoform.hh, src/ltlvisit/tunabbrev.hh: Add Doxygen comments. * src/visitor.hh: Do not use const_sel. This clarify the code and helps Doxygen.
This commit is contained in:
parent
4b8b02e811
commit
d35817ccd9
19 changed files with 239 additions and 51 deletions
|
|
@ -9,17 +9,22 @@ namespace spot
|
|||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
|
||||
/// Atomic propositions.
|
||||
class atomic_prop : public formula
|
||||
{
|
||||
public:
|
||||
/// Build an atomic proposition with name \a name in
|
||||
/// environment \a env.
|
||||
atomic_prop(const std::string& name, environment& env);
|
||||
virtual ~atomic_prop();
|
||||
|
||||
virtual void accept(visitor& visitor);
|
||||
virtual void accept(const_visitor& visitor) const;
|
||||
|
||||
/// Get the name of the atomic proposition.
|
||||
const std::string& name() const;
|
||||
/// Get the environment of the atomic proposition.
|
||||
environment& env() const;
|
||||
private:
|
||||
std::string name_;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@ namespace spot
|
|||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
|
||||
/// Binary operator.
|
||||
class binop : public formula
|
||||
{
|
||||
public:
|
||||
// And and Or are not here. Because they
|
||||
// are often nested we represent them as multops.
|
||||
/// Different kinds of binary opertaors
|
||||
///
|
||||
/// And and Or are not here. Because they
|
||||
/// are often nested we represent them as multops.
|
||||
enum type { Xor, Implies, Equiv, U, R };
|
||||
|
||||
binop(type op, formula* first, formula* second);
|
||||
|
|
@ -21,12 +24,18 @@ namespace spot
|
|||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_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;
|
||||
/// Get the type of this operator, as a string.
|
||||
const char* op_name() const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ namespace spot
|
|||
{
|
||||
namespace ltl
|
||||
{
|
||||
|
||||
|
||||
/// A constant (True or False)
|
||||
class constant : public formula
|
||||
{
|
||||
public:
|
||||
|
|
@ -19,10 +20,9 @@ namespace spot
|
|||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
||||
const formula* child() const;
|
||||
formula* child();
|
||||
|
||||
/// Return the value of the constant.
|
||||
type val() const;
|
||||
/// Return the value of the constant as a string.
|
||||
const char* val_name() const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ namespace spot
|
|||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief An LTL formula.
|
||||
///
|
||||
/// The only way you can work with a formula is to
|
||||
/// build a spot::ltl::visitor or spot::ltl::const_visitor.
|
||||
class formula
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -9,15 +9,30 @@ namespace spot
|
|||
namespace ltl
|
||||
{
|
||||
|
||||
/// \brief Multi-operand operators.
|
||||
///
|
||||
/// These operators are considered commutative and associative.
|
||||
class multop : public formula
|
||||
{
|
||||
public:
|
||||
enum type { Or, And };
|
||||
|
||||
multop::multop(type op);
|
||||
// A multop usually has at least two arguments.
|
||||
/// \brief Build a spot::ltl::multop with no child.
|
||||
///
|
||||
/// This has little value unless you call multop::add later.
|
||||
multop(type op);
|
||||
/// \brief Build a spot::ltl::multop with two children.
|
||||
///
|
||||
/// If one of the children itself is a spot::ltl::multop
|
||||
/// with the same type, it will be merged. I.e., children
|
||||
/// if that child will be added, and that child itself will
|
||||
/// be destroyed.
|
||||
multop(type op, formula* first, formula* second);
|
||||
// More arguments can be added.
|
||||
/// \brief Add another child to this operator.
|
||||
///
|
||||
/// If \a f itself is a spot::ltl::multop with the same type, it
|
||||
/// will be merged. I.e., children of \a f will be added, and
|
||||
/// that \a f will will be destroyed.
|
||||
void add(formula* f);
|
||||
|
||||
virtual ~multop();
|
||||
|
|
@ -25,11 +40,20 @@ namespace spot
|
|||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_visitor& v) const;
|
||||
|
||||
/// Get the number of children.
|
||||
unsigned size() const;
|
||||
/// \brief Get the nth children.
|
||||
///
|
||||
/// Starting with \a n = 0.
|
||||
const formula* nth(unsigned n) const;
|
||||
/// \brief Get the nth children.
|
||||
///
|
||||
/// Starting with \a n = 0.
|
||||
formula* nth(unsigned n);
|
||||
|
||||
/// Get the type of this operator.
|
||||
type op() const;
|
||||
/// Get the type of this operator, as a string.
|
||||
const char* op_name() const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ namespace spot
|
|||
namespace ltl
|
||||
{
|
||||
|
||||
/// Unary operator.
|
||||
class unop : public formula
|
||||
{
|
||||
public:
|
||||
|
|
@ -19,10 +20,14 @@ namespace spot
|
|||
virtual void accept(visitor& v);
|
||||
virtual void accept(const_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;
|
||||
/// Get the type of this operator, as a string.
|
||||
const char* op_name() const;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -2,29 +2,44 @@
|
|||
# define SPOT_LTLAST_VISITOR_HH
|
||||
|
||||
#include "predecl.hh"
|
||||
#include "misc/const_sel.hh"
|
||||
|
||||
namespace spot {
|
||||
namespace ltl {
|
||||
|
||||
template <bool WantConst>
|
||||
struct generic_visitor
|
||||
/// \brief Formula visitor that can modify the formula.
|
||||
///
|
||||
/// Writing visitors is the prefered way
|
||||
/// to traverse a formula, since it doesn't
|
||||
/// involve any cast.
|
||||
///
|
||||
/// If you do not need to modify the visited formula, inherit from
|
||||
/// spot::ltl:const_visitor instead.
|
||||
struct visitor
|
||||
{
|
||||
virtual void visit(typename const_sel<atomic_prop, WantConst>::t* node)
|
||||
= 0;
|
||||
|
||||
virtual void visit(typename const_sel<constant, WantConst>::t* node)
|
||||
= 0;
|
||||
|
||||
virtual void visit(typename const_sel<binop, WantConst>::t* node) = 0;
|
||||
|
||||
virtual void visit(typename const_sel<unop, WantConst>::t* node) = 0;
|
||||
|
||||
virtual void visit(typename const_sel<multop, WantConst>::t* node) = 0;
|
||||
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;
|
||||
};
|
||||
|
||||
/// \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 void visit(const atomic_prop* node) = 0;
|
||||
virtual void visit(const constant* node) = 0;
|
||||
virtual void visit(const binop* node) = 0;
|
||||
virtual void visit(const unop* node) = 0;
|
||||
virtual void visit(const multop* node) = 0;
|
||||
};
|
||||
|
||||
struct visitor : public generic_visitor<false> {};
|
||||
struct const_visitor : public generic_visitor<true> {};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue