From: Mikko L. <laz...@us...> - 2004-06-15 19:00:49
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28196 Modified Files: Queue.h Log Message: minor changes, added few missing consts. Added cmp param to Contains Index: Queue.h =================================================================== RCS file: /cvsroot/rtk/rtk/rtk/Queue.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Queue.h 14 Jun 2004 11:44:18 -0000 1.3 --- Queue.h 15 Jun 2004 19:00:39 -0000 1.4 *************** *** 80,109 **** /** ! * Returns number of items in the list. */ int GetCount() const { return _count; } /** ! * Returns pointer to _head node in Queue. ! * @return QueueNode pointer to first node in Queue. */ ! void* GetFirst() const { return _head->data; } /** * Get free data function. */ ! FreeDataFunc GetFreeDataFunc() { return _free_func; } /** * Get Mutex from Queue */ ! ! Mutex* GetMutex() { return _mutex; } /** * GetMaxSize, Maximum size of Queue, if return value is 0 ! * then Queue have no maximum size. */ ! int GetMaxSize() {return _max_size; } // --------- SET METHODS ----------------------------------- --- 80,115 ---- /** ! * Returns number of items in the queue. */ int GetCount() const { return _count; } /** ! * Returns a pointer to the head item in the queue. ! * The queue is not changed. Returns 0 if the queue is empty. */ ! void* GetFirst() const { return (_head ? _head->data : 0); } ! ! /** ! * Returns a pointer to the head item in the queue. ! * The queue is not changed. Returns 0 if the queue is empty. ! */ ! void* GetHead() const { return (_head ? _head->data : 0); } /** * Get free data function. */ ! FreeDataFunc GetFreeDataFunc() const { return _free_func; } /** * Get Mutex from Queue */ ! Mutex* GetMutex() const { return _mutex; } /** * GetMaxSize, Maximum size of Queue, if return value is 0 ! * then Queue size is unlimited. */ ! int GetMaxSize() const { return _max_size; } ! // --------- SET METHODS ----------------------------------- *************** *** 124,132 **** */ void SetMaxSize(int max_size) { _max_size = max_size; } // --------- OTHER METHODS --------------------------------- /** ! * Clears the Queue. This wi ! ll call 'Free Data Handler' */ void Clear(); --- 130,138 ---- */ void SetMaxSize(int max_size) { _max_size = max_size; } + // --------- OTHER METHODS --------------------------------- /** ! * Clears the Queue. This will call 'Free Data Handler' */ void Clear(); *************** *** 142,146 **** * Remove first element from Queue * This will call 'Free Data Handler' ! * @return Data assigned to removed element, or NULL on error */ void *Dequeue(); --- 148,152 ---- * Remove first element from Queue * This will call 'Free Data Handler' ! * @return Data assigned to removed element, or NULL on error */ void *Dequeue(); *************** *** 148,166 **** /** * Get number of items containing given data. * @param data Search for this data * @return Number of elements found, that contains given data. */ ! int Contains(void *data) const; protected: // Members ! int _count; /// Size of the list object (how many elements are stored inside) ! int _max_size; /// Max size of Queue ! bool _sort; /// How priority queue is sorted ! QueueNode* _head; /// Pointer to _head element of the List. ! QueueNode* _tail; /// Pointer to _tail element of the List. FreeDataFunc _free_func; /// Free data function ! Mutex* _mutex; /// Thread safe }; // Queue --- 154,174 ---- /** * Get number of items containing given data. + * * @param data Search for this data + * @param cmp Uses this function to compare items, if NULL (default) then pointer comparing is used. + * * @return Number of elements found, that contains given data. */ ! int Contains(void *data, CmpFunction cmp = 0) const; protected: // Members ! int _count; /// Size of the list object (how many elements are stored inside) ! int _max_size; /// Max size of Queue ! QueueNode* _head; /// Pointer to _head element of the List. ! QueueNode* _tail; /// Pointer to _tail element of the List. FreeDataFunc _free_func; /// Free data function ! Mutex* _mutex; /// Thread safe }; // Queue |