]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1803] Interface for previousNode
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 4 May 2012 12:52:00 +0000 (14:52 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 4 May 2012 12:52:00 +0000 (14:52 +0200)
This is not exactly as in the ticket, but is the same as nextNode.

src/lib/datasrc/rbtree.h

index dbf05914c0738e8eafdd782696f99a19a096bd74..411bb304604086de66752d53bf53910f8211ea50 100644 (file)
@@ -826,6 +826,28 @@ public:
     /// the largest, \c NULL will be returned.
     const RBNode<T>* nextNode(RBTreeNodeChain<T>& node_path) const;
 
+    /// \brief return the next smaller node in DNSSEC order from a node
+    ///     searched by RBTree::find().
+    ///
+    /// This acts similarly to \c nextNode(), but it walks in the other
+    /// direction. But unlike that, this can start even if the node requested
+    /// by find was not found. In that case, it will identify the node that is
+    /// previous to the queried name.
+    ///
+    /// \note \c previousNode() will iterate over all the nodes in RBTree
+    /// including empty nodes. If empty node isn't desired, it's easy to add
+    /// logic to check return node and keep invoking \c previousNode() until the
+    /// non-empty node is retrieved.
+    ///
+    /// \exception isc::BadValue node_path is empty.
+    ///
+    /// \param node_path A node chain that stores all the nodes along the path
+    /// from root to node and the result of \c find(). This will get modified.
+    ///
+    /// \return An \c RBNode that is next smaller than \c node; if \c node is
+    /// the smallest, \c NULL will be returned.
+    const RBNode<T>* previousNode(RBTreeNodeChain<T>& node_path) const;
+
     /// \brief Get the total number of nodes in the tree
     ///
     /// It includes nodes internally created as a result of adding a domain