ltl: get rid of ltl::ref_formula
Instead, manage all reference counting from ltl::formula. It ridance of virtual calls to clone() and destroy() easily compensate the extra test in destroy() to not delete constant nodes. * src/ltlast/refformula.cc, src/ltlast/refformula.hh: Delete. * src/ltlast/Makefile.am, wrap/python/spot.i: Adjust. * src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh, src/ltlast/formula.cc, src/ltlast/formula.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh: Ajust the reference counting code.
This commit is contained in:
parent
d79da2e941
commit
8d947a8782
16 changed files with 70 additions and 210 deletions
|
|
@ -36,7 +36,7 @@ namespace spot
|
|||
const formula* bunop::one_star_ = 0;
|
||||
|
||||
bunop::bunop(type op, const formula* child, unsigned min, unsigned max)
|
||||
: ref_formula(BUnOp), op_(op), child_(child), min_(min), max_(max)
|
||||
: formula(BUnOp), op_(op), child_(child), min_(min), max_(max)
|
||||
{
|
||||
props = child->get_props();
|
||||
|
||||
|
|
@ -242,13 +242,12 @@ namespace spot
|
|||
{
|
||||
// This instance already exists.
|
||||
child->destroy();
|
||||
res = ires.first->second;
|
||||
res = ires.first->second->clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
res = ires.first->second = new bunop(op, child, min, max);
|
||||
}
|
||||
res->clone();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -299,9 +298,9 @@ namespace spot
|
|||
{
|
||||
for (const auto& i: instances)
|
||||
os << i.second << " = "
|
||||
<< i.second->ref_count_() << " * "
|
||||
<< 1 + i.second->refs_ << " * "
|
||||
<< i.second->dump()
|
||||
<< std::endl;
|
||||
<< '\n';
|
||||
return os;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue