]> matita.cs.unibo.it Git - helm.git/commitdiff
* snapshot
authorLuca Padovani <luca.padovani@unito.it>
Tue, 9 Nov 2004 07:37:38 +0000 (07:37 +0000)
committerLuca Padovani <luca.padovani@unito.it>
Tue, 9 Nov 2004 07:37:38 +0000 (07:37 +0000)
helm/papers/use_case/stats/stats.cc

index 85ef8ba0675c1aae4a0aa435aabbda4f32a36c90..cab4326ceff2270dcccd234ea4f73df2d2d1a327 100644 (file)
@@ -3,6 +3,8 @@
 #include <cassert>
 #include <GdomeSmartDOM.hh>
 
+#include <ext/hash_map>
+
 namespace DOM = GdomeSmartDOM;
 
 unsigned n_elements;
@@ -13,7 +15,7 @@ unsigned n_attributes;
 unsigned max_attributes;
 unsigned max_depth;
 unsigned max_children;
-std::vector<unsigned> depths;
+std::hash_map<unsigned,unsigned> depths;
 std::vector<unsigned> widths;
 
 bool
@@ -24,6 +26,16 @@ is_blank(const std::string& s)
   return true;
 }
 
+void
+add_depth(unsigned depth)
+{
+       std::hash_map<unsigned,unsigned>::iterator p = depths.find(depth);
+       if (p != depths.end())
+               p->end++;
+       else
+               depths[depth] = 1;
+}
+
 void
 visit(DOM::Node node, unsigned depth)
 {