\hypertarget{classTriePreOrderIterator}{
\section{TriePreOrderIterator$<$ A, Payload $>$ Class Template Reference}
\label{classTriePreOrderIterator}\index{TriePreOrderIterator@{TriePreOrderIterator}}
}


Preorder Iterator on a trie.  




{\ttfamily \#include $<$trie.hh$>$}

\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTriePreOrderIterator_a7bafd2cb9d42da2827cbf7606f910bb8}{
typedef \hyperlink{classIPNet}{IPNet}$<$ A $>$ {\bfseries Key}}
\label{classTriePreOrderIterator_a7bafd2cb9d42da2827cbf7606f910bb8}

\item 
\hypertarget{classTriePreOrderIterator_a73ff7526559fc14c214e9a8c7a526065}{
typedef \hyperlink{classTrieNode}{TrieNode}$<$ A, Payload $>$ {\bfseries Node}}
\label{classTriePreOrderIterator_a73ff7526559fc14c214e9a8c7a526065}

\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTriePreOrderIterator_a3f8429da315fe5c9625851148c5e9d9a}{
\hyperlink{classTriePreOrderIterator_a3f8429da315fe5c9625851148c5e9d9a}{TriePreOrderIterator} ()}
\label{classTriePreOrderIterator_a3f8429da315fe5c9625851148c5e9d9a}

\begin{DoxyCompactList}\small\item\em Constructors. \item\end{DoxyCompactList}\item 
\hypertarget{classTriePreOrderIterator_ae1afc120c7ccb4d882e9c1b024b6654f}{
\hyperlink{classTriePreOrderIterator_ae1afc120c7ccb4d882e9c1b024b6654f}{TriePreOrderIterator} (\hyperlink{classTrieNode}{Node} $\ast$n)}
\label{classTriePreOrderIterator_ae1afc120c7ccb4d882e9c1b024b6654f}

\begin{DoxyCompactList}\small\item\em constructor for exact searches: both \hyperlink{protocolthe-p}{the} current node and \hyperlink{protocolthe-p}{the} search key are taken from n, so \hyperlink{protocolthe-p}{the} iterator will only loop once. \item\end{DoxyCompactList}\item 
\hypertarget{classTriePreOrderIterator_ac0da020059c358d115f3acad3b7c15f3}{
\hyperlink{classTriePreOrderIterator_ac0da020059c358d115f3acad3b7c15f3}{TriePreOrderIterator} (\hyperlink{classTrieNode}{Node} $\ast$n, const \hyperlink{classIPNet}{Key} \&k)}
\label{classTriePreOrderIterator_ac0da020059c358d115f3acad3b7c15f3}

\begin{DoxyCompactList}\small\item\em construct for subtree scanning: \hyperlink{protocolthe-p}{the} root key is set explicitly, and \hyperlink{protocolthe-p}{the} current node is set according to \hyperlink{protocolthe-p}{the} search order. \item\end{DoxyCompactList}\item 
\hypertarget{classTriePreOrderIterator_ae7873ba55863af30e3a4cca3c2e55729}{
\hyperlink{classTriePreOrderIterator}{TriePreOrderIterator} $\ast$ \hyperlink{classTriePreOrderIterator_ae7873ba55863af30e3a4cca3c2e55729}{begin} ()}
\label{classTriePreOrderIterator_ae7873ba55863af30e3a4cca3c2e55729}

\begin{DoxyCompactList}\small\item\em move to \hyperlink{protocolthe-p}{the} starting position according to \hyperlink{protocolthe-p}{the} visiting order \item\end{DoxyCompactList}\item 
\hyperlink{classTriePreOrderIterator}{TriePreOrderIterator} \hyperlink{classTriePreOrderIterator_adf6e989b43e31d0216c1d2015b3028ba}{operator++} (int)
\begin{DoxyCompactList}\small\item\em Postfix increment. \item\end{DoxyCompactList}\item 
\hyperlink{classTriePreOrderIterator}{TriePreOrderIterator} \& \hyperlink{classTriePreOrderIterator_a15e85e6ef360890991275db2e5cd1658}{operator++} ()
\begin{DoxyCompactList}\small\item\em Prefix increment. \item\end{DoxyCompactList}\item 
\hypertarget{classTriePreOrderIterator_a5fbf1873543cadaebac25c2eab562174}{
\hyperlink{classTrieNode}{Node} $\ast$ {\bfseries cur} () const }
\label{classTriePreOrderIterator_a5fbf1873543cadaebac25c2eab562174}

\item 
\hypertarget{classTriePreOrderIterator_ace18152fb65ecf3b28f0cd9a00f85263}{
bool {\bfseries operator==} (const \hyperlink{classTriePreOrderIterator}{TriePreOrderIterator} \&x) const }
\label{classTriePreOrderIterator_ace18152fb65ecf3b28f0cd9a00f85263}

\item 
\hypertarget{classTriePreOrderIterator_a9d309e3cf2f6a04cfad26ac5d25f0bb0}{
bool {\bfseries has\_\-payload} () const }
\label{classTriePreOrderIterator_a9d309e3cf2f6a04cfad26ac5d25f0bb0}

\item 
\hypertarget{classTriePreOrderIterator_a0aebc430b74889b7d4469f098bfdbc12}{
Payload \& {\bfseries payload} ()}
\label{classTriePreOrderIterator_a0aebc430b74889b7d4469f098bfdbc12}

\item 
\hypertarget{classTriePreOrderIterator_a113f5244a436fb3483e9667ba2d55c6e}{
const \hyperlink{classIPNet}{Key} \& {\bfseries key} () const }
\label{classTriePreOrderIterator_a113f5244a436fb3483e9667ba2d55c6e}

\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTriePreOrderIterator_a2d493a64742d68ac3d377c5921ec3c28}{
bool {\bfseries node\_\-is\_\-left} (\hyperlink{classTrieNode}{Node} $\ast$n) const }
\label{classTriePreOrderIterator_a2d493a64742d68ac3d377c5921ec3c28}

\item 
\hypertarget{classTriePreOrderIterator_aa72102b9d724586bc3a60ebb6141fc6b}{
void {\bfseries next} ()}
\label{classTriePreOrderIterator_aa72102b9d724586bc3a60ebb6141fc6b}

\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classTriePreOrderIterator_ac191d72389ef7c75612aaedad0fc7d2d}{
\hyperlink{classTrieNode}{Node} $\ast$ {\bfseries \_\-cur}}
\label{classTriePreOrderIterator_ac191d72389ef7c75612aaedad0fc7d2d}

\item 
\hypertarget{classTriePreOrderIterator_a5e15567e320ff72e2298b42222852d15}{
\hyperlink{classIPNet}{Key} {\bfseries \_\-root}}
\label{classTriePreOrderIterator_a5e15567e320ff72e2298b42222852d15}

\item 
\hypertarget{classTriePreOrderIterator_a8a46a8a155079da2bd75b3e358313bcc}{
stack$<$ \hyperlink{classTrieNode}{Node} $\ast$ $>$ {\bfseries \_\-stack}}
\label{classTriePreOrderIterator_a8a46a8a155079da2bd75b3e358313bcc}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class A, class Payload$>$ class TriePreOrderIterator$<$ A, Payload $>$}

Preorder Iterator on a trie. \_\-cur points to \hyperlink{protocolthe-p}{the} current object, \_\-root contains \hyperlink{protocolthe-p}{the} search key for root of \hyperlink{protocolthe-p}{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. 

\subsection{Member Function Documentation}
\hypertarget{classTriePreOrderIterator_adf6e989b43e31d0216c1d2015b3028ba}{
\index{TriePreOrderIterator@{TriePreOrderIterator}!operator++@{operator++}}
\index{operator++@{operator++}!TriePreOrderIterator@{TriePreOrderIterator}}
\subsubsection[{operator++}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class A , class Payload $>$ {\bf TriePreOrderIterator} {\bf TriePreOrderIterator}$<$ A, Payload $>$::operator++ (
\begin{DoxyParamCaption}
\item[{int}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classTriePreOrderIterator_adf6e989b43e31d0216c1d2015b3028ba}


Postfix increment. 

Updates position of iterator in tree. \begin{DoxyReturn}{Returns}
position of iterator before increment. 
\end{DoxyReturn}
\hypertarget{classTriePreOrderIterator_a15e85e6ef360890991275db2e5cd1658}{
\index{TriePreOrderIterator@{TriePreOrderIterator}!operator++@{operator++}}
\index{operator++@{operator++}!TriePreOrderIterator@{TriePreOrderIterator}}
\subsubsection[{operator++}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class A , class Payload $>$ {\bf TriePreOrderIterator}\& {\bf TriePreOrderIterator}$<$ A, Payload $>$::operator++ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classTriePreOrderIterator_a15e85e6ef360890991275db2e5cd1658}


Prefix increment. 

Updates position of iterator in tree. \begin{DoxyReturn}{Returns}
position of iterator after increment. 
\end{DoxyReturn}


The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/trie.hh\end{DoxyCompactItemize}
