Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 788

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::Thread\-Queue Class Reference}
\label{classost_1_1_thread_queue}\index{ost::ThreadQueue@{ost::ThreadQueue}}
Somewhat generic queue processing class to establish a producer consumer queue.in memory data queue interface.  


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

Inheritance diagram for ost::Thread\-Queue::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2cm]{classost_1_1_thread_queue}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf Thread\-Queue} (const char $\ast$id, int pri, size\_\-t stack=0)
\begin{CompactList}\small\item\em Create instance of our queue and give it a process priority. \item\end{CompactList}\item 
{\bf $\sim$Thread\-Queue} ()
\begin{CompactList}\small\item\em Destroy the queue. \item\end{CompactList}\item 
void {\bf post} (const void $\ast$data, unsigned len)
\begin{CompactList}\small\item\em Put some unspecified data into this queue. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf start\-Queue} (void)
\begin{CompactList}\small\item\em Start of dequeing. \item\end{CompactList}\item 
virtual void {\bf stop\-Queue} (void)
\begin{CompactList}\small\item\em End of dequeing, we expect the queue is empty for now. \item\end{CompactList}\item 
virtual void {\bf run\-Queue} (void $\ast$data)=0
\begin{CompactList}\small\item\em Virtual callback method to handle processing of a queued data items. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
const char $\ast$ {\bf name}
\end{CompactItemize}
\subsection*{Classes}
\begin{CompactItemize}
\item 
struct {\bf \_\-data}
\end{CompactItemize}


\subsection{Detailed Description}
Somewhat generic queue processing class to establish a producer consumer queue.in memory data queue interface. 

This may be used to buffer cdr records, or for other purposes where an in-memory queue is needed for rapid posting. This class is derived from {\bf Mutex}{\rm (p.\,\pageref{classost_1_1_mutex})} and maintains a linked list. A thread is used to dequeue data and pass it to a callback method that is used in place of \char`\"{}run\char`\"{} for each item present on the queue. The conditional is used to signal the run thread when new data is posted.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{ost::ThreadQueue@{ost::Thread\-Queue}!ThreadQueue@{ThreadQueue}}
\index{ThreadQueue@{ThreadQueue}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Thread\-Queue::Thread\-Queue (const char $\ast$ {\em id}, int {\em pri}, size\_\-t {\em stack} = {\tt 0})}\label{classost_1_1_thread_queue_a604895a1e9884e8a33d71542eab5fac}


Create instance of our queue and give it a process priority. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em id}]queue ID. \item[{\em pri}]process priority. \item[{\em stack}]stack size. \end{description}
\end{Desc}
\index{ost::ThreadQueue@{ost::Thread\-Queue}!~ThreadQueue@{$\sim$ThreadQueue}}
\index{~ThreadQueue@{$\sim$ThreadQueue}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Thread\-Queue::$\sim$Thread\-Queue ()}\label{classost_1_1_thread_queue_a10c32ac8c488de2b7640b8e109aea75}


Destroy the queue. 



\subsection{Member Function Documentation}
\index{ost::ThreadQueue@{ost::Thread\-Queue}!post@{post}}
\index{post@{post}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Thread\-Queue::post (const void $\ast$ {\em data}, unsigned {\em len})}\label{classost_1_1_thread_queue_ec4bca4a2933cd3063f76ac325774c35}


Put some unspecified data into this queue. 

A new qd structure is created and sized to contain a copy of the actual content.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]pointer to data. \item[{\em len}]size of data. \end{description}
\end{Desc}
\index{ost::ThreadQueue@{ost::Thread\-Queue}!runQueue@{runQueue}}
\index{runQueue@{runQueue}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Thread\-Queue::run\-Queue (void $\ast$ {\em data})\hspace{0.3cm}{\tt  [protected, pure virtual]}}\label{classost_1_1_thread_queue_e26b60d8e9a3b130a89bee13aae7069e}


Virtual callback method to handle processing of a queued data items. 

After the item is processed, it is deleted from memory. We can call multiple instances of run\-Queue in order if multiple items are waiting.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]item being dequed. \end{description}
\end{Desc}
\index{ost::ThreadQueue@{ost::Thread\-Queue}!startQueue@{startQueue}}
\index{startQueue@{startQueue}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Thread\-Queue::start\-Queue (void)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classost_1_1_thread_queue_2687b56a3be47b5e9739737dcecd6c9d}


Start of dequeing. 

Maybe we need to connect a database or something, so we have a virtual... \index{ost::ThreadQueue@{ost::Thread\-Queue}!stopQueue@{stopQueue}}
\index{stopQueue@{stopQueue}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Thread\-Queue::stop\-Queue (void)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classost_1_1_thread_queue_573ca3660b00d14f79fe70773cd2d668}


End of dequeing, we expect the queue is empty for now. 

Maybe we need to disconnect a database or something, so we have another virtual. 

\subsection{Member Data Documentation}
\index{ost::ThreadQueue@{ost::Thread\-Queue}!name@{name}}
\index{name@{name}!ost::ThreadQueue@{ost::Thread\-Queue}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ {\bf ost::Thread\-Queue::name}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_thread_queue_a3b975cb871cee2c8fc552117e8d4767}




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