]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2107] clarified the ownership of DomainTree data.
authorJINMEI Tatuya <jinmei@isc.org>
Mon, 27 Aug 2012 22:57:52 +0000 (15:57 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Mon, 27 Aug 2012 22:57:52 +0000 (15:57 -0700)
src/lib/datasrc/memory/domaintree.h

index bb7bbae4e4269e24536ccaf67fc96522fe6b05da..f5674ddd4bd525a53d5ce35a6aabb57a9621d7b9 100644 (file)
@@ -780,11 +780,21 @@ private:
  *  \brief \c DomainTree class represents all the domains with the same suffix.
  *      It can be used to store the domains in one zone, for example.
  *
- *  DomainTree is a generic map from domain names to any kind of
- *  data. Internally, it uses a red-black tree. However, it isn't one
- *  tree containing everything.  Subdomains are trees, so this structure
- *  is recursive - trees inside trees.  But, from the interface point of
- *  view, it is opaque data structure.
+ * DomainTree is a generic map from domain names to any kind of
+ * data. Internally, it uses a red-black tree. However, it isn't one
+ * tree containing everything.  Subdomains are trees, so this structure
+ * is recursive - trees inside trees.  But, from the interface point of
+ * view, it is opaque data structure.
+ *
+ * The data of DomainTree are set by the application via the
+ * DomainTreeNode::setData() method.  The ownership of the data isn't
+ * transferred to the DomainTree; if the application replaces existing
+ * data for a specific name in DomainTree by setData(), the application is
+ * responsible for releasing any resource for the old data.  When the
+ * application destroys the entire DomainTree by the \c destroy() method,
+ * it needs to pass a deleter object for any remained data in the DomainTree.
+ * The DomainTree will call that object with all the data in the tree so that
+ * the application complete the cleanup about the remaining data.
  *
  *  \c DomainTree splits the domain space into hierarchy red black trees; nodes
  * in one tree has the same base name. The benefit of this struct is that: