* src/ltlast/atomic_prop.hh: Declare instance_count(). * src/ltlast/binop.hh, src/ltlast/unop.hh, src/ltlast/multop.hh: Likewise. Also, really inherit for ref_formula this time. * src/ltlast/atomic_prop.cc, src/ltlast/binop.cc, src/ltlast/unop.cc, src/ltlast/multop.cc: On destruction, suppress the instance from the instance map. Implement instance_count(). * src/ltlast/formula.cc, src/ltlast/formula.hh, src/ltlast/ref_formula.cc, src/ltlast/ref_formula.hh: Add virtual destructors. * src/ltlparse/ltlparse.yy: Recover from binary operators with missing right hand operand (the point is just to destroy the the left hand operand). * src/ltltest/equals.cc, src/ltltest/readltl.cc, src/ltltest/tostring.cc: Destroy used formulae. Make sure instance_count()s are null are the end. * src/ltltest/parseerr.test: Adjust expected result, now that the parser lnows about missing right hand operands. * src/ltlvisit/destroy.hh, src/ltlvisit/destroy.cc, src/ltlvisit/postfix.hh, src/ltlvisit/postfix.cc: New files. * src/ltlvisit/Makefile.am (libltlvisit_la_SOURCES): Add them. * src/ltlvisit/lunabbrev.cc (Xor, Equiv): Clone formulae occurring twice in the rewritten expression.
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#ifndef SPOT_LTLAST_UNOP_HH
|
|
# define SPOT_LTLAST_UNOP_HH
|
|
|
|
#include <map>
|
|
#include "refformula.hh"
|
|
|
|
namespace spot
|
|
{
|
|
namespace ltl
|
|
{
|
|
|
|
/// Unary operator.
|
|
class unop : public ref_formula
|
|
{
|
|
public:
|
|
enum type { Not, X, F, G };
|
|
|
|
/// Build an unary operator with operation \a op and
|
|
/// child \a child.
|
|
static unop* instance(type op, formula* child);
|
|
|
|
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;
|
|
|
|
/// Number of instantiated unary operators. For debugging.
|
|
static unsigned instance_count();
|
|
|
|
protected:
|
|
typedef std::pair<type, formula*> pair;
|
|
typedef std::map<pair, formula*> map;
|
|
static map instances;
|
|
|
|
unop(type op, formula* child);
|
|
virtual ~unop();
|
|
|
|
private:
|
|
type op_;
|
|
formula* child_;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif // SPOT_LTLAST_UNOP_HH
|