Rename formula::ref and formula::unref as formula::clone
and formula::destroy. * src/ltlast/atomic_prop.cc, src/ltlast/automatop.cc, src/ltlast/binop.cc, src/ltlast/formula.hh, src/ltlast/formula.cc, src/ltlast/multop.cc, src/ltlast/unop.cc, src/ltlenv/declenv.cc, src/ltlvisit/basicreduce.cc, src/ltlvisit/clone.cc, src/ltlvisit/destroy.cc, src/ltlvisit/nenoform.cc, src/ltlvisit/randomltl.cc, src/ltlvisit/reduce.cc, src/tgbatest/randtgba.cc: Adjust.
This commit is contained in:
parent
8e4e692e7f
commit
b0888257f8
16 changed files with 63 additions and 54 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2004, 2005, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -78,11 +78,11 @@ namespace spot
|
|||
map::iterator i = instances.find(p);
|
||||
if (i != instances.end())
|
||||
{
|
||||
return static_cast<atomic_prop*>(i->second->ref());
|
||||
return static_cast<atomic_prop*>(i->second->clone());
|
||||
}
|
||||
atomic_prop* ap = new atomic_prop(name, env);
|
||||
instances[p] = ap;
|
||||
return static_cast<atomic_prop*>(ap->ref());
|
||||
return static_cast<atomic_prop*>(ap->clone());
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace spot
|
|||
|
||||
// Dereference children.
|
||||
for (unsigned n = 0; n < size(); ++n)
|
||||
formula::unref(nth(n));
|
||||
formula::destroy(nth(n));
|
||||
|
||||
delete children_;
|
||||
}
|
||||
|
|
@ -79,13 +79,13 @@ namespace spot
|
|||
{
|
||||
// The instance already exists.
|
||||
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
|
||||
formula::unref(*vi);
|
||||
formula::destroy(*vi);
|
||||
delete v;
|
||||
return static_cast<automatop*>(i->second->ref());
|
||||
return static_cast<automatop*>(i->second->clone());
|
||||
}
|
||||
automatop* res = new automatop(nfa, v, negated);
|
||||
instances[p] = res;
|
||||
return static_cast<automatop*>(res->ref());
|
||||
return static_cast<automatop*>(res->clone());
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ namespace spot
|
|||
instances.erase(i);
|
||||
|
||||
// Dereference children.
|
||||
formula::unref(first());
|
||||
formula::unref(second());
|
||||
formula::destroy(first());
|
||||
formula::destroy(second());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -143,13 +143,13 @@ namespace spot
|
|||
if (i != instances.end())
|
||||
{
|
||||
// This instance already exists.
|
||||
formula::unref(first);
|
||||
formula::unref(second);
|
||||
return static_cast<binop*>(i->second->ref());
|
||||
formula::destroy(first);
|
||||
formula::destroy(second);
|
||||
return static_cast<binop*>(i->second->clone());
|
||||
}
|
||||
binop* ap = new binop(op, first, second);
|
||||
instances[p] = ap;
|
||||
return static_cast<binop*>(ap->ref());
|
||||
return static_cast<binop*>(ap->clone());
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// Copyright (C) 2003, 2005, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||
// et Marie Curie.
|
||||
//
|
||||
|
|
@ -27,7 +27,7 @@ namespace spot
|
|||
namespace ltl
|
||||
{
|
||||
formula*
|
||||
formula::ref()
|
||||
formula::clone()
|
||||
{
|
||||
ref_();
|
||||
return this;
|
||||
|
|
@ -38,7 +38,7 @@ namespace spot
|
|||
}
|
||||
|
||||
void
|
||||
formula::unref(formula* f)
|
||||
formula::destroy(formula* f)
|
||||
{
|
||||
if (f->unref_())
|
||||
delete f;
|
||||
|
|
|
|||
|
|
@ -79,17 +79,13 @@ namespace spot
|
|||
/// \brief clone this node
|
||||
///
|
||||
/// This increments the reference counter of this node (if one is
|
||||
/// used). You should almost never use this method directly as
|
||||
/// it doesn't touch the children. If you want to clone a
|
||||
/// whole formula, use spot::ltl::clone() instead.
|
||||
formula* ref();
|
||||
/// used).
|
||||
formula* clone();
|
||||
/// \brief release this node
|
||||
///
|
||||
/// This decrements the reference counter of this node (if one is
|
||||
/// used) and can free the object. You should almost never use
|
||||
/// this method directly as it doesn't touch the children. If you
|
||||
/// want to release a whole formula, use spot::ltl::destroy() instead.
|
||||
static void unref(formula* f);
|
||||
/// used) and can free the object.
|
||||
static void destroy(formula* f);
|
||||
|
||||
/// Return a canonic representation of the formula
|
||||
const std::string& dump() const;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace spot
|
|||
|
||||
// Dereference children.
|
||||
for (unsigned n = 0; n < size(); ++n)
|
||||
formula::unref(nth(n));
|
||||
formula::destroy(nth(n));
|
||||
|
||||
delete children_;
|
||||
}
|
||||
|
|
@ -130,8 +130,8 @@ namespace spot
|
|||
{
|
||||
unsigned ps = p->size();
|
||||
for (unsigned n = 0; n < ps; ++n)
|
||||
inlined.push_back(p->nth(n)->ref());
|
||||
formula::unref(*i);
|
||||
inlined.push_back(p->nth(n)->clone());
|
||||
formula::destroy(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
|
|
@ -145,7 +145,7 @@ namespace spot
|
|||
std::sort(v->begin(), v->end(), formula_ptr_less_than());
|
||||
|
||||
// Remove duplicates. We can't use std::unique(), because we
|
||||
// must unref() any formula we drop.
|
||||
// must destroy() any formula we drop.
|
||||
{
|
||||
formula* last = 0;
|
||||
vec::iterator i = v->begin();
|
||||
|
|
@ -153,7 +153,7 @@ namespace spot
|
|||
{
|
||||
if (*i == last)
|
||||
{
|
||||
formula::unref(*i);
|
||||
formula::destroy(*i);
|
||||
i = v->erase(i);
|
||||
}
|
||||
else
|
||||
|
|
@ -193,9 +193,9 @@ namespace spot
|
|||
{
|
||||
// The instance already exists.
|
||||
for (vec::iterator vi = v->begin(); vi != v->end(); ++vi)
|
||||
formula::unref(*vi);
|
||||
formula::destroy(*vi);
|
||||
delete v;
|
||||
return static_cast<multop*>(i->second->ref());
|
||||
return static_cast<multop*>(i->second->clone());
|
||||
}
|
||||
|
||||
// This is the first instance of this formula.
|
||||
|
|
@ -203,7 +203,7 @@ namespace spot
|
|||
// Record the instance in the map,
|
||||
multop* ap = new multop(op, v);
|
||||
instances[p] = ap;
|
||||
return ap->ref();
|
||||
return ap->clone();
|
||||
}
|
||||
|
||||
formula*
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace spot
|
|||
instances.erase(i);
|
||||
|
||||
// Dereference child.
|
||||
formula::unref(child());
|
||||
formula::destroy(child());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -110,12 +110,12 @@ namespace spot
|
|||
if (i != instances.end())
|
||||
{
|
||||
// This instance already exists.
|
||||
formula::unref(child);
|
||||
return static_cast<unop*>(i->second->ref());
|
||||
formula::destroy(child);
|
||||
return static_cast<unop*>(i->second->clone());
|
||||
}
|
||||
unop* ap = new unop(op, child);
|
||||
instances[p] = ap;
|
||||
return static_cast<unop*>(ap->ref());
|
||||
return static_cast<unop*>(ap->clone());
|
||||
}
|
||||
|
||||
unsigned
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue