\hypertarget{classref__counter__pool}{
\section{ref\_\-counter\_\-pool Class Reference}
\label{classref__counter__pool}\index{ref\_\-counter\_\-pool@{ref\_\-counter\_\-pool}}
}


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




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

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
int32\_\-t \hyperlink{classref__counter__pool_ab91b5a6a8232bcb75a2fe3dec67caeca}{new\_\-counter} ()
\begin{DoxyCompactList}\small\item\em Create a new counter. \item\end{DoxyCompactList}\item 
int32\_\-t \hyperlink{classref__counter__pool_a308abd7321ce6b3b0d216b6e2d83f0e8}{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{classref__counter__pool_ac01b5b45b26cf7836bd75a1dd3f913bc}{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{classref__counter__pool_a321a76ad232dfa9fbf11a27fe700967d}{count} (int32\_\-t index)
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} count associated with counter. \item\end{DoxyCompactList}\item 
void \hyperlink{classref__counter__pool_acc229661c1d060e78269bde2cde64a4b}{recycle} (int32\_\-t index)
\begin{DoxyCompactList}\small\item\em Recycle counter. \item\end{DoxyCompactList}\item 
void \hyperlink{classref__counter__pool_ad10c805893e51dde7a88abee0d08188d}{dump} ()
\begin{DoxyCompactList}\small\item\em Dumps counter info to stdout. \item\end{DoxyCompactList}\item 
void \hyperlink{classref__counter__pool_a64857814ae6f7cb565782ed925fc20ca}{check} ()
\begin{DoxyCompactList}\small\item\em Sanity check internal data structure. \item\end{DoxyCompactList}\item 
\hypertarget{classref__counter__pool_a67d0f84dcf445725384747dcbf706ea6}{
bool \hyperlink{classref__counter__pool_a67d0f84dcf445725384747dcbf706ea6}{on\_\-free\_\-list} (int32\_\-t index)}
\label{classref__counter__pool_a67d0f84dcf445725384747dcbf706ea6}

\begin{DoxyCompactList}\small\item\em Check index is on free list. \item\end{DoxyCompactList}\item 
\hypertarget{classref__counter__pool_a6dfd0de094b906cc574966067f28876f}{
int32\_\-t \hyperlink{classref__counter__pool_a6dfd0de094b906cc574966067f28876f}{balance} () const }
\label{classref__counter__pool_a6dfd0de094b906cc574966067f28876f}

\begin{DoxyCompactList}\small\item\em Return number of valid ref pointer entries in pool. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \hyperlink{classref__counter__pool}{ref\_\-counter\_\-pool} \& \hyperlink{classref__counter__pool_afd41a41499303caadb605139b28c102e}{instance} ()
\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classref__counter__pool_ac3977ceded7eedb6c95aa13e299a8742}{
void \hyperlink{classref__counter__pool_ac3977ceded7eedb6c95aa13e299a8742}{grow} ()}
\label{classref__counter__pool_ac3977ceded7eedb6c95aa13e299a8742}

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

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

\item 
\hypertarget{classref__counter__pool_abc03b409bb1db2d6bfd5303ccdfde123}{
int32\_\-t {\bfseries \_\-balance}}
\label{classref__counter__pool_abc03b409bb1db2d6bfd5303ccdfde123}

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

\item 
\hypertarget{classref__counter__pool_aed53ce903ce20851c6312691e82f89bf}{
static \hyperlink{classref__counter__pool}{ref\_\-counter\_\-pool} {\bfseries \_\-the\_\-instance}}
\label{classref__counter__pool_aed53ce903ce20851c6312691e82f89bf}

\end{DoxyCompactItemize}


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

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


Sanity check internal data structure. 

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


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{classref__counter__pool_ac01b5b45b26cf7836bd75a1dd3f913bc}{
\index{ref\_\-counter\_\-pool@{ref\_\-counter\_\-pool}!decr\_\-counter@{decr\_\-counter}}
\index{decr\_\-counter@{decr\_\-counter}!ref_counter_pool@{ref\_\-counter\_\-pool}}
\subsubsection[{decr\_\-counter}]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t ref\_\-counter\_\-pool::decr\_\-counter (
\begin{DoxyParamCaption}
\item[{int32\_\-t}]{index}
\end{DoxyParamCaption}
)}}
\label{classref__counter__pool_ac01b5b45b26cf7836bd75a1dd3f913bc}


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{classref__counter__pool_ad10c805893e51dde7a88abee0d08188d}{
\index{ref\_\-counter\_\-pool@{ref\_\-counter\_\-pool}!dump@{dump}}
\index{dump@{dump}!ref_counter_pool@{ref\_\-counter\_\-pool}}
\subsubsection[{dump}]{\setlength{\rightskip}{0pt plus 5cm}void ref\_\-counter\_\-pool::dump (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classref__counter__pool_ad10c805893e51dde7a88abee0d08188d}


Dumps counter info to stdout. 

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


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{classref__counter__pool_afd41a41499303caadb605139b28c102e}{
\index{ref\_\-counter\_\-pool@{ref\_\-counter\_\-pool}!instance@{instance}}
\index{instance@{instance}!ref_counter_pool@{ref\_\-counter\_\-pool}}
\subsubsection[{instance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf ref\_\-counter\_\-pool} \& ref\_\-counter\_\-pool::instance (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}static\mbox{]}}}}
\label{classref__counter__pool_afd41a41499303caadb605139b28c102e}
\begin{DoxyReturn}{Returns}
singleton \hyperlink{classref__counter__pool}{ref\_\-counter\_\-pool}. 
\end{DoxyReturn}
\hypertarget{classref__counter__pool_ab91b5a6a8232bcb75a2fe3dec67caeca}{
\index{ref\_\-counter\_\-pool@{ref\_\-counter\_\-pool}!new\_\-counter@{new\_\-counter}}
\index{new\_\-counter@{new\_\-counter}!ref_counter_pool@{ref\_\-counter\_\-pool}}
\subsubsection[{new\_\-counter}]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t ref\_\-counter\_\-pool::new\_\-counter (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{classref__counter__pool_ab91b5a6a8232bcb75a2fe3dec67caeca}


Create a new counter. 

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


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}
