\hypertarget{classBuffer}{
\section{Buffer Class Reference}
\label{classBuffer}\index{Buffer@{Buffer}}
}


A class for storing buffered data.  




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

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classBuffer_afb7f259f4ef88a0e212f1479f97085b6}{Buffer} (size\_\-t init\_\-max\_\-size)
\begin{DoxyCompactList}\small\item\em Constructor of a buffer of specified size. \item\end{DoxyCompactList}\item 
\hypertarget{classBuffer_a59b8743e4a5f731bdd0c4185c9ef263b}{
\hyperlink{classBuffer_a59b8743e4a5f731bdd0c4185c9ef263b}{$\sim$Buffer} ()}
\label{classBuffer_a59b8743e4a5f731bdd0c4185c9ef263b}

\begin{DoxyCompactList}\small\item\em Destructor. \item\end{DoxyCompactList}\item 
\hypertarget{classBuffer_a52170368aefdfbbdcd4a4f79fbf66678}{
void \hyperlink{classBuffer_a52170368aefdfbbdcd4a4f79fbf66678}{reset} ()}
\label{classBuffer_a52170368aefdfbbdcd4a4f79fbf66678}

\begin{DoxyCompactList}\small\item\em Reset/remove \hyperlink{protocolthe-p}{the} data in \hyperlink{protocolthe-p}{the} buffer. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classBuffer_a859de565de84fd8ad24e3f130880b0cf}{max\_\-size} () const 
\item 
size\_\-t \hyperlink{classBuffer_a4e6f96c12ff48cdaa4b657a070de70de}{data\_\-size} () const 
\item 
uint8\_\-t \hyperlink{classBuffer_accc5f7dd8bb3754ec7c7636eca165282}{data} (size\_\-t offset) const   throw (InvalidBufferOffset)
\begin{DoxyCompactList}\small\item\em Get \hyperlink{protocolthe-p}{the} data value of \hyperlink{protocolthe-p}{the} octet at \hyperlink{protocolthe-p}{the} specified offset. \item\end{DoxyCompactList}\item 
uint8\_\-t $\ast$ \hyperlink{classBuffer_a3fffa6ecdfe859b5bf261ab30d07fec3}{data} ()
\item 
int \hyperlink{classBuffer_a1d8e5f830ede373ab1da41a6c247b1fa}{add\_\-data} (uint8\_\-t value)
\begin{DoxyCompactList}\small\item\em Add a data octet to \hyperlink{protocolthe-p}{the} buffer. \item\end{DoxyCompactList}\item 
bool \hyperlink{classBuffer_a79cfb05a9ab5ab4e167ee93cc11b7402}{is\_\-full} () const 
\begin{DoxyCompactList}\small\item\em Test if \hyperlink{protocolthe-p}{the} buffer is full. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classBuffer_ae48fe44ccc1141f8992b0823c7b1aabb}{
size\_\-t {\bfseries \_\-max\_\-size}}
\label{classBuffer_ae48fe44ccc1141f8992b0823c7b1aabb}

\item 
\hypertarget{classBuffer_ae2eb602d360c22de41d9c9a3c3f13a2d}{
size\_\-t {\bfseries \_\-cur\_\-size}}
\label{classBuffer_ae2eb602d360c22de41d9c9a3c3f13a2d}

\item 
\hypertarget{classBuffer_a491e5f49739dfd0d67884f269b598072}{
uint8\_\-t $\ast$ {\bfseries \_\-data}}
\label{classBuffer_a491e5f49739dfd0d67884f269b598072}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
A class for storing buffered data. This class can be used to conveniently store data. Note: currently it has limited functionalities; more will be added in \hyperlink{protocolthe-p}{the} future. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classBuffer_afb7f259f4ef88a0e212f1479f97085b6}{
\index{Buffer@{Buffer}!Buffer@{Buffer}}
\index{Buffer@{Buffer}!Buffer@{Buffer}}
\subsubsection[{Buffer}]{\setlength{\rightskip}{0pt plus 5cm}Buffer::Buffer (
\begin{DoxyParamCaption}
\item[{size\_\-t}]{init\_\-max\_\-size}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, explicit\mbox{]}}}}
\label{classBuffer_afb7f259f4ef88a0e212f1479f97085b6}


Constructor of a buffer of specified size. 


\begin{DoxyParams}{Parameters}
{\em init\_\-max\_\-size} & \hyperlink{protocolthe-p}{the} maximum amount of data that can be stored in \hyperlink{protocolthe-p}{the} buffer. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{classBuffer_a1d8e5f830ede373ab1da41a6c247b1fa}{
\index{Buffer@{Buffer}!add\_\-data@{add\_\-data}}
\index{add\_\-data@{add\_\-data}!Buffer@{Buffer}}
\subsubsection[{add\_\-data}]{\setlength{\rightskip}{0pt plus 5cm}int Buffer::add\_\-data (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{value}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classBuffer_a1d8e5f830ede373ab1da41a6c247b1fa}


Add a data octet to \hyperlink{protocolthe-p}{the} buffer. 


\begin{DoxyParams}{Parameters}
{\em value} & \hyperlink{protocolthe-p}{the} value of \hyperlink{protocolthe-p}{the} data octet to add to \hyperlink{protocolthe-p}{the} buffer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
XORP\_\-OK on success, otherwise XORP\_\-ERROR. 
\end{DoxyReturn}
\hypertarget{classBuffer_a3fffa6ecdfe859b5bf261ab30d07fec3}{
\index{Buffer@{Buffer}!data@{data}}
\index{data@{data}!Buffer@{Buffer}}
\subsubsection[{data}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t$\ast$ Buffer::data (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classBuffer_a3fffa6ecdfe859b5bf261ab30d07fec3}
\begin{DoxyReturn}{Returns}
a pointer to \hyperlink{protocolthe-p}{the} data in \hyperlink{protocolthe-p}{the} buffer. 
\end{DoxyReturn}
\hypertarget{classBuffer_accc5f7dd8bb3754ec7c7636eca165282}{
\index{Buffer@{Buffer}!data@{data}}
\index{data@{data}!Buffer@{Buffer}}
\subsubsection[{data}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t Buffer::data (
\begin{DoxyParamCaption}
\item[{size\_\-t}]{offset}
\end{DoxyParamCaption}
) const  throw ({\bf InvalidBufferOffset})\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classBuffer_accc5f7dd8bb3754ec7c7636eca165282}


Get \hyperlink{protocolthe-p}{the} data value of \hyperlink{protocolthe-p}{the} octet at \hyperlink{protocolthe-p}{the} specified offset. 


\begin{DoxyParams}{Parameters}
{\em offset} & \hyperlink{protocolthe-p}{the} data offset from \hyperlink{protocolthe-p}{the} beginning of \hyperlink{protocolthe-p}{the} buffer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} data value at offset. 
\end{DoxyReturn}
\hypertarget{classBuffer_a4e6f96c12ff48cdaa4b657a070de70de}{
\index{Buffer@{Buffer}!data\_\-size@{data\_\-size}}
\index{data\_\-size@{data\_\-size}!Buffer@{Buffer}}
\subsubsection[{data\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Buffer::data\_\-size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classBuffer_a4e6f96c12ff48cdaa4b657a070de70de}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} amount of data in \hyperlink{protocolthe-p}{the} buffer. 
\end{DoxyReturn}
\hypertarget{classBuffer_a79cfb05a9ab5ab4e167ee93cc11b7402}{
\index{Buffer@{Buffer}!is\_\-full@{is\_\-full}}
\index{is\_\-full@{is\_\-full}!Buffer@{Buffer}}
\subsubsection[{is\_\-full}]{\setlength{\rightskip}{0pt plus 5cm}bool Buffer::is\_\-full (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classBuffer_a79cfb05a9ab5ab4e167ee93cc11b7402}


Test if \hyperlink{protocolthe-p}{the} buffer is full. 

\begin{DoxyReturn}{Returns}
true if \hyperlink{protocolthe-p}{the} buffer is full, otherwise false. 
\end{DoxyReturn}
\hypertarget{classBuffer_a859de565de84fd8ad24e3f130880b0cf}{
\index{Buffer@{Buffer}!max\_\-size@{max\_\-size}}
\index{max\_\-size@{max\_\-size}!Buffer@{Buffer}}
\subsubsection[{max\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t Buffer::max\_\-size (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classBuffer_a859de565de84fd8ad24e3f130880b0cf}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} maximum amount of data that can be stored in \hyperlink{protocolthe-p}{the} buffer. 
\end{DoxyReturn}


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