From: JINMEI Tatuya Date: Mon, 27 Aug 2012 22:57:52 +0000 (-0700) Subject: [2107] clarified the ownership of DomainTree data. X-Git-Tag: trac2351_base~109^2~1^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4bd4bf928475f7fe9181fc71f0d87546b7b8a760;p=thirdparty%2Fkea.git [2107] clarified the ownership of DomainTree data. --- diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h index bb7bbae4e4..f5674ddd4b 100644 --- a/src/lib/datasrc/memory/domaintree.h +++ b/src/lib/datasrc/memory/domaintree.h @@ -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: