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

#ifndef __STR_HASH_H__
#define __STR_HASH_H__

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



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

	CHashBag **m_ppBag;
	int m_iBagSize;
	int m_iDataCnt;
	

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

	void Clear(void);
	int Set(const char *p_szKey, char * p_szData, bool p_bOverwrite=false);
	int Get(const char *p_szKey, CString *p_pVal);
	int Get(const char *p_szKey, CStrArray *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	// __STR_HASH_H__

