\hypertarget{class_b_m_a_e_poll}{}\section{B\+M\+A\+E\+Poll Class Reference}
\label{class_b_m_a_e_poll}\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}


{\ttfamily \#include $<$B\+M\+A\+E\+Poll.\+h$>$}



Inheritance diagram for B\+M\+A\+E\+Poll\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=163pt]{class_b_m_a_e_poll__inherit__graph}
\end{center}
\end{figure}


Collaboration diagram for B\+M\+A\+E\+Poll\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=163pt]{class_b_m_a_e_poll__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_b_m_a_e_poll_a08b51ef366ca08d2153678b01da5d71a}{B\+M\+A\+E\+Poll} ()
\item 
\hyperlink{class_b_m_a_e_poll_aa24f7f723450c7b4912ec29bed623b61}{$\sim$\+B\+M\+A\+E\+Poll} ()
\item 
bool \hyperlink{class_b_m_a_e_poll_af47f8a2e6b6945ac0cd9b507d085759b}{start} (int number\+Of\+Threads, int \hyperlink{class_b_m_a_e_poll_ad95e44649fb029c8bbdccfa952109fe8}{max\+Sockets})
\begin{DoxyCompactList}\small\item\em Start the \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} processing. \end{DoxyCompactList}\item 
bool \hyperlink{class_b_m_a_e_poll_a86db128e32aceb4203258900dce9cb9f}{stop} ()
\begin{DoxyCompactList}\small\item\em Stop and shut down the \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} processing. \end{DoxyCompactList}\item 
bool \hyperlink{class_b_m_a_e_poll_a0cb441876d88e2d483eca02958836649}{is\+Stopping} ()
\begin{DoxyCompactList}\small\item\em Returns a true if the stop command has been requested. \end{DoxyCompactList}\item 
bool \hyperlink{class_b_m_a_e_poll_a3eaabc21ed4f292346b708ebe5e70601}{register\+Socket} (\hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} $\ast$socket)
\begin{DoxyCompactList}\small\item\em Register a \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} for monitoring by \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll}. \end{DoxyCompactList}\item 
bool \hyperlink{class_b_m_a_e_poll_a791e51a702810e36f2f4220528ee998d}{unregister\+Socket} (\hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} $\ast$socket)
\begin{DoxyCompactList}\small\item\em Unregister a \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} from monitoring by \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll}. \end{DoxyCompactList}\item 
int \hyperlink{class_b_m_a_e_poll_ad2feb77e1283f3245c516b585bd7ce42}{get\+Descriptor} ()
\begin{DoxyCompactList}\small\item\em Return the descriptor for the e\+Poll socket. \end{DoxyCompactList}\item 
void \hyperlink{class_b_m_a_e_poll_ac9d1120bcd2ef941711e02e9337c839c}{event\+Received} (struct epoll\+\_\+event event)
\begin{DoxyCompactList}\small\item\em Dispatch event to appropriate socket. \end{DoxyCompactList}\item 
void \hyperlink{class_b_m_a_e_poll_a5879546f43f04c888a40542eb9ad931b}{process\+Command} (std\+::string command, \hyperlink{class_b_m_a_session}{B\+M\+A\+Session} $\ast$session) override
\begin{DoxyCompactList}\small\item\em Output the threads array to the console. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{class_b_m_a_e_poll_ad95e44649fb029c8bbdccfa952109fe8}{max\+Sockets}
\begin{DoxyCompactList}\small\item\em The maximum number of socket allowed. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll}

Manage socket events from the epoll system call.

Use this object to establish a socket server using the epoll network structure of Linux.

Use this object to establish the basis of working with multiple sockets of all sorts using the epoll capabilities of the Linux platform. Socket objects can register with \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} which will establish a communication mechanism with that socket.

The maximum number of sockets to communicate with is specified on the start method.

Threads are used to establish a read queue for epoll. The desired number of threads (or queues) is established by a parameter on the start method. 

\subsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_b_m_a_e_poll_a08b51ef366ca08d2153678b01da5d71a}\label{class_b_m_a_e_poll_a08b51ef366ca08d2153678b01da5d71a}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{B\+M\+A\+E\+Poll()}{BMAEPoll()}}
{\footnotesize\ttfamily B\+M\+A\+E\+Poll\+::\+B\+M\+A\+E\+Poll (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

The constructor for the \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} object. \mbox{\Hypertarget{class_b_m_a_e_poll_aa24f7f723450c7b4912ec29bed623b61}\label{class_b_m_a_e_poll_aa24f7f723450c7b4912ec29bed623b61}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!````~B\+M\+A\+E\+Poll@{$\sim$\+B\+M\+A\+E\+Poll}}
\index{````~B\+M\+A\+E\+Poll@{$\sim$\+B\+M\+A\+E\+Poll}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{$\sim$\+B\+M\+A\+E\+Poll()}{~BMAEPoll()}}
{\footnotesize\ttfamily B\+M\+A\+E\+Poll\+::$\sim$\+B\+M\+A\+E\+Poll (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}

The destructor for the \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} object. 

\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_b_m_a_e_poll_ac9d1120bcd2ef941711e02e9337c839c}\label{class_b_m_a_e_poll_ac9d1120bcd2ef941711e02e9337c839c}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!event\+Received@{event\+Received}}
\index{event\+Received@{event\+Received}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{event\+Received()}{eventReceived()}}
{\footnotesize\ttfamily void B\+M\+A\+E\+Poll\+::event\+Received (\begin{DoxyParamCaption}\item[{struct epoll\+\_\+event}]{event }\end{DoxyParamCaption})}



Dispatch event to appropriate socket. 

Receive the epoll events and dispatch the event to the socket making the request. \mbox{\Hypertarget{class_b_m_a_e_poll_ad2feb77e1283f3245c516b585bd7ce42}\label{class_b_m_a_e_poll_ad2feb77e1283f3245c516b585bd7ce42}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!get\+Descriptor@{get\+Descriptor}}
\index{get\+Descriptor@{get\+Descriptor}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{get\+Descriptor()}{getDescriptor()}}
{\footnotesize\ttfamily int B\+M\+A\+E\+Poll\+::get\+Descriptor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Return the descriptor for the e\+Poll socket. 

Use this method to obtain the current descriptor socket number for the epoll function call. \mbox{\Hypertarget{class_b_m_a_e_poll_a0cb441876d88e2d483eca02958836649}\label{class_b_m_a_e_poll_a0cb441876d88e2d483eca02958836649}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!is\+Stopping@{is\+Stopping}}
\index{is\+Stopping@{is\+Stopping}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{is\+Stopping()}{isStopping()}}
{\footnotesize\ttfamily bool B\+M\+A\+E\+Poll\+::is\+Stopping (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a true if the stop command has been requested. 

This method returns a true if the \hyperlink{class_b_m_a_e_poll_a86db128e32aceb4203258900dce9cb9f}{stop()} method has been called and the epoll system is shutting. \mbox{\Hypertarget{class_b_m_a_e_poll_a5879546f43f04c888a40542eb9ad931b}\label{class_b_m_a_e_poll_a5879546f43f04c888a40542eb9ad931b}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!process\+Command@{process\+Command}}
\index{process\+Command@{process\+Command}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{process\+Command()}{processCommand()}}
{\footnotesize\ttfamily void B\+M\+A\+E\+Poll\+::process\+Command (\begin{DoxyParamCaption}\item[{std\+::string}]{command,  }\item[{\hyperlink{class_b_m_a_session}{B\+M\+A\+Session} $\ast$}]{session }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [virtual]}}



Output the threads array to the console. 

The \hyperlink{class_b_m_a_e_poll_a5879546f43f04c888a40542eb9ad931b}{process\+Command()} method displays the thread array to the requesting console via the session passed as parameter.


\begin{DoxyParams}{Parameters}
{\em session} & the session to write the requested data to. \\
\hline
\end{DoxyParams}


Implements \hyperlink{class_b_m_a_command}{B\+M\+A\+Command}.

\mbox{\Hypertarget{class_b_m_a_e_poll_a3eaabc21ed4f292346b708ebe5e70601}\label{class_b_m_a_e_poll_a3eaabc21ed4f292346b708ebe5e70601}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!register\+Socket@{register\+Socket}}
\index{register\+Socket@{register\+Socket}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{register\+Socket()}{registerSocket()}}
{\footnotesize\ttfamily bool B\+M\+A\+E\+Poll\+::register\+Socket (\begin{DoxyParamCaption}\item[{\hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} $\ast$}]{socket }\end{DoxyParamCaption})}



Register a \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} for monitoring by \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll}. 

Use register\+Socket to add a new socket to the e\+Poll event watch list. This enables a new \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} object to receive events when data is received as well as to write data output to the socket.


\begin{DoxyParams}{Parameters}
{\em socket} & a pointer to a \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a booelean that indicates the socket was registered or not. 
\end{DoxyReturn}

\begin{DoxyParams}{Parameters}
{\em socket} & The \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} to register. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_b_m_a_e_poll_af47f8a2e6b6945ac0cd9b507d085759b}\label{class_b_m_a_e_poll_af47f8a2e6b6945ac0cd9b507d085759b}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!start@{start}}
\index{start@{start}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{start()}{start()}}
{\footnotesize\ttfamily bool B\+M\+A\+E\+Poll\+::start (\begin{DoxyParamCaption}\item[{int}]{number\+Of\+Threads,  }\item[{int}]{max\+Sockets }\end{DoxyParamCaption})}



Start the \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} processing. 

Use the \hyperlink{class_b_m_a_e_poll_af47f8a2e6b6945ac0cd9b507d085759b}{start()} method to initiate the threads and begin epoll queue processing.


\begin{DoxyParams}{Parameters}
{\em number\+Of\+Threads} & the number of threads to start for processing epoll entries. \\
\hline
{\em max\+Sockets} & the maximum number of open sockets that epoll will manage. \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{class_b_m_a_e_poll_a86db128e32aceb4203258900dce9cb9f}\label{class_b_m_a_e_poll_a86db128e32aceb4203258900dce9cb9f}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!stop@{stop}}
\index{stop@{stop}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{stop()}{stop()}}
{\footnotesize\ttfamily bool B\+M\+A\+E\+Poll\+::stop (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Stop and shut down the \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll} processing. 

Use the \hyperlink{class_b_m_a_e_poll_a86db128e32aceb4203258900dce9cb9f}{stop()} method to initiate the shutdown process for the epoll socket management.

A complete shutdown of all managed sockets will be initiated by this method call. \mbox{\Hypertarget{class_b_m_a_e_poll_a791e51a702810e36f2f4220528ee998d}\label{class_b_m_a_e_poll_a791e51a702810e36f2f4220528ee998d}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!unregister\+Socket@{unregister\+Socket}}
\index{unregister\+Socket@{unregister\+Socket}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{unregister\+Socket()}{unregisterSocket()}}
{\footnotesize\ttfamily bool B\+M\+A\+E\+Poll\+::unregister\+Socket (\begin{DoxyParamCaption}\item[{\hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} $\ast$}]{socket }\end{DoxyParamCaption})}



Unregister a \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} from monitoring by \hyperlink{class_b_m_a_e_poll}{B\+M\+A\+E\+Poll}. 

Use this method to remove a socket from receiving events from the epoll system. 
\begin{DoxyParams}{Parameters}
{\em socket} & The \hyperlink{class_b_m_a_socket}{B\+M\+A\+Socket} to unregister. \\
\hline
\end{DoxyParams}


\subsection{Member Data Documentation}
\mbox{\Hypertarget{class_b_m_a_e_poll_ad95e44649fb029c8bbdccfa952109fe8}\label{class_b_m_a_e_poll_ad95e44649fb029c8bbdccfa952109fe8}} 
\index{B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}!max\+Sockets@{max\+Sockets}}
\index{max\+Sockets@{max\+Sockets}!B\+M\+A\+E\+Poll@{B\+M\+A\+E\+Poll}}
\subsubsection{\texorpdfstring{max\+Sockets}{maxSockets}}
{\footnotesize\ttfamily int B\+M\+A\+E\+Poll\+::max\+Sockets}



The maximum number of socket allowed. 

The maximum number of sockets that can be managed by the epoll system. 

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
/home/barant/\+Development/\+B\+M\+A/server\+\_\+core/\+Server\+Core/B\+M\+A\+E\+Poll.\+h\item 
/home/barant/\+Development/\+B\+M\+A/server\+\_\+core/\+Server\+Core/B\+M\+A\+E\+Poll.\+cpp\end{DoxyCompactItemize}
