* src/ltlast/refformula.hh (ref_formula::ref_count_): New method.

* src/ltlast/refformula.cc (ref_formula::ref_count_): New method.
* src/ltlast/atomic_prop.hh (atomic_prop::dump_instance): New method.
* src/ltlast/atomic_prop.cc (atomic_prop::dump_instance): New method.
This commit is contained in:
Alexandre Duret-Lutz 2004-01-23 17:08:45 +00:00
parent e73ce85cfc
commit 314768bf28
5 changed files with 38 additions and 9 deletions

View file

@ -1,5 +1,10 @@
2004-01-23 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-01-23 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/ltlast/refformula.hh (ref_formula::ref_count_): New method.
* src/ltlast/refformula.cc (ref_formula::ref_count_): New method.
* src/ltlast/atomic_prop.hh (atomic_prop::dump_instance): New method.
* src/ltlast/atomic_prop.cc (atomic_prop::dump_instance): New method.
* src/tgbaalgos/ltl2tgba_fm.cc: Typos in comments. * src/tgbaalgos/ltl2tgba_fm.cc: Typos in comments.
2004-01-13 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-01-13 Alexandre Duret-Lutz <adl@src.lip6.fr>

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
@ -88,5 +88,18 @@ namespace spot
return instances.size(); return instances.size();
} }
std::ostream&
atomic_prop::dump_instances(std::ostream& os)
{
for (map::iterator i = instances.begin(); i != instances.end(); ++i)
{
os << i->second << " = " << i->second->ref_count_()
<< " * atomic_prop(" << i->first.first << ", "
<< i->first.second->name() << ")" << std::endl;
}
return os;
}
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
@ -23,6 +23,7 @@
# define SPOT_LTLAST_ATOMIC_PROP_HH # define SPOT_LTLAST_ATOMIC_PROP_HH
#include <string> #include <string>
#include <iostream>
#include <map> #include <map>
#include "refformula.hh" #include "refformula.hh"
#include "ltlenv/environment.hh" #include "ltlenv/environment.hh"
@ -50,6 +51,8 @@ namespace spot
/// Number of instantiated atomic propositions. For debugging. /// Number of instantiated atomic propositions. For debugging.
static unsigned instance_count(); static unsigned instance_count();
/// List all instances of atomic propositions. For debugging.
static std::ostream& dump_instances(std::ostream& os);
protected: protected:
atomic_prop(const std::string& name, environment& env); atomic_prop(const std::string& name, environment& env);

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
@ -27,7 +27,7 @@ namespace spot
namespace ltl namespace ltl
{ {
ref_formula::ref_formula() ref_formula::ref_formula()
: ref_count_(0) : ref_counter_(0)
{ {
} }
@ -38,14 +38,20 @@ namespace spot
void void
ref_formula::ref_() ref_formula::ref_()
{ {
++ref_count_; ++ref_counter_;
} }
bool bool
ref_formula::unref_() ref_formula::unref_()
{ {
assert(ref_count_ > 0); assert(ref_counter_ > 0);
return !--ref_count_; return !--ref_counter_;
}
unsigned
ref_formula::ref_count_()
{
return ref_counter_;
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
@ -37,8 +37,10 @@ namespace spot
ref_formula(); ref_formula();
void ref_(); void ref_();
bool unref_(); bool unref_();
/// Number of references to this formula.
unsigned ref_count_();
private: private:
unsigned ref_count_; unsigned ref_counter_;
}; };
} }