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
|
|
@ -33,7 +33,7 @@ namespace spot
|
|||
{
|
||||
|
||||
atomic_prop::atomic_prop(const std::string& name, environment& env)
|
||||
: ref_formula(AtomicProp), name_(name), env_(&env)
|
||||
: formula(AtomicProp), name_(name), env_(&env)
|
||||
{
|
||||
is.boolean = true;
|
||||
is.sugar_free_boolean = true;
|
||||
|
|
@ -93,10 +93,14 @@ namespace spot
|
|||
const atomic_prop* ap;
|
||||
auto ires = instances.emplace(key(name, &env), nullptr);
|
||||
if (!ires.second)
|
||||
ap = ires.first->second;
|
||||
{
|
||||
ap = ires.first->second;
|
||||
ap->clone();
|
||||
}
|
||||
else
|
||||
ap = ires.first->second = new atomic_prop(name, env);
|
||||
ap->clone();
|
||||
{
|
||||
ap = ires.first->second = new atomic_prop(name, env);
|
||||
}
|
||||
return ap;
|
||||
}
|
||||
|
||||
|
|
@ -110,9 +114,9 @@ namespace spot
|
|||
atomic_prop::dump_instances(std::ostream& os)
|
||||
{
|
||||
for (const auto& i: instances)
|
||||
os << i.second << " = " << i.second->ref_count_()
|
||||
os << i.second << " = " << 1 + i.second->refs_
|
||||
<< " * atomic_prop(" << i.first.first << ", "
|
||||
<< i.first.second->name() << ')' << std::endl;
|
||||
<< i.first.second->name() << ")\n";
|
||||
return os;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue