X-Git-Url: https://git.auder.net/?p=cgds.git;a=blobdiff_plain;f=src%2FPriorityQueue.h;fp=src%2FPriorityQueue.h;h=59fe5110f04653b2a7cae6c65bec9a42f78a454c;hp=a543dd85cd7bdfb9c0a2aa685c3c56e396f3a531;hb=1ff641f9960fa6c6081817a5641afb22fad91dcd;hpb=71e16e325e3936549a5f3a140e6298fce333fd27 diff --git a/src/PriorityQueue.h b/src/PriorityQueue.h index a543dd8..59fe511 100644 --- a/src/PriorityQueue.h +++ b/src/PriorityQueue.h @@ -23,23 +23,24 @@ typedef struct PriorityQueue { */ PriorityQueue* _priorityqueue_new( size_t dataSize, ///< Size in bytes of a priority queue element. - OrderType pType, ///< Type of priority queue: max first (hType==MAX_T) or min first (hType==MIN_T). + OrderType pType, ///< Type of priority queue: max or min first (MAX_T or MIN_T). UInt arity ///< Arity of the wrapped heap: any integer >=2. ); /** * @brief Return an allocated and initialized Queue. * @param type Type of a priority queue item (int, char*, ...). - * @param pType type of priority queue: max first (hType==MAX_T) or min first (hType==MIN_T). + * @param pType type of priority queue: max or min first (MAX_T or MIN_T). * @param arity Arity of the wrapped heap: any integer >=2. - * - * Usage: PriorityQueue* priorityqueue_new( type, OrderType pType, UInt arity) + * + * Usage: PriorityQueue* priorityqueue_new(\ + * type, OrderType pType, UInt arity) */ #define priorityqueue_new(type, pType, arity) \ _priorityqueue_new(sizeof(type), pType, arity) /** - * @brief Copy constructor (works well if items do not have allocated sub-pointers). + * @brief Copy constructor (shallow copy, ok for basic types). */ PriorityQueue* priorityqueue_copy( PriorityQueue* priorityQueue ///< "this" pointer. @@ -48,7 +49,7 @@ PriorityQueue* priorityqueue_copy( /** * @brief Check if the priority queue is empty. */ -Bool priorityqueue_empty( +bool priorityqueue_empty( PriorityQueue* priorityQueue ///< "this" pointer. ); @@ -64,8 +65,9 @@ UInt priorityqueue_size( * @param priorityQueue "this" pointer. * @param item Item to be added. * @param priority Priority of the added item. - * - * Usage: void priorityqueue_insert(PriorityQueue* priorityQueue, void item, Real priority) + * + * Usage: void priorityqueue_insert(\ + * PriorityQueue* priorityQueue, void item, Real priority) */ #define priorityqueue_insert(priorityQueue, item, priority) \ heap_insert(priorityQueue->heap, item, priority) @@ -76,8 +78,9 @@ UInt priorityqueue_size( * @param item Item to be modified. * @param newPriority New priority of the modified item. * @note If several similar items are present, only the first is affected. - * - * Usage: void priorityqueue_set_priority(PriorityQueue* priorityQueue, void item, Real newPriority) + * + * Usage: void priorityqueue_set_priority(\ + * PriorityQueue* priorityQueue, void item, Real newPriority) */ #define priorityqueue_set(priorityQueue, item, newPriority) \ heap_modify(priorityQueue->heap, item, newPriority) @@ -87,7 +90,7 @@ UInt priorityqueue_size( * @param priorityQueue "this" pointer. * @param item Item to be removed. * @note If several similar items are present, only the first is deleted. - * + * * Usage: void priorityqueue_remove(PriorityQueue* priorityQueue, void item) */ #define priorityqueue_remove(priorityQueue, item) \ @@ -95,7 +98,7 @@ UInt priorityqueue_size( /** * @brief Return what is at the beginning of the queue. - * @return An ItemValue* 'iv' with iv->item is the data, and iv->value its priority. + * @return An ItemValue* 'iv' with iv->item = data, and iv->value its priority. */ ItemValue* priorityqueue_peek_raw( PriorityQueue* priorityQueue ///< "this" pointer. @@ -105,7 +108,7 @@ ItemValue* priorityqueue_peek_raw( * @brief Peek the item at the beginning of the queue. * @param priorityQueue "this" pointer. * @param item Item to be assigned. - * + * * Usage: void priorityqueue_peek(PriorityQueue* priorityQueue, void item) */ #define priorityqueue_peek(priorityQueue, item) \ @@ -118,7 +121,7 @@ void priorityqueue_pop( PriorityQueue* priorityQueue ///< "this" pointer. ); -/** +/** * @brief Clear the entire queue. */ void priorityqueue_clear(