2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-02 23:15:20 +00:00

[2292] Remove unused template parameters

The domain tree no longer supports the mutable find versions, so we
don't need the template parameters allowing for them.
This commit is contained in:
Michal 'vorner' Vaner
2012-10-07 16:50:50 +02:00
parent e1b4bf1cb5
commit 915576b6aa

View File

@@ -684,7 +684,7 @@ DomainTreeNode<T>::predecessor() const {
/// DomainTree. /// DomainTree.
/// This is the reason why manipulation methods such as \c push() and \c pop() /// This is the reason why manipulation methods such as \c push() and \c pop()
/// are private (and not shown in the doxygen document). /// are private (and not shown in the doxygen document).
template <typename T, typename NodeType = const DomainTreeNode<T> > template <typename T>
class DomainTreeNodeChain { class DomainTreeNodeChain {
/// DomainTreeNodeChain is initialized by DomainTree, only DomainTree has /// DomainTreeNodeChain is initialized by DomainTree, only DomainTree has
/// knowledge to manipulate it. /// knowledge to manipulate it.
@@ -817,7 +817,7 @@ private:
/// root node of DomainTree /// root node of DomainTree
/// ///
/// \exception None /// \exception None
NodeType* top() const { const DomainTreeNode<T>* top() const {
assert(!isEmpty()); assert(!isEmpty());
return (nodes_[level_count_ - 1]); return (nodes_[level_count_ - 1]);
} }
@@ -840,7 +840,7 @@ private:
/// otherwise the node should be the root node of DomainTree. /// otherwise the node should be the root node of DomainTree.
/// ///
/// \exception None /// \exception None
void push(NodeType* node) { void push(const DomainTreeNode<T>* node) {
assert(level_count_ < RBT_MAX_LEVEL); assert(level_count_ < RBT_MAX_LEVEL);
nodes_[level_count_++] = node; nodes_[level_count_++] = node;
} }
@@ -852,7 +852,7 @@ private:
const static int RBT_MAX_LEVEL = isc::dns::Name::MAX_LABELS; const static int RBT_MAX_LEVEL = isc::dns::Name::MAX_LABELS;
size_t level_count_; size_t level_count_;
NodeType* nodes_[RBT_MAX_LEVEL]; const DomainTreeNode<T>* nodes_[RBT_MAX_LEVEL];
const DomainTreeNode<T>* last_compared_; const DomainTreeNode<T>* last_compared_;
isc::dns::NameComparisonResult last_comparison_; isc::dns::NameComparisonResult last_comparison_;
}; };
@@ -1080,39 +1080,25 @@ public:
/// of it. In that case, node parameter is left intact. /// of it. In that case, node parameter is left intact.
//@{ //@{
/// \brief Simple find returning immutable node. /// \brief Simple find
/// ///
/// Acts as described in the \ref find section, but returns immutable node /// Acts as described in the \ref find section.
/// pointer.
Result find(const isc::dns::Name& name, Result find(const isc::dns::Name& name,
const DomainTreeNode<T>** node) const { const DomainTreeNode<T>** node) const {
DomainTreeNodeChain<T> node_path; DomainTreeNodeChain<T> node_path;
const DomainTreeNode<T> *target_node = NULL;
const isc::dns::LabelSequence ls(name); const isc::dns::LabelSequence ls(name);
Result ret = (find<void*, const DomainTreeNode<T> >(ls, &target_node, Result ret = (find<void*>(ls, node, node_path, NULL, NULL));
node_path, NULL,
NULL));
if (ret != NOTFOUND) {
*node = target_node;
}
return (ret); return (ret);
} }
/// \brief Simple find returning immutable node, with node_path tracking /// \brief Simple find, with node_path tracking
/// ///
/// Acts as described in the \ref find section, but returns immutable node /// Acts as described in the \ref find section.
/// pointer.
Result find(const isc::dns::Name& name, const DomainTreeNode<T>** node, Result find(const isc::dns::Name& name, const DomainTreeNode<T>** node,
DomainTreeNodeChain<T>& node_path) const DomainTreeNodeChain<T>& node_path) const
{ {
const DomainTreeNode<T> *target_node = NULL;
const isc::dns::LabelSequence ls(name); const isc::dns::LabelSequence ls(name);
Result ret = (find<void*, const DomainTreeNode<T> >(ls, &target_node, Result ret = (find<void*>(ls, node, node_path, NULL, NULL));
node_path, NULL,
NULL));
if (ret != NOTFOUND) {
*node = target_node;
}
return (ret); return (ret);
} }
@@ -1190,34 +1176,12 @@ public:
/// ///
/// \return As in the description, but in case of callback returning /// \return As in the description, but in case of callback returning
/// \c true, it returns immediately with the current node. /// \c true, it returns immediately with the current node.
template <typename CBARG, typename NodeType>
Result find(const isc::dns::LabelSequence& target_labels_orig,
const NodeType** node,
DomainTreeNodeChain<T, NodeType>& node_path,
bool (*callback)(const DomainTreeNode<T>&, CBARG),
CBARG callback_arg) const;
/// \brief Simple find returning immutable node.
///
/// Acts as described in the \ref find section, but returns immutable
/// node pointer.
template <typename CBARG> template <typename CBARG>
Result find(const isc::dns::LabelSequence& target_labels, Result find(const isc::dns::LabelSequence& target_labels_orig,
const DomainTreeNode<T>** node, const DomainTreeNode<T>** node,
DomainTreeNodeChain<T>& node_path, DomainTreeNodeChain<T>& node_path,
bool (*callback)(const DomainTreeNode<T>&, CBARG), bool (*callback)(const DomainTreeNode<T>&, CBARG),
CBARG callback_arg) const CBARG callback_arg) const;
{
const DomainTreeNode<T>* target_node = NULL;
Result ret = find<CBARG, const DomainTreeNode<T> >(target_labels,
&target_node,
node_path, callback,
callback_arg);
if (ret != NOTFOUND) {
*node = target_node;
}
return (ret);
}
//@} //@}
/// \brief return the next bigger node in DNSSEC order from a given node /// \brief return the next bigger node in DNSSEC order from a given node
@@ -1477,11 +1441,11 @@ DomainTree<T>::deleteHelper(util::MemorySegment& mem_sgmt,
} }
template <typename T> template <typename T>
template <typename CBARG, typename NodeType> template <typename CBARG>
typename DomainTree<T>::Result typename DomainTree<T>::Result
DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig, DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig,
const NodeType** target, const DomainTreeNode<T>** target,
DomainTreeNodeChain<T, NodeType>& node_path, DomainTreeNodeChain<T>& node_path,
bool (*callback)(const DomainTreeNode<T>&, CBARG), bool (*callback)(const DomainTreeNode<T>&, CBARG),
CBARG callback_arg) const CBARG callback_arg) const
{ {
@@ -1491,7 +1455,7 @@ DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig,
" and label sequence"); " and label sequence");
} }
NodeType* node; const DomainTreeNode<T>* node;
if (!node_path.isEmpty()) { if (!node_path.isEmpty()) {
// Get the top node in the node chain // Get the top node in the node chain