\hypertarget{opal__ring__buffer_8h}{\section{opal/class/opal\+\_\+ring\+\_\+buffer.h File Reference}
\label{opal__ring__buffer_8h}\index{opal/class/opal\+\_\+ring\+\_\+buffer.\+h@{opal/class/opal\+\_\+ring\+\_\+buffer.\+h}}
}
{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/threads/threads.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/class/opal\+\_\+object.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}opal/util/output.\+h\char`\"{}}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t}
\begin{DoxyCompactList}\small\item\em dynamic pointer ring \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\hypertarget{opal__ring__buffer_8h_a57511f53ec1926e8ff83897507688dd0}{typedef struct \hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t} \hyperlink{opal__ring__buffer_8h_a57511f53ec1926e8ff83897507688dd0}{opal\+\_\+ring\+\_\+buffer\+\_\+t}}\label{opal__ring__buffer_8h_a57511f53ec1926e8ff83897507688dd0}

\begin{DoxyCompactList}\small\item\em Convenience typedef. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{opal__ring__buffer_8h_a257c38163b51b090dc35c5896e104b8c}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \hyperlink{opal__ring__buffer_8h_a257c38163b51b090dc35c5896e104b8c}{O\+B\+J\+\_\+\+C\+L\+A\+S\+S\+\_\+\+D\+E\+C\+L\+A\+R\+A\+T\+I\+O\+N} (\hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t})}\label{opal__ring__buffer_8h_a257c38163b51b090dc35c5896e104b8c}

\begin{DoxyCompactList}\small\item\em Class declaration. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{opal__ring__buffer_8h_a8c16624a9cb2cdca705418c42b2b84b0}{opal\+\_\+ring\+\_\+buffer\+\_\+init} (\hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$ring, int size)
\begin{DoxyCompactList}\small\item\em Initialize the ring buffer, defining its size. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void $\ast$ \hyperlink{opal__ring__buffer_8h_aa24320a6b4f36fb6e033ad515900a059}{opal\+\_\+ring\+\_\+buffer\+\_\+push} (\hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$ring, void $\ast$ptr)
\begin{DoxyCompactList}\small\item\em Push an item onto the ring buffer. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void $\ast$ \hyperlink{opal__ring__buffer_8h_a7cfa195c048e1de23dc560b3faab6553}{opal\+\_\+ring\+\_\+buffer\+\_\+pop} (\hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$ring)
\begin{DoxyCompactList}\small\item\em Pop an item off of the ring. \end{DoxyCompactList}\item 
\hypertarget{opal__ring__buffer_8h_a771bc332a7da916745c42c8169130a53}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void $\ast$ {\bfseries opal\+\_\+ring\+\_\+buffer\+\_\+poke} (\hyperlink{structopal__ring__buffer__t}{opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$ring, int i)}\label{opal__ring__buffer_8h_a771bc332a7da916745c42c8169130a53}

\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{opal__ring__buffer_8h_a8c16624a9cb2cdca705418c42b2b84b0}{\index{opal\+\_\+ring\+\_\+buffer.\+h@{opal\+\_\+ring\+\_\+buffer.\+h}!opal\+\_\+ring\+\_\+buffer\+\_\+init@{opal\+\_\+ring\+\_\+buffer\+\_\+init}}
\index{opal\+\_\+ring\+\_\+buffer\+\_\+init@{opal\+\_\+ring\+\_\+buffer\+\_\+init}!opal\+\_\+ring\+\_\+buffer.\+h@{opal\+\_\+ring\+\_\+buffer.\+h}}
\subsubsection[{opal\+\_\+ring\+\_\+buffer\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+ring\+\_\+buffer\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$}]{ring, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}}\label{opal__ring__buffer_8h_a8c16624a9cb2cdca705418c42b2b84b0}


Initialize the ring buffer, defining its size. 


\begin{DoxyParams}{Parameters}
{\em ring} & Pointer to a ring buffer (I\+N/\+O\+U\+T) \\
\hline
{\em size} & The number of elements in the ring (I\+N)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S if all initializations were succesful. Otherwise, the error indicate what went wrong in the function.
\end{DoxyReturn}
Initialize the ring buffer, defining its size. 

References opal\+\_\+ring\+\_\+buffer\+\_\+t\+::addr, opal\+\_\+ring\+\_\+buffer\+\_\+t\+::size, and opal\+\_\+pointer\+\_\+array\+\_\+t\+::size.

\hypertarget{opal__ring__buffer_8h_a7cfa195c048e1de23dc560b3faab6553}{\index{opal\+\_\+ring\+\_\+buffer.\+h@{opal\+\_\+ring\+\_\+buffer.\+h}!opal\+\_\+ring\+\_\+buffer\+\_\+pop@{opal\+\_\+ring\+\_\+buffer\+\_\+pop}}
\index{opal\+\_\+ring\+\_\+buffer\+\_\+pop@{opal\+\_\+ring\+\_\+buffer\+\_\+pop}!opal\+\_\+ring\+\_\+buffer.\+h@{opal\+\_\+ring\+\_\+buffer.\+h}}
\subsubsection[{opal\+\_\+ring\+\_\+buffer\+\_\+pop}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void$\ast$ opal\+\_\+ring\+\_\+buffer\+\_\+pop (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$}]{ring}
\end{DoxyParamCaption}
)}}\label{opal__ring__buffer_8h_a7cfa195c048e1de23dc560b3faab6553}


Pop an item off of the ring. 

The oldest entry on the ring will be returned. If nothing on the ring, N\+U\+L\+L is returned.


\begin{DoxyParams}{Parameters}
{\em ring} & Pointer to ring (I\+N)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Error code. N\+U\+L\+L indicates an error. 
\end{DoxyReturn}


References opal\+\_\+ring\+\_\+buffer\+\_\+t\+::addr, opal\+\_\+ring\+\_\+buffer\+\_\+t\+::lock, and opal\+\_\+ring\+\_\+buffer\+\_\+t\+::size.

\hypertarget{opal__ring__buffer_8h_aa24320a6b4f36fb6e033ad515900a059}{\index{opal\+\_\+ring\+\_\+buffer.\+h@{opal\+\_\+ring\+\_\+buffer.\+h}!opal\+\_\+ring\+\_\+buffer\+\_\+push@{opal\+\_\+ring\+\_\+buffer\+\_\+push}}
\index{opal\+\_\+ring\+\_\+buffer\+\_\+push@{opal\+\_\+ring\+\_\+buffer\+\_\+push}!opal\+\_\+ring\+\_\+buffer.\+h@{opal\+\_\+ring\+\_\+buffer.\+h}}
\subsubsection[{opal\+\_\+ring\+\_\+buffer\+\_\+push}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C void$\ast$ opal\+\_\+ring\+\_\+buffer\+\_\+push (
\begin{DoxyParamCaption}
\item[{{\bf opal\+\_\+ring\+\_\+buffer\+\_\+t} $\ast$}]{ring, }
\item[{void $\ast$}]{ptr}
\end{DoxyParamCaption}
)}}\label{opal__ring__buffer_8h_aa24320a6b4f36fb6e033ad515900a059}


Push an item onto the ring buffer. 


\begin{DoxyParams}{Parameters}
{\em ring} & Pointer to ring (I\+N) \\
\hline
{\em ptr} & Pointer value (I\+N)\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
O\+P\+A\+L\+\_\+\+S\+U\+C\+C\+E\+S\+S. Returns error if ring cannot take another entry 
\end{DoxyReturn}


References opal\+\_\+ring\+\_\+buffer\+\_\+t\+::addr, opal\+\_\+ring\+\_\+buffer\+\_\+t\+::lock, and opal\+\_\+ring\+\_\+buffer\+\_\+t\+::size.

