src/cx/buffer.h

changeset 539
9cd98da9ee17
parent 537
16219eba3a0a
child 541
67e078518935
equal deleted inserted replaced
538:2cfbcbe86a7c 539:9cd98da9ee17
89 /** Current capacity (i.e. maximum size) of the buffer. */ 89 /** Current capacity (i.e. maximum size) of the buffer. */
90 size_t capacity; 90 size_t capacity;
91 /** Current size of the buffer content. */ 91 /** Current size of the buffer content. */
92 size_t size; 92 size_t size;
93 /** 93 /**
94 * The buffer may not extend beyond this threshold before starting to flush.
95 * Default is \c SIZE_MAX (flushing disabled when auto extension is enabled).
96 */
97 size_t flush_threshold;
98 /**
99 * The block size for the elements to flush.
100 * Default is 4096 bytes.
101 */
102 size_t flush_blksize;
103 /**
104 * The maximum number of blocks to flush in one cycle.
105 * Zero disables flushing entirely (this is the default).
106 * Set this to \c SIZE_MAX to flush the entire buffer.
107 *
108 * @attention if the maximum number of blocks multiplied with the block size
109 * is smaller than the expected contents written to this buffer within one write
110 * operation, multiple flush cycles are performed after that write.
111 * That means the total number of blocks flushed after one write to this buffer may
112 * be larger than \c flush_blkmax.
113 */
114 size_t flush_blkmax;
115
116 /**
117 * The write function used for flushing.
118 * If NULL, the flushed content gets discarded.
119 */
120 size_t (*flush_func)(
121 void const *,
122 size_t,
123 size_t,
124 void *
125 );
126
127 /**
94 * Flag register for buffer features. 128 * Flag register for buffer features.
95 * @see #CX_BUFFER_DEFAULT 129 * @see #CX_BUFFER_DEFAULT
96 * @see #CX_BUFFER_FREE_CONTENTS 130 * @see #CX_BUFFER_FREE_CONTENTS
97 * @see #CX_BUFFER_AUTO_EXTEND 131 * @see #CX_BUFFER_AUTO_EXTEND
98 */ 132 */

mercurial