Parcourir la source

provide mutable and immutable version for find

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac397@3614 e5f2f494-b856-4b98-b285-d166d9295462
Han Feng il y a 14 ans
Parent
commit
e24f53189a
1 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 11 1
      src/bin/auth/rbt_datasrc.h

+ 11 - 1
src/bin/auth/rbt_datasrc.h

@@ -231,6 +231,7 @@ public:
     /// NOTFOUND, if the return value is NOTFOUND, the value of node is
     /// \c unknown
     FindResult find(const Name& name, RBNode<T>** node) const;
+    FindResult find(const Name& name, const RBNode<T>** node) const;
 
     /// \brief Get the total node count in the tree
     /// the node count including the node created common suffix node
@@ -364,7 +365,16 @@ RBTree<T>::find(const Name& name, RBNode<T>** node) const {
     return (findHelper(name, &tree, node));
 }
 
-
+template <typename T>
+typename RBTree<T>::FindResult
+RBTree<T>::find(const Name& name, const RBNode<T>** node) const {
+    const RBTree<T> *tree;
+    RBNode<T> *target_node; 
+    RBTree<T>::FindResult ret = findHelper(name, &tree, &target_node);
+    if (ret != NOTFOUND)
+        *node = target_node;
+    return ret;
+}
 
 template <typename T>
 typename RBTree<T>::FindResult