]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2091b] cleanup: use getLabels() instead of name in dumpTree.
authorJINMEI Tatuya <jinmei@isc.org>
Tue, 24 Jul 2012 00:53:42 +0000 (17:53 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Tue, 24 Jul 2012 00:53:42 +0000 (17:53 -0700)
It should be more accurate notation.  Also, we should eventually get rid of
getName() (we can't right now as it's used in node path).  This change is
one step toward that goal.

Also made some editorial/docuementation cleanups.

src/lib/datasrc/rbtree.h
src/lib/datasrc/tests/rbtree_unittest.cc

index c0ad87e73049eb10c42a1917d019acf72581419b..b57c6479ff812040a0bd0e6948b329a341301d70 100644 (file)
@@ -123,7 +123,7 @@ private:
     ///
     /// \param mem_sgmt The \c MemorySegment that allocated memory for
     /// \c rbnode.
-    /// \param ztable A non NULL pointer to a valid \c RBNode object
+    /// \param rbnode A non NULL pointer to a valid \c RBNode object
     /// that was originally created by the \c create() method (the behavior
     /// is undefined if this condition isn't met).
     static void destroy(util::MemorySegment& mem_sgmt, RBNode<T>* rbnode) {
@@ -138,14 +138,10 @@ private:
     }
 
     /// TBD
-    const void* getLabelsData() const {
-        return (this + 1);
-    }
+    const void* getLabelsData() const { return (this + 1); }
 
     /// TBD
-    void* getLabelsData() {
-        return (this + 1);
-    }
+    void* getLabelsData() { return (this + 1); }
 
 public:
     /// \brief Alias for shared pointer to the data.
@@ -752,6 +748,8 @@ private:
  *
  * the tree will look like:
  *  \verbatim
+                                .
+                                |
                                 b
                               /   \
                              a    d.e.f
@@ -768,8 +766,6 @@ private:
    \endverbatim
  *  \todo
  *  - add remove interface
- *  - add iterator to iterate over the whole \c RBTree.  This may be necessary,
- *    for example, to support AXFR.
  */
 template <typename T>
 class RBTree : public boost::noncopyable {
@@ -1762,8 +1758,9 @@ RBTree<T>::dumpTreeHelper(std::ostream& os, const RBNode<T>* node,
     }
 
     indent(os, depth);
-    os << node->getName().toText() << " ("
-              << ((node->getColor() == RBNode<T>::BLACK) ? "black" : "red") << ")";
+    os << node->getLabels() << " ("
+       << ((node->getColor() == RBNode<T>::BLACK) ? "black" : "red")
+       << ")";
     if (node->isEmpty()) {
         os << " [invisible]";
     }
@@ -1775,10 +1772,10 @@ RBTree<T>::dumpTreeHelper(std::ostream& os, const RBNode<T>* node,
     const RBNode<T>* down = node->getDown();
     if (down != NULLNODE) {
         indent(os, depth + 1);
-        os << "begin down from " << node->getName().toText() << "\n";
+        os << "begin down from " << node->getLabels() << "\n";
         dumpTreeHelper(os, down, depth + 1);
         indent(os, depth + 1);
-        os << "end down from " << node->getName().toText() << "\n";
+        os << "end down from " << node->getLabels() << "\n";
     }
     dumpTreeHelper(os, node->getLeft(), depth + 1);
     dumpTreeHelper(os, node->getRight(), depth + 1);
index ae235873cdc82840bae137cbe767803a4e205224..f45e08e1ab7ab328c98f01992e50729e9c39ff5d 100644 (file)
@@ -769,45 +769,45 @@ TEST_F(RBTreeTest, dumpTree) {
     str2 << "tree has 15 node(s)\n"
             ". (black) [invisible] [subtreeroot]\n"
             "     begin down from .\n"
-            "     b. (black) [subtreeroot]\n"
-            "          a. (black)\n"
+            "     b (black) [subtreeroot]\n"
+            "          a (black)\n"
             "               NULL\n"
             "               NULL\n"
-            "          d.e.f. (black) [invisible]\n"
-            "               begin down from d.e.f.\n"
-            "               w.y. (black) [invisible] [subtreeroot]\n"
-            "                    begin down from w.y.\n"
-            "                    p. (black) [subtreeroot]\n"
-            "                         o. (red)\n"
+            "          d.e.f (black) [invisible]\n"
+            "               begin down from d.e.f\n"
+            "               w.y (black) [invisible] [subtreeroot]\n"
+            "                    begin down from w.y\n"
+            "                    p (black) [subtreeroot]\n"
+            "                         o (red)\n"
             "                              NULL\n"
             "                              NULL\n"
-            "                         q. (red)\n"
+            "                         q (red)\n"
             "                              NULL\n"
             "                              NULL\n"
-            "                    end down from w.y.\n"
-            "                    x. (red)\n"
+            "                    end down from w.y\n"
+            "                    x (red)\n"
             "                         NULL\n"
             "                         NULL\n"
-            "                    z. (red)\n"
-            "                         begin down from z.\n"
-            "                         j. (black) [subtreeroot]\n"
+            "                    z (red)\n"
+            "                         begin down from z\n"
+            "                         j (black) [subtreeroot]\n"
             "                              NULL\n"
             "                              NULL\n"
-            "                         end down from z.\n"
+            "                         end down from z\n"
             "                         NULL\n"
             "                         NULL\n"
-            "               end down from d.e.f.\n"
-            "               c. (red)\n"
+            "               end down from d.e.f\n"
+            "               c (red)\n"
             "                    NULL\n"
             "                    NULL\n"
-            "               g.h. (red)\n"
-            "                    begin down from g.h.\n"
-            "                    i. (black) [subtreeroot]\n"
+            "               g.h (red)\n"
+            "                    begin down from g.h\n"
+            "                    i (black) [subtreeroot]\n"
             "                         NULL\n"
-            "                         k. (red)\n"
+            "                         k (red)\n"
             "                              NULL\n"
             "                              NULL\n"
-            "                    end down from g.h.\n"
+            "                    end down from g.h\n"
             "                    NULL\n"
             "                    NULL\n"
             "     end down from .\n"