From: Dejan L. <dlo...@us...> - 2004-06-14 11:44:42
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21007/rtk Modified Files: Queue.h PriorityQueue.h Log Message: Added GetMaxSize and SetMaxSize, also GetFirst now return void *data instead of QueueNode Index: Queue.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Queue.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Queue.h 14 Jun 2004 11:00:26 -0000 1.2 --- Queue.h 14 Jun 2004 11:44:18 -0000 1.3 *************** *** 88,92 **** * @return QueueNode pointer to first node in Queue. */ ! QueueNode* GetFirst() const { return _head; } /** --- 88,92 ---- * @return QueueNode pointer to first node in Queue. */ ! void* GetFirst() const { return _head->data; } /** Index: PriorityQueue.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/PriorityQueue.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PriorityQueue.h 10 Jun 2004 22:09:03 -0000 1.3 --- PriorityQueue.h 14 Jun 2004 11:44:18 -0000 1.4 *************** *** 72,76 **** /** ! * Queue or FIFO(first in, first out) class */ class RTK_API PriorityQueue --- 72,76 ---- /** ! * PriorityQueue */ class RTK_API PriorityQueue *************** *** 83,87 **** */ PriorityQueue(bool sort=SORT_ASC): _sort(sort),_priority_head(0) ! ,_count(0), _head(0), _tail(0), _free_func(0), _mutex(0) { } // --------- DESTRUCTORS ----------------------------------- --- 83,87 ---- */ PriorityQueue(bool sort=SORT_ASC): _sort(sort),_priority_head(0) ! ,_count(0), _max_size(0), _head(0), _tail(0), _free_func(0), _mutex(0) { } // --------- DESTRUCTORS ----------------------------------- *************** *** 102,106 **** * @return QueueNode pointer to first node in Queue. */ ! QueueNode* GetFirst() const { return this->_head; } /** --- 102,106 ---- * @return QueueNode pointer to first node in Queue. */ ! void* GetFirst() const { return _head->data; } /** *************** *** 114,117 **** --- 114,124 ---- Mutex* GetMutex() { return _mutex; } + + /** + * GetMaxSize, Maximum size of PriorityQueue, if return value is 0 + * then PriorityQueue have no maximum size. + */ + int GetMaxSize() {return _max_size; } + // --------- SET METHODS ----------------------------------- *************** *** 127,130 **** --- 134,143 ---- void SetMutex(Mutex* mutex) { _mutex = mutex; } + /** + * Set maximum size for PriorityQueue if max_size is 0 then Queue have + * no max size + */ + void SetMaxSize(int max_size) { _max_size = max_size; } + // --------- OTHER METHODS --------------------------------- *************** *** 158,178 **** int Contains(void *data) const; - /** - * Returns TRUE if given node is _head node in Queue. - * @param element QueueNode* Node that should be checked. - * @return TRUE if given node is _head node in Queue, FALSE otherwize. - */ - bool IsFirst(const QueueNode* element) const { return ((element == this->_head) ? true : false); } - - /** - * Returns TRUE if given node is _tail node in Queue. - * @param element QueueNode* Node that should be checked. - * @return TRUE if given node oElement is _tail node in Queue, FALSE otherwize. - */ - bool IsLast(const QueueNode* element) const { return ((element->next == 0) ? true : false); } protected: // Members int _count; /// Size of the list object (how many elements are stored inside) bool _sort; /// How priority queue is sorted QueueNode* _head; /// Pointer to _head element of the List. --- 171,179 ---- int Contains(void *data) const; protected: // Members int _count; /// Size of the list object (how many elements are stored inside) + int _max_size; /// Maximum Size for Priority Queue bool _sort; /// How priority queue is sorted QueueNode* _head; /// Pointer to _head element of the List. *************** *** 180,183 **** --- 181,185 ---- PriorityNode* _priority_head; /// Pointer to priority head_element of the list + FreeDataFunc _free_func; /// Free data function Mutex* _mutex; |