\hypertarget{classHurricane_1_1Locator}{}\section{Hurricane\+:\+:Locator$<$ Type $>$ Class Template Reference}
\label{classHurricane_1_1Locator}\index{Hurricane\+::\+Locator$<$ Type $>$@{Hurricane\+::\+Locator$<$ Type $>$}}


\mbox{\hyperlink{classHurricane_1_1Locator}{Locator}} description ({\bfseries A\+PI})  




Inheritance diagram for Hurricane\+:\+:Locator$<$ Type $>$\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=222pt]{classHurricane_1_1Locator__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
virtual Type \mbox{\hyperlink{classHurricane_1_1Locator_aa2202b4cf461a7c3b666da10bc96219f}{get\+Element}} () const =0
\item 
virtual \mbox{\hyperlink{classHurricane_1_1Locator}{Locator}}$<$ Type $>$ $\ast$ \mbox{\hyperlink{classHurricane_1_1Locator_a83779aa300e3de011bf3b93be8a48d83}{get\+Clone}} () const =0
\item 
virtual bool \mbox{\hyperlink{classHurricane_1_1Locator_abb6e5255372e22e31bf0a8e4cae93f87}{is\+Valid}} () const =0
\item 
virtual void \mbox{\hyperlink{classHurricane_1_1Locator_ad8d72c1625a343a50520792c96fa1ca1}{progress}} ()=0
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class Type$>$\newline
class Hurricane\+::\+Locator$<$ Type $>$}

\mbox{\hyperlink{classHurricane_1_1Locator}{Locator}} description ({\bfseries A\+PI}) 

\hypertarget{classHurricane_1_1Locator_secLocatorIntro}{}\subsection{Introduction}\label{classHurricane_1_1Locator_secLocatorIntro}
Locators are objects which allow to walk efficiently through the data structure.

Locators are indeed algorithms. They do not hold a list of elements but the way to go from one element to the next. As such, they are very light in memory, contrary to containers. Locators are the workhorse of \mbox{\hyperlink{classHurricane_1_1Collection}{Collection}}, and while they can be used directly, this is not the recommended way.\hypertarget{classHurricane_1_1Locator_secLocatorGeneralConcepts}{}\subsection{General concepts}\label{classHurricane_1_1Locator_secLocatorGeneralConcepts}
{\bfseries Initialization} In order to get a locator, you must \+: either ask the collection to provide a locator for visiting the elements of its described set, or build a clone of an existing locator allowing to visit the remaining elements starting from the current position of that locator.

{\bfseries End of walk indicator} The predicate {\bfseries \mbox{\hyperlink{classHurricane_1_1Locator_abb6e5255372e22e31bf0a8e4cae93f87}{is\+Valid()}}} returns {\bfseries true} if the locator refers an element of the set, {\bfseries false} when all the elements have been visited.

{\bfseries getting the current element} The current element is obtained by the accessor {\bfseries \mbox{\hyperlink{classHurricane_1_1Locator_aa2202b4cf461a7c3b666da10bc96219f}{get\+Element()}}}. There is no risk to call this function when the visit is finished or the locator is non initialized (the returned value is meaningless).

{\bfseries Walk progression} The function {\bfseries \mbox{\hyperlink{classHurricane_1_1Locator_ad8d72c1625a343a50520792c96fa1ca1}{progress()}}} moves forward the locator on the next element of the set (does nothing if called after the last element).\hypertarget{classHurricane_1_1Locator_secLocatorUsageExamples}{}\subsection{Usage examples}\label{classHurricane_1_1Locator_secLocatorUsageExamples}
The following sample code shows how to trace the nets of a given cell 
\begin{DoxyCode}
Cell* cell = ...; \textcolor{comment}{// we get the cell}
 
\textcolor{keywordflow}{if} (cell) \{
 
   \textcolor{comment}{// cell->getNets()}
   \textcolor{comment}{//    returns the nets collection of the cell}
   \textcolor{comment}{// and getLocator()}
   \textcolor{comment}{//    allocates and returns a locator for traversing those nets}
   Locator<Net*>* locator = cell->getNets().getLocator();
 
   \textcolor{keywordflow}{while} (locator->isValid()) \{
      Net* net = locator->getElement();
      assert(net->getCell() == cell);
      locator->progress();
   \}
 
   \textcolor{comment}{// don't forget to release the allocated locator}
   \textcolor{keyword}{delete} locator;
\}
\end{DoxyCode}
 And this one how to print all pairs of nets of a given cell 
\begin{DoxyCode}
Cell* cell = ...; \textcolor{comment}{// we get a cell}
 
\textcolor{keywordflow}{if} (cell) \{
   Locator<Net*>* locator1 = cell->GetNets().getLocator();
   \textcolor{keywordflow}{while} (locator1->isValid()) \{
      Net* net1 = locator1->getElement();
 
      Locator<Net*>* locator2 = locator1->getClone();
      \textcolor{keywordflow}{while} (locator2->isValid()) \{
         Net* net2 = locator2->getElement();
         cerr << net1 << \textcolor{stringliteral}{" "} << net2 << endl;
         locator2->progress();
      \}
      \textcolor{keyword}{delete} locator2;
 
      locator1->progress();
   \}
   \textcolor{keyword}{delete} locator1;
\}
\end{DoxyCode}
 \begin{DoxyRemark}{Remarks}
Those examples are given in order to explain how locators work. We will see in the following how to do that more simply by using generic locators, or even simpler by using the for\+Each macros. 
\end{DoxyRemark}


\subsection{Member Function Documentation}
\mbox{\Hypertarget{classHurricane_1_1Locator_aa2202b4cf461a7c3b666da10bc96219f}\label{classHurricane_1_1Locator_aa2202b4cf461a7c3b666da10bc96219f}} 
\index{Hurricane\+::\+Locator@{Hurricane\+::\+Locator}!get\+Element@{get\+Element}}
\index{get\+Element@{get\+Element}!Hurricane\+::\+Locator@{Hurricane\+::\+Locator}}
\subsubsection{\texorpdfstring{get\+Element()}{getElement()}}
{\footnotesize\ttfamily template$<$class Type$>$ \\
Type \mbox{\hyperlink{classHurricane_1_1Locator}{Hurricane\+::\+Locator}}$<$ Type $>$\+::get\+Element (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [pure virtual]}}

{\bfseries Returns\+:} the current element (or the value {\bfseries Type()} when the locator is not or no longer valid). \mbox{\Hypertarget{classHurricane_1_1Locator_a83779aa300e3de011bf3b93be8a48d83}\label{classHurricane_1_1Locator_a83779aa300e3de011bf3b93be8a48d83}} 
\index{Hurricane\+::\+Locator@{Hurricane\+::\+Locator}!get\+Clone@{get\+Clone}}
\index{get\+Clone@{get\+Clone}!Hurricane\+::\+Locator@{Hurricane\+::\+Locator}}
\subsubsection{\texorpdfstring{get\+Clone()}{getClone()}}
{\footnotesize\ttfamily template$<$class Type$>$ \\
\mbox{\hyperlink{classHurricane_1_1Locator}{Locator}}$<$ Type $>$ $\ast$ \mbox{\hyperlink{classHurricane_1_1Locator}{Hurricane\+::\+Locator}}$<$ Type $>$\+::get\+Clone (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [pure virtual]}}

This function allocates and returns a new locator that will have the same visiting course than the remaining one of the locator being cloned.

\begin{DoxyRemark}{Remarks}
In principle there is no need to call this function, but if you do so you must not forget to release the clone after its use or, from it, build a generic locator which will do that for you (to be explained later). 
\end{DoxyRemark}
\mbox{\Hypertarget{classHurricane_1_1Locator_abb6e5255372e22e31bf0a8e4cae93f87}\label{classHurricane_1_1Locator_abb6e5255372e22e31bf0a8e4cae93f87}} 
\index{Hurricane\+::\+Locator@{Hurricane\+::\+Locator}!is\+Valid@{is\+Valid}}
\index{is\+Valid@{is\+Valid}!Hurricane\+::\+Locator@{Hurricane\+::\+Locator}}
\subsubsection{\texorpdfstring{is\+Valid()}{isValid()}}
{\footnotesize\ttfamily template$<$class Type$>$ \\
bool \mbox{\hyperlink{classHurricane_1_1Locator}{Hurricane\+::\+Locator}}$<$ Type $>$\+::is\+Valid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [pure virtual]}}

{\bfseries Returns\+:} {\bfseries true} while the walk has not exhausted the set of elements, else {\bfseries false}. \mbox{\Hypertarget{classHurricane_1_1Locator_ad8d72c1625a343a50520792c96fa1ca1}\label{classHurricane_1_1Locator_ad8d72c1625a343a50520792c96fa1ca1}} 
\index{Hurricane\+::\+Locator@{Hurricane\+::\+Locator}!progress@{progress}}
\index{progress@{progress}!Hurricane\+::\+Locator@{Hurricane\+::\+Locator}}
\subsubsection{\texorpdfstring{progress()}{progress()}}
{\footnotesize\ttfamily template$<$class Type$>$ \\
void \mbox{\hyperlink{classHurricane_1_1Locator}{Hurricane\+::\+Locator}}$<$ Type $>$\+::progress (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}}

Moves forward the locator to the following element. 

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
Locator.\+h\item 
Locator.\+dox\end{DoxyCompactItemize}
