79#ifndef CDI_POOL_API_H__
80#define CDI_POOL_API_H__
159 uint32_t max_grow_count, uint32_t item_byte_size,
bool thread_safe,
183 uint32_t max_grow_count, uint32_t item_byte_size,
bool thread_safe,
185 void* init_context_ptr);
212 bool thread_safe,
void* buffer_ptr, uint32_t buffer_byte_size,
213 uint32_t* buffer_byte_size_needed_ptr,
245 uint32_t item_byte_size,
bool thread_safe,
246 void* buffer_ptr, uint32_t buffer_byte_size,
247 uint32_t* buffer_byte_size_needed_ptr,
250 void* init_context_ptr);
277#ifdef USE_MEMORY_POOL_APPENDED_LISTS
356 const void* context_ptr);
CDI_INTERFACE bool CdiPoolCreateAndInitItems(const char *name_str, uint32_t item_count, uint32_t grow_count, uint32_t max_grow_count, uint32_t item_byte_size, bool thread_safe, CdiPoolHandle *ret_handle_ptr, CdiPoolItemOperatorFunction init_fn, void *init_context_ptr)
Definition pool.c:291
CDI_INTERFACE int CdiPoolGetFreeItemCount(CdiPoolHandle handle)
Definition pool.c:486
CDI_INTERFACE void CdiPoolPutAll(CdiPoolHandle handle)
Definition pool.c:456
CDI_INTERFACE bool CdiPoolCreateUsingExistingBuffer(const char *name_str, uint32_t item_count, uint32_t item_byte_size, bool thread_safe, void *buffer_ptr, uint32_t buffer_byte_size, uint32_t *buffer_byte_size_needed_ptr, CdiPoolHandle *ret_handle_ptr)
Definition pool.c:306
CDI_INTERFACE uint32_t CdiPoolGetItemSize(CdiPoolHandle handle)
Definition pool.c:479
CDI_INTERFACE bool CdiPoolForEachItem(CdiPoolHandle handle, CdiPoolItemOperatorFunction operator_function, const void *context_ptr)
Definition pool.c:508
void(* CdiPoolCallback)(const CdiPoolCbData *data_ptr)
Prototype of pool callback function.
Definition cdi_pool_api.h:128
CDI_INTERFACE bool CdiPoolPeekInUse(CdiPoolHandle handle, void **ret_item_ptr)
Definition pool.c:370
CDI_INTERFACE void CdiPoolPut(CdiPoolHandle handle, const void *item_ptr)
Definition pool.c:433
CDI_INTERFACE bool CdiPoolCreateUsingExistingBufferAndInitItems(const char *name_str, uint32_t item_count, uint32_t item_byte_size, bool thread_safe, void *buffer_ptr, uint32_t buffer_byte_size, uint32_t *buffer_byte_size_needed_ptr, CdiPoolHandle *ret_handle_ptr, CdiPoolItemOperatorFunction init_fn, void *init_context_ptr)
Definition pool.c:316
CDI_INTERFACE uint32_t CdiPoolGetSizeNeeded(uint32_t item_count, uint32_t item_byte_size)
Definition pool.c:276
CDI_INTERFACE void CdiPoolCallbackEnable(CdiPoolHandle handle, CdiPoolCallback cb_ptr)
Definition pool.c:530
CDI_INTERFACE bool CdiPoolCreate(const char *name_str, uint32_t item_count, uint32_t grow_count, uint32_t max_grow_count, uint32_t item_byte_size, bool thread_safe, CdiPoolHandle *ret_handle_ptr)
Definition pool.c:283
CDI_INTERFACE bool CdiPoolGet(CdiPoolHandle handle, void **ret_item_ptr)
Definition pool.c:393
struct CdiPoolState * CdiPoolHandle
Type used as the handle (pointer to an opaque structure) for a Memory Pool. Each handle represents a ...
Definition cdi_pool_api.h:97
bool(* CdiPoolItemOperatorFunction)(const void *context_ptr, void *item_ptr)
Definition cdi_pool_api.h:110
CDI_INTERFACE const char * CdiPoolGetName(CdiPoolHandle handle)
Definition pool.c:472
CDI_INTERFACE int CdiPoolGetTotalItemCount(CdiPoolHandle handle)
Get the total number of items in the pool.
Definition pool.c:497
CDI_INTERFACE void CdiPoolCallbackDisable(CdiPoolHandle handle)
Definition pool.c:537
CDI_INTERFACE void CdiPoolDestroy(CdiPoolHandle handle)
Definition pool.c:342
The declarations in this header file correspond to the definitions in cdi_utility_api....
#define CDI_INTERFACE
Specify C linkage when compiling as C++ and define API interface export for Windows.
Definition cdi_utility_api.h:34
Contains the state of a single pool get or put operation.
Definition cdi_pool_api.h:115
const void * item_data_ptr
Pointer to item data.
Definition cdi_pool_api.h:118
int num_entries
Current number of entries in the free_list.
Definition cdi_pool_api.h:117
bool is_put
True if pool get triggered the callback, otherwise a pool put triggered it.
Definition cdi_pool_api.h:116
This structure represents the current state of a memory pool.
Definition pool.c:46