\hypertarget{classcref__counter__pool}{
\section{cref\_\-counter\_\-pool Class Reference}
\label{classcref__counter__pool}\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}}
}


class for maintaining \hyperlink{protocolthe-p}{the} storage of counters used by \hyperlink{classcref__ptr}{cref\_\-ptr}.  




{\ttfamily \#include $<$ref\_\-ptr.hh$>$}

\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structcref__counter__pool_1_1pool__item}{pool\_\-item}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
int32\_\-t \hyperlink{classcref__counter__pool_a2dffcee2a5c4ea41337536e99b60b5f1}{new\_\-counter} (void $\ast$data)
\begin{DoxyCompactList}\small\item\em Create a new counter. \item\end{DoxyCompactList}\item 
int32\_\-t \hyperlink{classcref__counter__pool_af2173754f64f5a5a47871f319e75373a}{incr\_\-counter} (int32\_\-t index)
\begin{DoxyCompactList}\small\item\em Increment \hyperlink{protocolthe-p}{the} count associated with counter by 1. \item\end{DoxyCompactList}\item 
int32\_\-t \hyperlink{classcref__counter__pool_a63328718c6592969a7623e7b40601d7f}{decr\_\-counter} (int32\_\-t index)
\begin{DoxyCompactList}\small\item\em Decrement \hyperlink{protocolthe-p}{the} count associated with counter by 1. \item\end{DoxyCompactList}\item 
int32\_\-t \hyperlink{classcref__counter__pool_a90b68d2b5857cb7e32fcd366cbf7387d}{count} (int32\_\-t index)
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} count associated with counter. \item\end{DoxyCompactList}\item 
\hypertarget{classcref__counter__pool_a59f4074931a08dfe546886134bd2a42c}{
void $\ast$ {\bfseries data} (int32\_\-t index)}
\label{classcref__counter__pool_a59f4074931a08dfe546886134bd2a42c}

\item 
void \hyperlink{classcref__counter__pool_accafb265111583dc119a730202e36792}{recycle} (int32\_\-t index)
\begin{DoxyCompactList}\small\item\em Recycle counter. \item\end{DoxyCompactList}\item 
void \hyperlink{classcref__counter__pool_afc310bf85be8a23b5474c3d4f6e959a0}{dump} ()
\begin{DoxyCompactList}\small\item\em Dumps counter info to stdout. \item\end{DoxyCompactList}\item 
void \hyperlink{classcref__counter__pool_a94a0f1e2ec7e7bfd44eb40d396247ebd}{check} ()
\begin{DoxyCompactList}\small\item\em Sanity check internal data structure. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{classcref__counter__pool}{cref\_\-counter\_\-pool} \& \hyperlink{classcref__counter__pool_a008f6ba13fbb91f3f11de7f8f5934651}{instance} ()
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classcref__counter__pool_aae77b9fa66b9356f5698f7c6cb75c8a2}{
void \hyperlink{classcref__counter__pool_aae77b9fa66b9356f5698f7c6cb75c8a2}{grow} ()}
\label{classcref__counter__pool_aae77b9fa66b9356f5698f7c6cb75c8a2}

\begin{DoxyCompactList}\small\item\em Expand counter storage. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classcref__counter__pool_a166f5e9ce381e291a1f71b74ce3ade5a}{
vector$<$ \hyperlink{structcref__counter__pool_1_1pool__item}{pool\_\-item} $>$ {\bfseries \_\-counters}}
\label{classcref__counter__pool_a166f5e9ce381e291a1f71b74ce3ade5a}

\item 
\hypertarget{classcref__counter__pool_a6365b06c8bd4aca98d35e33e27c58d0e}{
int32\_\-t {\bfseries \_\-free\_\-index}}
\label{classcref__counter__pool_a6365b06c8bd4aca98d35e33e27c58d0e}

\end{DoxyCompactItemize}
\subsection*{Static Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classcref__counter__pool_ac4feeeeed674650c3cf88bf929952b28}{
static const int32\_\-t {\bfseries LAST\_\-FREE} = -\/1}
\label{classcref__counter__pool_ac4feeeeed674650c3cf88bf929952b28}

\item 
\hypertarget{classcref__counter__pool_afe4927c08aad9e687ecc9e0f3bc261c5}{
static \hyperlink{classcref__counter__pool}{cref\_\-counter\_\-pool} {\bfseries \_\-the\_\-instance}}
\label{classcref__counter__pool_afe4927c08aad9e687ecc9e0f3bc261c5}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
class for maintaining \hyperlink{protocolthe-p}{the} storage of counters used by \hyperlink{classcref__ptr}{cref\_\-ptr}. The \hyperlink{classcref__counter__pool}{cref\_\-counter\_\-pool} is a singleton class that maintains \hyperlink{protocolthe-p}{the} counters for all \hyperlink{classcref__ptr}{cref\_\-ptr} objects. The counters are maintained in a vector. This class is used by \hyperlink{classcref__ptr}{cref\_\-ptr} and not intended any other purpose. 

\subsection{Member Function Documentation}
\hypertarget{classcref__counter__pool_a94a0f1e2ec7e7bfd44eb40d396247ebd}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!check@{check}}
\index{check@{check}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{check}]{\setlength{\rightskip}{0pt plus 5cm}void cref\_\-counter\_\-pool::check (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_a94a0f1e2ec7e7bfd44eb40d396247ebd}


Sanity check internal data structure. 

Debugging function. \hypertarget{classcref__counter__pool_a90b68d2b5857cb7e32fcd366cbf7387d}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!count@{count}}
\index{count@{count}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{count}]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cref\_\-counter\_\-pool::count (
\begin{DoxyParamCaption}
\item[{int32\_\-t}]{index}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_a90b68d2b5857cb7e32fcd366cbf7387d}


Get \hyperlink{protocolthe-p}{the} count associated with counter. 


\begin{DoxyParams}{Parameters}
{\em index} & of \hyperlink{protocolthe-p}{the} counter to query. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} counter value. 
\end{DoxyReturn}
\hypertarget{classcref__counter__pool_a63328718c6592969a7623e7b40601d7f}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!decr\_\-counter@{decr\_\-counter}}
\index{decr\_\-counter@{decr\_\-counter}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{decr\_\-counter}]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cref\_\-counter\_\-pool::decr\_\-counter (
\begin{DoxyParamCaption}
\item[{int32\_\-t}]{index}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_a63328718c6592969a7623e7b40601d7f}


Decrement \hyperlink{protocolthe-p}{the} count associated with counter by 1. 


\begin{DoxyParams}{Parameters}
{\em index} & \hyperlink{protocolthe-p}{the} counter to decrement. \\
\hline
\end{DoxyParams}
\hypertarget{classcref__counter__pool_afc310bf85be8a23b5474c3d4f6e959a0}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!dump@{dump}}
\index{dump@{dump}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{dump}]{\setlength{\rightskip}{0pt plus 5cm}void cref\_\-counter\_\-pool::dump (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_afc310bf85be8a23b5474c3d4f6e959a0}


Dumps counter info to stdout. 

Debugging function. \hypertarget{classcref__counter__pool_af2173754f64f5a5a47871f319e75373a}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!incr\_\-counter@{incr\_\-counter}}
\index{incr\_\-counter@{incr\_\-counter}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{incr\_\-counter}]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cref\_\-counter\_\-pool::incr\_\-counter (
\begin{DoxyParamCaption}
\item[{int32\_\-t}]{index}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_af2173754f64f5a5a47871f319e75373a}


Increment \hyperlink{protocolthe-p}{the} count associated with counter by 1. 


\begin{DoxyParams}{Parameters}
{\em index} & \hyperlink{protocolthe-p}{the} counter to increment. \\
\hline
\end{DoxyParams}
\hypertarget{classcref__counter__pool_a008f6ba13fbb91f3f11de7f8f5934651}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!instance@{instance}}
\index{instance@{instance}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{instance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf cref\_\-counter\_\-pool} \& cref\_\-counter\_\-pool::instance (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{classcref__counter__pool_a008f6ba13fbb91f3f11de7f8f5934651}
\begin{DoxyReturn}{Returns}
singleton \hyperlink{classcref__counter__pool}{cref\_\-counter\_\-pool}. 
\end{DoxyReturn}
\hypertarget{classcref__counter__pool_a2dffcee2a5c4ea41337536e99b60b5f1}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!new\_\-counter@{new\_\-counter}}
\index{new\_\-counter@{new\_\-counter}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{new\_\-counter}]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cref\_\-counter\_\-pool::new\_\-counter (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{data}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_a2dffcee2a5c4ea41337536e99b60b5f1}


Create a new counter. 

\begin{DoxyReturn}{Returns}
index associated with counter. 
\end{DoxyReturn}
\hypertarget{classcref__counter__pool_accafb265111583dc119a730202e36792}{
\index{cref\_\-counter\_\-pool@{cref\_\-counter\_\-pool}!recycle@{recycle}}
\index{recycle@{recycle}!cref_counter_pool@{cref\_\-counter\_\-pool}}
\subsubsection[{recycle}]{\setlength{\rightskip}{0pt plus 5cm}void cref\_\-counter\_\-pool::recycle (
\begin{DoxyParamCaption}
\item[{int32\_\-t}]{index}
\end{DoxyParamCaption}
)}}
\label{classcref__counter__pool_accafb265111583dc119a730202e36792}


Recycle counter. 

Places counter on free-\/list. 
\begin{DoxyParams}{Parameters}
{\em index} & of \hyperlink{protocolthe-p}{the} counter to recycle. \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/ref\_\-ptr.hh\item 
/home/greearb/git/xorp.ct.github/xorp/libxorp/ref\_\-ptr.cc\end{DoxyCompactItemize}
