#ifndef INCLUDED_C_SEQSEARCHST_H #define INCLUDED_C_SEQSEARCHST_H #ifndef INCLUDED_C_SORTCOMPARE_H #include #endif /*INCLUDED_C_SORTCOMPARE_H*/ #ifndef INCLUDED_C_ALLOCATOR_H #include #endif /*INCLUDED_C_ALLOCATOR_H*/ /* ------------------------------------------------------------------------------------------------------------------ */ /* */ typedef struct c_SeqSearchSTNode { void* key; // 独立分配存储的 Key 物理地址 void* val; // 独立分配存储的 Value 物理地址 struct c_SeqSearchSTNode* next; // 指向下一个符号节点的指针 } c_SeqSearchSTNode; typedef struct { c_SeqSearchSTNode* first; // 链表头节点指针 c_size_t size; // 当前符号表内有效驻留的键值对总个数 c_size_t key_size; // 键对象占用的物理字节大小 (sizeof) c_size_t val_size; // 值对象占用的物理字节大小 (sizeof) c_SortCompare_t key_cmp; // 键值专用的动态回调比对器 void* args; // 自定义上下文参数指针 c_Allocator_t allocator; // 内联组合分配器实例与默认 Fallback 缺省机制 } c_SeqSearchST_t; /* ------------------------------------------------------------------------------------------------------------------ */ /* */ c_err_t c_SeqSearchST_Init(c_SeqSearchST_t* self, c_size_t key_size, c_size_t val_size, c_SortCompare_t key_cmp, void* args, c_Allocator_t* allocator); c_err_t c_SeqSearchST_Put(c_SeqSearchST_t* self, const void* key, const void* val); c_err_t c_SeqSearchST_Get(const c_SeqSearchST_t* self, const void* key, void* out_val); bool c_SeqSearchST_Contains(const c_SeqSearchST_t* self, const void* key); c_err_t c_SeqSearchST_Delete(c_SeqSearchST_t* self, const void* key); void c_SeqSearchST_Destroy(c_SeqSearchST_t* self); #endif /*INCLUDED_C_SEQSEARCHST_H*/