⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hash.h

📁 读取Segy格式地震数据的类SegyReader, 在segy.h文件中有segy卷头/道头的每一个字段的中文详细说明,方便大家查询使用. 另外, 使用QT3.x制作的GUI界面程序, 可
💻 H
字号:
/*----------------------------------------------------------------
// 文件名:Hash.h
// 文件功能描述:此类简单实现了一个hash表的功能
//----------------------------------------------------------------*/

#ifndef _HASH_H_
#define _HASH_H_

#define KEYLENGTH 64  //宏定义 

class CHashElem 
{
 public:
    ~CHashElem(){  }
    int Key;
    int Val;
    CHashElem *pNext;
};

class CHash
{
 public:
     CHash(int iSlots = 10);
     ~CHash();

public: 
    /**//*
    *功能:根据键名称,获取键值
    *@Key:键名称;
    *@Val:键值;
    *返回:If the function succeeds, the return value is true.
    */
    bool QueryValue(const int Key,int & Val);

    /**//*
    *功能:根据键名称,插入键值
    *@Key:键名称;
    *@Val:键值;
    *返回:If the function succeeds, the return value is true.
    */
     bool Insert(int Key, int Val); 
     
    /**//*
     *功
     *@Key:键名称;
     *返回:If the function succeeds, the return value is true.
     */
     bool Remove(const int Key);  

     /**//*
     *功能:获取哈希表长度
     *返回:If the function succeeds, the return value is the hash lenghth.
     */
     int GetLength();  

    /**//*
     *功能:根据键名称,获取键值
     *返回:If the function succeeds, the return value is the hash lenghth.
     */
     int GetSlotNum();
     /**//*
     *功能:根据索引返回
     *@iIndex:键的索引号;
     *返回:If the function succeeds, the return value is CHashElem.
     */
      CHashElem*  QueryElem(const int iIndex);

 protected:
     
     CHashElem **m_pHashSlots;
     int m_iNumSlots; 
     int m_iLength;
     
};

#endif 

⌨️ 快捷键说明

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