Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

queue.h

Go to the documentation of this file.
00001 
00002 #ifndef _QUEUE_H_
00003 #define _QUEUE_H_
00004 
00005 #include "fifo_list.h"
00006 #include "packnode.h"
00007 
00046 
00047 
00056 template <class T>
00057 class queueElem
00058 {
00059 private:
00061   queueElem() {}
00062 public:
00063   packnode<T> *node;
00064   size_t indent;
00065 
00067   queueElem( packnode<T> *n, size_t i )
00068   {
00069     node = n;
00070     indent = i;
00071   }
00072 
00074   void *operator new(size_t num_bytes)
00075   {
00076     block_pool mem_pool;
00077 
00078     void *mem_addr = mem_pool.pool_alloc( num_bytes );
00079     return mem_addr;      
00080   } // new
00081 }; // queueElem
00082 
00083 
00093 template <class T>
00094 class queue : protected FIFO_LIST<queueElem<T> *> 
00095 {
00096 public:
00098   queueElem<T> *queueStart()
00099   {
00100     handle h = first();
00101     queueElem<T> *elem = get_item( h );
00102     return elem;
00103   } // queueStart
00104 
00111   void deleteStart() 
00112   {
00113     handle h = first();
00114     if (h != 0) {
00115       queueElem<T> *elem = get_item( h );
00116       remove();
00117       // no delete elem;
00118     }
00119   } // deleteStart
00120 
00122   void addQueue(packnode<T> *node, size_t indent )
00123   {
00124     queueElem<T> *elem = new queueElem<T>(node, indent);
00125     add( elem );
00126   } // addQueue
00127 
00129   bool queueEmpty() { return (first() == 0); }
00130 }; // queue
00131 
00132 #endif

Generated at Tue May 27 21:56:16 2003 for Wavelet compression, determinism and time series forecasting by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001