TriePreOrderIterator< A, Payload > Class Template Reference

Preorder Iterator on a trie. More...

#include <trie.hh>

List of all members.

Public Types

typedef IPNet< A > Key
typedef TrieNode< A, Payload > Node

Public Member Functions

 TriePreOrderIterator ()
 TriePreOrderIterator (Node *n)
 constructor for exact searches: both the current node and the search key are taken from n, so the iterator will only loop once.
 TriePreOrderIterator (Node *n, const Key &k)
 construct for subtree scanning: the root key is set explicitly, and the current node is set according to the search order.
TriePreOrderIteratorbegin ()
 move to the starting position according to the visiting order
TriePreOrderIterator operator++ (int)
 Postfix increment.
TriePreOrderIteratoroperator++ ()
 Prefix increment.
Nodecur () const
bool operator== (const TriePreOrderIterator &x) const
bool has_payload () const
Payload & payload ()
const Keykey () const

Private Member Functions

bool node_is_left (Node *n) const
void next ()

Private Attributes

Key _root
stack< Node * > _stack

Detailed Description

template<class A, class Payload>
class TriePreOrderIterator< A, Payload >

Preorder Iterator on a trie.

_cur points to the current object, _root contains the search key for root of the subtree we want to scan. The iterator does preorder traversal, that is, current node first, then left then right. This guarantees that keys returned are sorted by prefix length.

Member Function Documentation

template<class A , class Payload >
TriePreOrderIterator TriePreOrderIterator< A, Payload >::operator++ ( int  ) [inline]

Postfix increment.

Updates position of iterator in tree.

position of iterator before increment.
template<class A , class Payload >
TriePreOrderIterator& TriePreOrderIterator< A, Payload >::operator++ ( ) [inline]

Prefix increment.

Updates position of iterator in tree.

position of iterator after increment.

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations