hashtab.h

来自「一个不错的fastdb使用例子」· C头文件 代码 · 共 54 行

H
54
字号
//-< HASHTAB.CPP >---------------------------------------------------*--------*
// FastDB                    Version 1.0         (c) 1999  GARRET    *     ?  *
// (Main Memory Database Management System)                          *   /\|  *
//                                                                   *  /  \  *
//                          Created:     20-Nov-98    K.A. Knizhnik  * / [] \ *
//                          Last update: 10-Dec-98    K.A. Knizhnik  * GARRET *
//-------------------------------------------------------------------*--------*
// Extensible hash table interface
//-------------------------------------------------------------------*--------*

#ifndef __HASHTAB_H__
#define __HASHTAB_H__

class FASTDB_DLL_ENTRY dbHashTableItem
{

public:
  oid_t next;
  oid_t record;
  nat4  hash;
};

const size_t dbInitHashTableSize = 16*1024-1;


class FASTDB_DLL_ENTRY dbHashTable
{
  nat4  size;
  nat4  used;
  oid_t page;

  static unsigned strHashCode(byte* key, int keylen);
  static unsigned hashCode(byte* key, int keylen);
  static int const keySize[];

public:
  static oid_t allocate(dbDatabase* db, size_t nRows = 0);

  static void  insert(dbDatabase* db, oid_t hashId,
                      oid_t rowId, int type, int sizeofType, int offs, size_t nRows);

  static void  remove
    (dbDatabase* db, oid_t hashId,
     oid_t rowId, int type, int sizeofType, int offs);

  static void  find(dbDatabase* db, oid_t hashId, dbSearchContext& sc);

  static void  drop(dbDatabase* db, oid_t hashId);

  static void  purge(dbDatabase* db, oid_t hashId);
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?