\hypertarget{classAsyncFileReader}{
\section{AsyncFileReader Class Reference}
\label{classAsyncFileReader}\index{AsyncFileReader@{AsyncFileReader}}
}


Read asynchronously from a file.  




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

Inheritance diagram for AsyncFileReader:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classAsyncFileReader}
\end{center}
\end{figure}
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
class \hyperlink{classAsyncFileReader_1_1BufferInfo}{BufferInfo}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classAsyncFileReader_a4dfcbda5a192ccf512b4c7172022fea3}{AsyncFileReader} (\hyperlink{classEventLoop}{EventLoop} \&e, \hyperlink{classXorpFd}{XorpFd} fd, int priority=XorpTask::PRIORITY\_\-DEFAULT)
\item 
void \hyperlink{classAsyncFileReader_aa92ab234bfd44a68c5ff209dd7e1749f}{add\_\-buffer} (uint8\_\-t $\ast$buffer, size\_\-t buffer\_\-bytes, const \hyperlink{classAsyncFileOperator_a12e626e2da12221a9f4333df89ad9ffe}{Callback} \&cb)
\begin{DoxyCompactList}\small\item\em Add an additional buffer for reading to. \item\end{DoxyCompactList}\item 
void \hyperlink{classAsyncFileReader_af34d671bf0ad7bd1ad9145653edecde8}{add\_\-buffer\_\-with\_\-offset} (uint8\_\-t $\ast$buffer, size\_\-t buffer\_\-bytes, size\_\-t offset, const \hyperlink{classAsyncFileOperator_a12e626e2da12221a9f4333df89ad9ffe}{Callback} \&cb)
\begin{DoxyCompactList}\small\item\em Add an additional buffer for reading to. \item\end{DoxyCompactList}\item 
bool \hyperlink{classAsyncFileReader_ae3a877c216a394f60e736213f0056837}{start} ()
\begin{DoxyCompactList}\small\item\em Start asynchronous operation. \item\end{DoxyCompactList}\item 
\hypertarget{classAsyncFileReader_a5cefb60d0bdcd623bba5fc2724ea398a}{
void \hyperlink{classAsyncFileReader_a5cefb60d0bdcd623bba5fc2724ea398a}{stop} ()}
\label{classAsyncFileReader_a5cefb60d0bdcd623bba5fc2724ea398a}

\begin{DoxyCompactList}\small\item\em Stop asynchronous operation. \item\end{DoxyCompactList}\item 
size\_\-t \hyperlink{classAsyncFileReader_a62f5167b1bf13096a4a7509c9c45b4c8}{buffers\_\-remaining} () const 
\item 
\hypertarget{classAsyncFileReader_aa72c6f40f2245dbd6de32643150be870}{
void \hyperlink{classAsyncFileReader_aa72c6f40f2245dbd6de32643150be870}{flush\_\-buffers} ()}
\label{classAsyncFileReader_aa72c6f40f2245dbd6de32643150be870}

\begin{DoxyCompactList}\small\item\em Stop asynchronous operation and clear list of buffers. \item\end{DoxyCompactList}\item 
\hypertarget{classAsyncFileReader_ae15598e1852bdec08769e430c51e7ac7}{
virtual string {\bfseries toString} () const }
\label{classAsyncFileReader_ae15598e1852bdec08769e430c51e7ac7}

\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classAsyncFileReader_a5d01335a74f60d923f319a514bd34a96}{
void {\bfseries read} (\hyperlink{classXorpFd}{XorpFd} fd, IoEventType type)}
\label{classAsyncFileReader_a5d01335a74f60d923f319a514bd34a96}

\item 
\hypertarget{classAsyncFileReader_a7e860bf866b2ac4f45f8bf0a8fff1f5d}{
void {\bfseries complete\_\-transfer} (int err, ssize\_\-t done)}
\label{classAsyncFileReader_a7e860bf866b2ac4f45f8bf0a8fff1f5d}

\end{DoxyCompactItemize}
\subsection*{Protected Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{classAsyncFileReader_a974dfd86ddb22828fb70a69ab2774f4a}{
list$<$ \hyperlink{classAsyncFileReader_1_1BufferInfo}{BufferInfo} $\ast$ $>$ {\bfseries \_\-buffers}}
\label{classAsyncFileReader_a974dfd86ddb22828fb70a69ab2774f4a}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
Read asynchronously from a file. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classAsyncFileReader_a4dfcbda5a192ccf512b4c7172022fea3}{
\index{AsyncFileReader@{AsyncFileReader}!AsyncFileReader@{AsyncFileReader}}
\index{AsyncFileReader@{AsyncFileReader}!AsyncFileReader@{AsyncFileReader}}
\subsubsection[{AsyncFileReader}]{\setlength{\rightskip}{0pt plus 5cm}AsyncFileReader::AsyncFileReader (
\begin{DoxyParamCaption}
\item[{{\bf EventLoop} \&}]{e, }
\item[{{\bf XorpFd}}]{fd, }
\item[{int}]{priority = {\ttfamily XorpTask::PRIORITY\_\-DEFAULT}}
\end{DoxyParamCaption}
)}}
\label{classAsyncFileReader_a4dfcbda5a192ccf512b4c7172022fea3}

\begin{DoxyParams}{Parameters}
{\em e} & \hyperlink{classEventLoop}{EventLoop} that object should associate itself with. \\
\hline
{\em fd} & a file descriptor to read from. \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\hypertarget{classAsyncFileReader_aa92ab234bfd44a68c5ff209dd7e1749f}{
\index{AsyncFileReader@{AsyncFileReader}!add\_\-buffer@{add\_\-buffer}}
\index{add\_\-buffer@{add\_\-buffer}!AsyncFileReader@{AsyncFileReader}}
\subsubsection[{add\_\-buffer}]{\setlength{\rightskip}{0pt plus 5cm}void AsyncFileReader::add\_\-buffer (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{buffer, }
\item[{size\_\-t}]{buffer\_\-bytes, }
\item[{const {\bf Callback} \&}]{cb}
\end{DoxyParamCaption}
)}}
\label{classAsyncFileReader_aa92ab234bfd44a68c5ff209dd7e1749f}


Add an additional buffer for reading to. 

Note that \hyperlink{protocolthe-p}{the} buffer with \hyperlink{protocolthe-p}{the} data is managed by \hyperlink{protocolthe-p}{the} user.


\begin{DoxyParams}{Parameters}
{\em buffer} & pointer to buffer. \\
\hline
{\em buffer\_\-bytes} & size of buffer in bytes. \\
\hline
{\em cb} & Callback object to invoke when I/O is performed. \\
\hline
\end{DoxyParams}
\hypertarget{classAsyncFileReader_af34d671bf0ad7bd1ad9145653edecde8}{
\index{AsyncFileReader@{AsyncFileReader}!add\_\-buffer\_\-with\_\-offset@{add\_\-buffer\_\-with\_\-offset}}
\index{add\_\-buffer\_\-with\_\-offset@{add\_\-buffer\_\-with\_\-offset}!AsyncFileReader@{AsyncFileReader}}
\subsubsection[{add\_\-buffer\_\-with\_\-offset}]{\setlength{\rightskip}{0pt plus 5cm}void AsyncFileReader::add\_\-buffer\_\-with\_\-offset (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{buffer, }
\item[{size\_\-t}]{buffer\_\-bytes, }
\item[{size\_\-t}]{offset, }
\item[{const {\bf Callback} \&}]{cb}
\end{DoxyParamCaption}
)}}
\label{classAsyncFileReader_af34d671bf0ad7bd1ad9145653edecde8}


Add an additional buffer for reading to. 

Note that \hyperlink{protocolthe-p}{the} buffer with \hyperlink{protocolthe-p}{the} data is managed by \hyperlink{protocolthe-p}{the} user.


\begin{DoxyParams}{Parameters}
{\em buffer} & pointer to buffer. \\
\hline
{\em buffer\_\-bytes} & size of buffer in bytes. \\
\hline
{\em offset} & starting point for read operation. \\
\hline
{\em cb} & Callback object to invoke when I/O is performed. \\
\hline
\end{DoxyParams}
\hypertarget{classAsyncFileReader_a62f5167b1bf13096a4a7509c9c45b4c8}{
\index{AsyncFileReader@{AsyncFileReader}!buffers\_\-remaining@{buffers\_\-remaining}}
\index{buffers\_\-remaining@{buffers\_\-remaining}!AsyncFileReader@{AsyncFileReader}}
\subsubsection[{buffers\_\-remaining}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t AsyncFileReader::buffers\_\-remaining (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classAsyncFileReader_a62f5167b1bf13096a4a7509c9c45b4c8}
\begin{DoxyReturn}{Returns}
\hyperlink{protocolthe-p}{the} number of buffers available. 
\end{DoxyReturn}


Implements \hyperlink{classAsyncFileOperator_a3fc1507061761564f4451d62cdb374a8}{AsyncFileOperator}.

\hypertarget{classAsyncFileReader_ae3a877c216a394f60e736213f0056837}{
\index{AsyncFileReader@{AsyncFileReader}!start@{start}}
\index{start@{start}!AsyncFileReader@{AsyncFileReader}}
\subsubsection[{start}]{\setlength{\rightskip}{0pt plus 5cm}bool AsyncFileReader::start (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{classAsyncFileReader_ae3a877c216a394f60e736213f0056837}


Start asynchronous operation. 

\begin{DoxyReturn}{Returns}
true on success, false if no buffers are available. 
\end{DoxyReturn}


Implements \hyperlink{classAsyncFileOperator_a3778390e8288097d3569833418d0728b}{AsyncFileOperator}.



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