TRF Language Model
wb::CirQueue< T > Class Template Reference

Circular queue. More...

#include <wb-vector.h>

Inheritance diagram for wb::CirQueue< T >:
wb::Vector< T >

Public Member Functions

 CirQueue (int size=10)
 constructor More...
 
void Init (int size)
 Init the queue. More...
 
void Clean ()
 Clean the queue, don't release the memory. More...
 
void In (T t)
 Add a value into queue. More...
 
bool Out (T *t=NULL)
 Remove a value outof queue. More...
 
bool IsEmpty ()
 if the queue is empty More...
 
bool IsFull ()
 if the queue is full More...
 
int GetNum ()
 Get number of values. More...
 
int GetSize ()
 Get the buffer size of queue. More...
 
GetSum ()
 Summary all the values if queue. More...
 

Public Attributes

int nHead
 the head of queue More...
 
int nTail
 the tail of queue More...
 

Detailed Description

template<typename T>
class wb::CirQueue< T >

Circular queue.

Date
2016-04-28
Author
WangBin

For circular queue, we need indicate the size of a queue beforhead.

Definition at line 479 of file wb-vector.h.

Constructor & Destructor Documentation

§ CirQueue()

template<typename T >
wb::CirQueue< T >::CirQueue ( int  size = 10)
inline

constructor

Definition at line 489 of file wb-vector.h.

Member Function Documentation

§ Clean()

template<typename T >
void wb::CirQueue< T >::Clean ( )
inline

Clean the queue, don't release the memory.

Definition at line 504 of file wb-vector.h.

§ GetNum()

template<typename T >
int wb::CirQueue< T >::GetNum ( )
inline

Get number of values.

Definition at line 550 of file wb-vector.h.

§ GetSize()

template<typename T >
int wb::CirQueue< T >::GetSize ( )
inline

Get the buffer size of queue.

Definition at line 552 of file wb-vector.h.

§ GetSum()

template<typename T >
T wb::CirQueue< T >::GetSum ( )
inline

Summary all the values if queue.

Definition at line 554 of file wb-vector.h.

§ In()

template<typename T >
void wb::CirQueue< T >::In ( t)
inline

Add a value into queue.

Definition at line 511 of file wb-vector.h.

§ Init()

template<typename T >
void wb::CirQueue< T >::Init ( int  size)
inline

Init the queue.

Definition at line 497 of file wb-vector.h.

§ IsEmpty()

template<typename T >
bool wb::CirQueue< T >::IsEmpty ( )
inline

if the queue is empty

Definition at line 546 of file wb-vector.h.

§ IsFull()

template<typename T >
bool wb::CirQueue< T >::IsFull ( )
inline

if the queue is full

Definition at line 548 of file wb-vector.h.

§ Out()

template<typename T >
bool wb::CirQueue< T >::Out ( T *  t = NULL)
inline

Remove a value outof queue.

Definition at line 525 of file wb-vector.h.

Member Data Documentation

§ nHead

template<typename T >
int wb::CirQueue< T >::nHead

the head of queue

Definition at line 485 of file wb-vector.h.

§ nTail

template<typename T >
int wb::CirQueue< T >::nTail

the tail of queue

Definition at line 486 of file wb-vector.h.


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