Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CCheckQueue< T > Class Template Reference

Queue for verifications that have to be performed. More...

#include <checkqueue.h>

+ Collaboration diagram for CCheckQueue< T >:

Public Member Functions

 CCheckQueue (unsigned int nBatchSizeIn)
 
void Thread ()
 
bool Wait ()
 
void Add (std::vector< T > &vChecks)
 
 ~CCheckQueue ()
 

Private Member Functions

bool Loop (bool fMaster=false)
 

Private Attributes

boost::mutex mutex
 
boost::condition_variable condWorker
 
boost::condition_variable condMaster
 
std::vector< T > queue
 
int nIdle
 
int nTotal
 
bool fAllOk
 
unsigned int nTodo
 
bool fQuit
 
unsigned int nBatchSize
 

Friends

class CCheckQueueControl< T >
 

Detailed Description

template<typename T>
class CCheckQueue< T >

Queue for verifications that have to be performed.

The verifications are represented by a type T, which must provide an operator(), returning a bool.

One thread (the master) is assumed to push batches of verifications onto the queue, where they are processed by N-1 worker threads. When the master is done adding work, it temporarily joins the worker pool as an N'th worker, until all jobs are done.

Definition at line 27 of file checkqueue.h.

Constructor & Destructor Documentation

template<typename T>
CCheckQueue< T >::CCheckQueue ( unsigned int  nBatchSizeIn)
inline

Definition at line 124 of file checkqueue.h.

template<typename T>
CCheckQueue< T >::~CCheckQueue ( )
inline

Definition at line 151 of file checkqueue.h.

Member Function Documentation

template<typename T>
void CCheckQueue< T >::Add ( std::vector< T > &  vChecks)
inline

Definition at line 138 of file checkqueue.h.

Referenced by CCheckQueueControl< T >::Add().

+ Here is the caller graph for this function:

template<typename T>
bool CCheckQueue< T >::Loop ( bool  fMaster = false)
inlineprivate

Definition at line 63 of file checkqueue.h.

References CCheckQueue< T >::condWorker, and CCheckQueue< T >::fAllOk.

Referenced by CCheckQueue< T >::Thread(), and CCheckQueue< T >::Wait().

+ Here is the caller graph for this function:

template<typename T>
void CCheckQueue< T >::Thread ( )
inline

Definition at line 128 of file checkqueue.h.

References CCheckQueue< T >::Loop().

+ Here is the call graph for this function:

template<typename T>
bool CCheckQueue< T >::Wait ( )
inline

Definition at line 133 of file checkqueue.h.

References CCheckQueue< T >::Loop().

Referenced by CCheckQueueControl< T >::Wait().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename T>
friend class CCheckQueueControl< T >
friend

Definition at line 154 of file checkqueue.h.

Member Data Documentation

template<typename T>
boost::condition_variable CCheckQueue< T >::condMaster
private

Definition at line 36 of file checkqueue.h.

template<typename T>
boost::condition_variable CCheckQueue< T >::condWorker
private

Definition at line 33 of file checkqueue.h.

Referenced by CCheckQueue< T >::Loop().

template<typename T>
bool CCheckQueue< T >::fAllOk
private
template<typename T>
bool CCheckQueue< T >::fQuit
private

Definition at line 57 of file checkqueue.h.

template<typename T>
boost::mutex CCheckQueue< T >::mutex
private

Definition at line 30 of file checkqueue.h.

template<typename T>
unsigned int CCheckQueue< T >::nBatchSize
private

Definition at line 60 of file checkqueue.h.

template<typename T>
int CCheckQueue< T >::nIdle
private

Definition at line 43 of file checkqueue.h.

Referenced by CCheckQueueControl< T >::CCheckQueueControl().

template<typename T>
unsigned int CCheckQueue< T >::nTodo
private

Definition at line 54 of file checkqueue.h.

Referenced by CCheckQueueControl< T >::CCheckQueueControl().

template<typename T>
int CCheckQueue< T >::nTotal
private

Definition at line 46 of file checkqueue.h.

Referenced by CCheckQueueControl< T >::CCheckQueueControl().

template<typename T>
std::vector<T> CCheckQueue< T >::queue
private

Definition at line 40 of file checkqueue.h.


The documentation for this class was generated from the following file: