/*******************************************************************************
 *
 *	Copyright (C) 2008 ITS Co., Ltd. All rights reserved.
 *
 *	SubSystem Name : 
 *	Initial Author : hsahn
 *	Description:
 *		CIntHash class created by tmpl_hash.py
 *		Key   : string(char *)
 *		Value : int, Set(int), Get(int), Get(CIntArray)
 *		if hash key collision, append as linked list
 *
 *		*** Don't edit this file manually ***
 ******************************************************************************/

#ifndef __INT_HASH_H__
#define __INT_HASH_H__

#include <stdio.h>
#include "cstream.h"
#include "cstring.h"
#include "str_array.h"
#include "int_array.h"


class V2_CLASS_API CIntHash
{
private:
	class CHashBag
	{
	public:
		int iHash;
		CString sKey;
		CIntArray vaData;
		CHashBag *pNext;
	};

	CHashBag **m_ppBag;
	int m_iBagSize;
	int m_iDataCnt;
	

public:
	CIntHash(int p_iBagSize=1024);
	~CIntHash();

	void Clear(void);
	int Set(const char *p_szKey, int p_szData, bool p_bOverwrite=false);
	int Get(const char *p_szKey, int *p_pVal);
	int Get(const char *p_szKey, CIntArray *p_pArr);
	
	void Remove(const char *p_szKey);
	void GetKeys(CStrArray &p_saKeys);

	void Dump(CStream *p_pBuffer);

	static int HashFunc(const char *p_sKey, int p_iLen);
};

#endif	// __INT_HASH_H__

