#ifndef __ObjIDTbl_h
#define __ObjIDTbl_h

//----- 05.06.17 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
///*********************************************************************
// *
// *	DWORD_xZkqqHx_iMfOiCmM_xHqqkZx_ID_xZkqqHx_iCpAiOjNiCmCiDeJiDhFiDfHiDeGiDeOiDgHiCpAiKmHjHjNiClHiCoJiDeOiDiJiDfIiBeC_xHqqkZx_
// *	_xZkqqHx_iDeJiDhFiDfHiDeGiDeOiDgHiCmM_xHqqkZx_ID_xZkqqHx_iCmGiDeJiDhFiDfHiDeGiDeOiDgHiDhMiDeDiDjDiDfOiCmMiDgFiBfLiDhFiDiLiCpAiKmHjHjNiClHiCoJiBeC_xHqqkZx_
// *	_xZkqqHx_iHeA_xHqqkZx_ ID_xZkqqHx_iCkKjEpCiCnBjEpCiCnBiCmJiCmIiCmBiCmEiCoAiKmHjHjNiDgFiBfLiDhFiDiLiCkKiDiBiDiCiDiKiCpAjIfBjEoPiClFiCmIiCkCiCoGiCkEiCmJiClHiCoJiBeC_xHqqkZx_
// *	_xZkqqHx_iHeB_xHqqkZx_ ObjectID_xZkqqHx_iCkJiCoH_xHqqkZx_FDObjVoid_xZkqqHx_iDhMiDeDiDjDiDfOiCnGiCmMiNiCjBkMjFmPiKlHiBeC_xHqqkZx_
// *	_xZkqqHx_iHeC_xHqqkZx_ ObjectID_xZkqqHx_iCkKiDiGiDgKiBfLiDeOiCmJiCmIiCoJiCoGiCkEiCmJiKmHjHjNiClHiCoJiBeC_xHqqkZx_
// *
// *	ObjectID_xZkqqHx_iCmN_xHqqkZx_unsigned_xZkqqHx_iCmM_xHqqkZx_32Bit_xZkqqHx_jAkOjAjEiBeC_xHqqkZx_
// *
// *    0x X X  X X  X X  X X
// *       ---  ------ ------
// *      Tbl0   Tbl1   Tbl2
// *
//
//                    Tbl0        Tbl1         Tbl2
//                     _xZkqqHx_iBkL_xHqqkZx_          _xZkqqHx_iBkL_xHqqkZx_           _xZkqqHx_iBkL_xHqqkZx_
//	ObjIDTbl_xZkqqHx_iEkG_xHqqkZx_Table0[00]_xZkqqHx_iEkG_xHqqkZx_Table1[000]_xZkqqHx_iEkG_xHqqkZx_Table2[000]
//			_xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_           _xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			_xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkA_xHqqkZx_           _xZkqqHx_iEkE_xHqqkZx_Table2[fff]
//			_xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			_xZkqqHx_iEkA_xHqqkZx_          _xZkqqHx_iEkE_xHqqkZx_Table1[fff]_xZkqqHx_iEkG_xHqqkZx_Table2[000]
//			_xZkqqHx_iEkA_xHqqkZx_                       _xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			_xZkqqHx_iEkA_xHqqkZx_                       _xZkqqHx_iEkE_xHqqkZx_Table2[fff]
//			_xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			_xZkqqHx_iEkE_xHqqkZx_Table0[ff]_xZkqqHx_iEkG_xHqqkZx_Table1[000]_xZkqqHx_iEkG_xHqqkZx_Table2[000]
//			            _xZkqqHx_iEkA_xHqqkZx_           _xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			            _xZkqqHx_iEkA_xHqqkZx_           _xZkqqHx_iEkE_xHqqkZx_Table2[fff]
//			            _xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			            _xZkqqHx_iEkE_xHqqkZx_Table1[fff]_xZkqqHx_iEkG_xHqqkZx_Table2[000]
//			                         _xZkqqHx_iEkF_xHqqkZx_  _xZkqqHx_iBeG_xHqqkZx_
//			                         _xZkqqHx_iEkE_xHqqkZx_Table2[fff]
//
//
// ********************************************************************/
//
//class FCObjIDTbl;
//class FCObjIDTbl1;
//class FCObjIDTbl2;
//
//#define TBL1_SIZE	0x100
//#define TBL2_SIZE	0x1000
//#define TBL3_SIZE	0x1000
//
//class FCObjIDTbl
//{
//public:
//	FCObjIDTbl ();
//	~FCObjIDTbl ();
//	DWORD	Register (void* pObj);
//	void	Register (void* pObj, DWORD dwID);
//	void	Unregister (DWORD dwID);
//	void	ClearAll ();
//	void*	IDtoObject (DWORD dwID) const;
//	BOOL	IsEmpty () const;
//	DWORD	GetFirstID () const;
//	DWORD	GetNextID (DWORD dwID) const;
//
//private:
//	FCObjIDTbl1*	m_pTable[TBL1_SIZE];
//};
//
//class FCObjIDTbl1
//{
//public:
//	FCObjIDTbl1 ();
//	~FCObjIDTbl1 ();
//	DWORD	Register (void* pObj);
//	void	Register (void* pObj, DWORD dwID);
//	void	Unregister (DWORD dwID);
//	void	ClearAll ();
//
//private:
//friend class FCObjIDTbl;
//	WORD			m_wVacantC;	// _xZkqqHx_iLpDiCkLiCkKjHeMiCoJ_xHqqkZx_m_pTable_xZkqqHx_iCmMjAjEiBeC_xHqqkZx_
//	WORD			m_wUsedC;	// _xZkqqHx_iOgHiCoNiCoKiCmEiCkCiCoJ_xHqqkZx_m_pTable_xZkqqHx_iCmMjAjEiBeC_xHqqkZx_
//	FCObjIDTbl2*	m_pTable[TBL2_SIZE];
//};
//
//class FCObjIDTbl2
//{
//public:
//	FCObjIDTbl2 ();
//	~FCObjIDTbl2 ();
//	DWORD	Register (void* pObj);
//	void	Register (void* pObj, DWORD dwID);
//	void	Unregister (DWORD dwID);
//	void	ClearAll ();
//
//private:
//friend class FCObjIDTbl;
//friend class FCObjIDTbl1;
//	WORD	m_wCount;	// m_pTable_xZkqqHx_iCmMiLpDiCkLjAjEiBeC_xHqqkZx_
//	void*	m_pTable[TBL3_SIZE];
//};
//----- 05.06.17 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----

#include "SimpleHash.h"	// Superclass.

/*************************************************************************
 * <_xZkqqHx_iNfMjBkCjBmM_xHqqkZx_>	FCObjIDTblFactory
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	FCObjIDTbl_xZkqqHx_iCmMiDhEiDeAiDeOiDgHiDiKiBfLiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.06.17 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
struct FCObjIDTblFactory
{
	inline static void* Invalid () { return NULL; }
	inline static void Delete (void* v) { }
}; // struct FCObjIDTblFactory.

class FCObjIDTbl : public FCSimpleHash<DWORD, void*, FCObjIDTblFactory>
{
private:
	typedef FCSimpleHash<DWORD, void*, FCObjIDTblFactory> BASE_CLASS;
public:
	DWORD	Register (void* pObj)
		{
			DWORD id;
			if (!BASE_CLASS::GetFreeId(id)) return DWORD(-1);
			BASE_CLASS::Set(id, pObj);
			return id;
		}
	void	Register (void* pObj, DWORD dwID)
		{
			BASE_CLASS::Set(dwID, pObj);
		}
	void	Unregister (DWORD dwID)
		{
			BASE_CLASS::Set(dwID, NULL);
		}
	void	ClearAll ()
		{
			BASE_CLASS::Clear();
		}
	void*	IDtoObject (DWORD dwID) const
		{
			return BASE_CLASS::Get(dwID);
		}
	BOOL	IsEmpty () const
		{
			return BASE_CLASS::IsEmpty();
		}
	DWORD	GetFirstID () const
		{
			DWORD id;
			if (!BASE_CLASS::GetFirstId(id))
				return DWORD(-1);
			else
				return id;
		}
	DWORD	GetNextID (DWORD dwID) const
		{
			if (!BASE_CLASS::GetNextId(dwID))
				return DWORD(-1);
			else
				return dwID;
		}
}; // class FCObjIDTbl.

//----- 05.06.17 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----

#endif//__ObjIDTbl_h

