---
milena/ChangeLog | 5 +++++
milena/mln/util/tree_of_shapes.hh | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 40 insertions(+), 1 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index a6df4ca..b2a096f 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,10 @@
2013-01-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * mln/util/tree_of_shapes.hh: Extend structure for storing new
+ tree canonicalizationss.
+
+2013-01-04 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add util::map.
* mln/util/map.hh,
diff --git a/milena/mln/util/tree_of_shapes.hh b/milena/mln/util/tree_of_shapes.hh
index c3b00e5..9bf978f 100644
--- a/milena/mln/util/tree_of_shapes.hh
+++ b/milena/mln/util/tree_of_shapes.hh
@@ -37,6 +37,8 @@ namespace mln
namespace util
{
+ enum Tags { None, Spurious, Noise };
+
template <typename I>
struct tree_of_shapes
{
@@ -45,15 +47,31 @@ namespace mln
typedef mln_equiv(V) EV;
I Fb;
+
+ // Default canonicalization.
std::vector<P> R;
mln_ch_value(I,P) parent;
- mln_ch_value(I,bool) show;
+
+ // 0-canonicalization.
+ std::vector<P> R0;
+ mln_ch_value(I,P) parent0;
+ // Attributes/tags for 0-representants.
+ std::vector<Tags> tag;
+
+ // 01-canonicalization.
+ std::vector<P> R01;
+ mln_ch_value(I,P) parent01;
+
V level(const P& p) const;
bool level_changes_at(unsigned i) const;
bool is_root(const P& p) const;
bool is_representative(const P& p) const;
+ bool is_0_representative(const P& p) const;
+
+ bool is_01_representative(const P& p) const;
+
};
@@ -91,6 +109,22 @@ namespace mln
return is_root(p) || Fb(parent(p)) != Fb(p);
}
+ template <typename I>
+ bool
+ tree_of_shapes<I>::is_0_representative(const P& p) const
+ {
+ return is_representative(p) && (Fb(p) == V(0));
+ }
+
+ template <typename I>
+ bool
+ tree_of_shapes<I>::is_01_representative(const P& p) const
+ {
+ return is_root(p)
+ || (Fb(p) == V(0) && Fb(parent(p)) != V(0))
+ || (Fb(p) != V(0) && Fb(parent(p)) == V(0));
+ }
+
# endif // ! MLN_INCLUDE_ONLY
--
1.7.2.5