X-Git-Url: https://git.auder.net/?p=cgds.git;a=blobdiff_plain;f=src%2FBufferTop.h;fp=src%2FBufferTop.h;h=96af7695238f8f73a6352736d6588cd8423fec14;hp=1f7d9a9e5b1129eed833cea85198909e97b50b86;hb=1ff641f9960fa6c6081817a5641afb22fad91dcd;hpb=71e16e325e3936549a5f3a140e6298fce333fd27 diff --git a/src/BufferTop.h b/src/BufferTop.h index 1f7d9a9..96af769 100644 --- a/src/BufferTop.h +++ b/src/BufferTop.h @@ -17,7 +17,7 @@ */ typedef struct BufferTop { UInt capacity; ///< Buffer capacity (in items count). - OrderType bType; ///< Type of buffer: keep max items (MAX_T) or min items (MIN_T). + OrderType bType; ///< Type of buffer: keep max or min items (MAX_T or MIN_T). Heap* heap; ///< Item-ValueS are internally organized into a heap. } BufferTop; @@ -27,7 +27,7 @@ typedef struct BufferTop { BufferTop* _buffertop_new( size_t dataSize, ///< Size in bytes of a buffer element. UInt capacity, ///< Maximum number of elements that the buffer can contain. - OrderType bType, ///< Type of buffer: keep max items (bType==MAX_T) or min items (bType==MIN_T). + OrderType bType, ///< Type of buffer: keep max or min items (MAX_T or MIN_T). UInt arity ///< Arity of the wrapped heap: any integer >=2. ); @@ -35,16 +35,17 @@ BufferTop* _buffertop_new( * @brief Return an allocated and initialized buffer. * @param type Type of a buffer item (int, char*, ...). * @param capacity Maximum number of elements that the buffer can contain. - * @param bType type of buffer top: max items (bType==MAX_T) or min items (bType==MIN_T). + * @param bType type of buffer: keep max or min items (MAX_T or MIN_T). * @param arity Arity of the wrapped heap: any integer >=2. - * - * Usage: BufferTop* buffertop_new( type, UInt capacity, OrderTypebType, UInt arity) + * + * Usage: BufferTop* buffertop_new(\ + * type, UInt capacity, OrderTypebType, UInt arity) */ #define buffertop_new(type, capacity, bType, arity) \ _buffertop_new(sizeof(type), capacity, bType, arity) /** - * @brief Copy constructor (works well if items do not have allocated sub-pointers). + * @brief Copy constructor (shallow copy, ok for basic types). */ BufferTop* buffertop_copy( BufferTop* bufferTop ///< "this" pointer. @@ -60,7 +61,7 @@ List* buffertop_2list( /** * @brief Check if the buffer is empty. */ -Bool buffertop_empty( +bool buffertop_empty( BufferTop* bufferTop ///< "this" pointer. ); @@ -85,7 +86,7 @@ void _buffertop_tryadd( * @param bufferTop "this" pointer. * @param item Item of type as defined in the constructor. * @param value Value associated with the item. - * + * * Usage: void buffertop_tryadd(BufferTop* bufferTop, void item, Real value) */ #define buffertop_tryadd(bufferTop, item, value) \ @@ -105,7 +106,7 @@ ItemValue* buffertop_first_raw( * @brief Set item_ to the top ("worst among best") item inside current buffer. * @param bufferTop "this" pointer. * @param item_ Variable to be assigned. - * + * * Usage: void buffertop_first(BufferTop* bufferTop, void item) */ #define buffertop_first(bufferTop, item_) \