\section{TPProto::Event\-Loop Class Reference}
\label{classTPProto_1_1EventLoop}\index{TPProto::EventLoop@{TPProto::EventLoop}}
Interface to the client's event loop.  


{\tt \#include $<$eventloop.h$>$}

Inheritance diagram for TPProto::Event\-Loop::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{classTPProto_1_1EventLoop}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual {\bf $\sim$Event\-Loop} ()
\item 
virtual void {\bf listen\-For\-Socket\-Read} ({\bf TPSocket} $\ast$sock)=0
\begin{CompactList}\small\item\em Gives a \doxyref{TPSocket}{p.}{classTPProto_1_1TPSocket} to the event loop to be alerted when it's ready to read. \item\end{CompactList}\item 
virtual void {\bf listen\-For\-Socket\-Write} ({\bf TPSocket} $\ast$sock)=0
\begin{CompactList}\small\item\em Gives a \doxyref{TPSocket}{p.}{classTPProto_1_1TPSocket} to the event loop to be alerted when it's ready to write. \item\end{CompactList}\item 
virtual Timer\-Connection {\bf set\-Timer} (uint32\_\-t interval, const Timer\-Signal::slot\_\-type \&callback)=0
\begin{CompactList}\small\item\em Sets up a timer to call in a given interval. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Interface to the client's event loop. 

This class should be subclassed in every client to provide a way of integrating with the existing event loop, or a new event loop if required. 



\subsection{Constructor \& Destructor Documentation}
\index{TPProto::EventLoop@{TPProto::Event\-Loop}!~EventLoop@{$\sim$EventLoop}}
\index{~EventLoop@{$\sim$EventLoop}!TPProto::EventLoop@{TPProto::Event\-Loop}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual TPProto::Event\-Loop::$\sim$Event\-Loop ()\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classTPProto_1_1EventLoop_ff9174368d5f3d9dfc85c74588e32c9e}


Required virtual destructor. 

\subsection{Member Function Documentation}
\index{TPProto::EventLoop@{TPProto::Event\-Loop}!listenForSocketRead@{listenForSocketRead}}
\index{listenForSocketRead@{listenForSocketRead}!TPProto::EventLoop@{TPProto::Event\-Loop}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void TPProto::Event\-Loop::listen\-For\-Socket\-Read ({\bf TPSocket} $\ast$ {\em sock})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classTPProto_1_1EventLoop_116da973a0302956c9714447d56f8123}


Gives a \doxyref{TPSocket}{p.}{classTPProto_1_1TPSocket} to the event loop to be alerted when it's ready to read. 

This needs to be implemented to have the TPSocket::is\-Ready\-To\-Read() method called when there is data waiting for the socket.

The socket is removed when it is disconnected.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]The \doxyref{TPSocket}{p.}{classTPProto_1_1TPSocket} to check \end{description}
\end{Desc}


Implemented in {\bf TPProto::Simple\-Event\-Loop} \doxyref{}{p.}{classTPProto_1_1SimpleEventLoop_3e87ca2f0db639529f6ec44b4f04f820}.\index{TPProto::EventLoop@{TPProto::Event\-Loop}!listenForSocketWrite@{listenForSocketWrite}}
\index{listenForSocketWrite@{listenForSocketWrite}!TPProto::EventLoop@{TPProto::Event\-Loop}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void TPProto::Event\-Loop::listen\-For\-Socket\-Write ({\bf TPSocket} $\ast$ {\em sock})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classTPProto_1_1EventLoop_421dea7164dac6ce1336e91340f4f90e}


Gives a \doxyref{TPSocket}{p.}{classTPProto_1_1TPSocket} to the event loop to be alerted when it's ready to write. 

This needs to be implemented to have the TPSocket::is\-Ready\-To\-Send() method called when the socket is ready to send data.

This is a single shot, and should be disabled from from being triggered again $<$emph$>$before$<$/emph$>$ calling TPSocket::is\-Ready\-To\-Send(). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sock}]The \doxyref{TPSocket}{p.}{classTPProto_1_1TPSocket} to check \end{description}
\end{Desc}


Implemented in {\bf TPProto::Simple\-Event\-Loop} \doxyref{}{p.}{classTPProto_1_1SimpleEventLoop_50e30d8c2d233c5d79dc4b54eeebb700}.\index{TPProto::EventLoop@{TPProto::Event\-Loop}!setTimer@{setTimer}}
\index{setTimer@{setTimer}!TPProto::EventLoop@{TPProto::Event\-Loop}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual Timer\-Connection TPProto::Event\-Loop::set\-Timer (uint32\_\-t {\em interval}, const Timer\-Signal::slot\_\-type \& {\em callback})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classTPProto_1_1EventLoop_4c1db4624a9bb1665a65ed30f8f25f4f}


Sets up a timer to call in a given interval. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em interval}]The time interval before calling, in seconds \item[{\em callback}]The slot/callback to call when the timer expires. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A Timer\-Connection to be managed by the caller. \end{Desc}


Implemented in {\bf TPProto::Simple\-Event\-Loop} \doxyref{}{p.}{classTPProto_1_1SimpleEventLoop_95f15f745e42c8d42f4777d549900405}.

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
tpproto/{\bf eventloop.h}\end{CompactItemize}
