struct librock_MLocate_Entry_s { librock_uint32_t hashcode; char data[1]; }; struct librock_MLocate_s { int sizeofHashTableEntry; int nRows; /* Rows in Table0 and Table1. Determined by the argument given to the constructor */ int nCols; /* Columns in Table0. Determined by the argument given to the constructor */ struct librock_MLocateEntry_s *pTable0; void *ppTable1; void *ppExpansionRows; librock_uint32_t (*hashfn)(const void *); int (*Insert_Table1)( struct librock_MLocate_s *pthis, int iRow, const void librock_PTR *lpvIndex, const void librock_PTR *lpvData); int (*FindMHC_Table1)( struct librock_MLocate_s *pthis, const void librock_PTR *pIndex, unsigned iRow, void *pRet, /* Copies of HashTableEntries */ long *piHTE, /* Indices of the entry */ int iBase, int N); int (*DeleteAt_Table1)( struct librock_MLocate_s *pthis, int iRow, int iHTE); int (*WriteAt_Table1)( struct librock_MLocate_s *pthis, int iRow, int iHTE, const struct librock_MLocate_Entry_s *pEntry); int (*IndexMatch)( struct librock_MLocate_s *pthis, struct librock_MLocate_Entry_s *pEntry, const void *pIndex ); }; struct librock_MLocate_s *librock_MLocate_alloc(int rows, int cols,int entrysize); void librock_MLocate_free(struct librock_MLocate_s *pthis); int librock_MLocate_Insert( struct librock_MLocate_s *pthis, const void librock_PTR *lpvIndex, const void librock_PTR *lpvData); int librock_MLocate_WriteAt( struct librock_MLocate_s *pthis, int iRow, int iHTE, const struct librock_MLocate_Entry_s *pEntry) ; int librock_MLocate_FindMHC( struct librock_MLocate_s *pthis, const void librock_PTR *pIndex, unsigned iRow, void *pRet, /* Copies of HashTableEntries */ long *piHTE, /* Indices of the entry */ int iBase, int N) ; int librock_MLocate_InsertOrReplace( struct librock_MLocate_s *pthis, const void librock_PTR *lpvIndex, const void librock_PTR *lpvData) ; int librock_MLocate_DeleteAt( struct librock_MLocate_s *pthis, int iRow, int iHTE); /**************************************************************/ /**************************************************************/ struct librock_MLocate_sz_Entry_s { librock_uint32_t hashcode; const char *pszIndex; const char *ptr; }; struct librock_MLocate_sz_s *librock_MLocate_sz_alloc(); void librock_MLocate_sz_free(struct librock_MLocate_s *pthis); int librock_MLocate_sz_Insert( struct librock_MLocate_sz_s *pthis, const void librock_PTR *lpvIndex, int cbIndex, const void librock_PTR *lpvData, int cbData); int librock_MLocate_sz_InsertOrReplace( struct librock_MLocate_sz_s *pthis, const void librock_PTR *lpvIndex, int cbIndex, const void librock_PTR *lpvData, int cbData); int librock_MLocate_sz_ReplaceAt( struct librock_MLocate_sz_s *pthis, const char *pszIndex, int iHTE, const void librock_PTR *lpvData, int cbData); int librock_MLocate_sz_LookupM( struct librock_MLocate_sz_s *pthis, const void librock_PTR *pIndex, unsigned iRow, void **pRet, /* Pointers */ long *piHTE, /* Indices of the entry */ int iBase, int N); int librock_MLocate_sz_DeleteAt( struct librock_MLocate_sz_s *pthis, const void librock_PTR *pIndex, int iHTE);