Get rid of all dynamic_cast<>s while working on LTL formulae.
They are too slow. * src/ltlast/formula.hh (opkind, kind, kind_): Use an enum to indicate the actual kind of the formula. This way we can check the kind of a formula without relying on dynamic_cast. * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc, src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc, src/ltlast/multop.cc, src/ltlast/refformula.cc, src/ltlast/refformula.hh, src/ltlast/unop.cc: Adjust constructors. * src/ltlvisit/basicreduce.cc, src/ltlvisit/mark.cc, src/ltlvisit/reduce.cc, src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc: Replace all dynamic_cast by a call to kind() followed by a static_cast.
This commit is contained in:
parent
48cde88b9b
commit
957ba664b7
15 changed files with 743 additions and 609 deletions
|
|
@ -31,7 +31,7 @@ namespace spot
|
|||
namespace ltl
|
||||
{
|
||||
bunop::bunop(type op, formula* child, unsigned min, unsigned max)
|
||||
: op_(op), child_(child), min_(min), max_(max)
|
||||
: ref_formula(BUnOp), op_(op), child_(child), min_(min), max_(max)
|
||||
{
|
||||
props = child->get_props();
|
||||
|
||||
|
|
@ -314,9 +314,9 @@ namespace spot
|
|||
|
||||
// - Exp[*i..j][*min..max] = Exp[*i(min)..j(max)]
|
||||
// if i*(min+1)<=j(min)+1.
|
||||
bunop* s = dynamic_cast<bunop*>(child);
|
||||
if (s)
|
||||
if (child->kind() == BUnOp)
|
||||
{
|
||||
bunop* s = static_cast<bunop*>(child);
|
||||
unsigned i = s->min();
|
||||
unsigned j = s->max();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue