#if !defined(AFX_DBGROUP_H__E9F5B3D7_0BE9_49FD_A12D_FEE8C8561E3C__INCLUDED_)
#define AFX_DBGROUP_H__E9F5B3D7_0BE9_49FD_A12D_FEE8C8561E3C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DbGroup.h : _xZkqqHx_iDhHiDgCiDfPiBfL_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "DbTable.h"	// For Baseclass.

#ifdef SUPER_CLASS
#undef SUPER_CLASS
#endif
#define SUPER_CLASS FCDbTable

extern const DWORD	CONTROL_TABLE_ID;
#define FD_CONTROL_TABLE_ID DWORD(0)

//
//  _xZkqqHx_iKmHjHjNiDgFiBfLiDhFiDiLiCmMiDeHiDjDiDgHiDiKiBfLiBeC_xHqqkZx_
// _xZkqqHx_iEkBiEjPiEjPiEjPiEkGiEjPiEjPiEjPiEjPiEkGiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEkC_xHqqkZx_
// _xZkqqHx_iEkAiDfOiDeDiDhGiEkA_xHqqkZx_  ID    _xZkqqHx_iEkA_xHqqkZx_     _xZkqqHx_iDgGiBfLiDfO_xHqqkZx_     _xZkqqHx_iEkA_xHqqkZx_
// _xZkqqHx_iEkEiEjPiEjPiEjPiEkIiEjPiEjPiEjPiEjPiEkIiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEkD_xHqqkZx_
// _xZkqqHx_iEkF_xHqqkZx_ BYTE _xZkqqHx_iEkJ_xHqqkZx_- DWORD _xZkqqHx_iEkJiEjPiEjP_xHqqkZx_ _xZkqqHx_jEeDiInD_xHqqkZx_ _xZkqqHx_iEjPiEjPiEjPiEkH_xHqqkZx_
//

#define FD_CONTROL_TYPE_SIZE	sizeof(BYTE)
#define FD_CONTROL_ID_SIZE		sizeof(DWORD)

struct FCTableName;
class FCDbLockBank;

/////////////////////////////////////////////////////////////////////////////
// FCDbGroup _xZkqqHx_iDeFiDeCiDjDiDgIiDeF_xHqqkZx_

class FCDbGroup : public SUPER_CLASS
{
protected:
typedef SUPER_CLASS BASE_CLASS;

public:
	FCDbGroup ();
	FCDbGroup (const FCTableName& groupName);
	virtual ~FCDbGroup ();
	virtual FCDbGroup	CreateSubGroup (FCDbReadLock& readLock,
										FCDbWriteLock& writeLock,
										const void* pData,
										size_t szDataSize,
										DWORD dwGroupId = DWORD(-1));
	virtual FCDbTable	CreateSubTable (FCDbReadLock& readLock,
										FCDbWriteLock& writeLock,
										const void* pData,
										size_t szDataSize,
										DWORD dwTableId = DWORD(-1));
	virtual DWORD		GetFreeId (BYTE byType);
	virtual void		GetFreeIds (DWORDSet& stFreeIds, BYTE byType, size_t szCount);

// 06.02.10 Fukushiro M. 1_xZkqqHx_iNhDiNoNiPjM_xHqqkZx_ ()
//	virtual BOOL		GetIsSubGroupExist (DWORD dwGroupId) const;
	virtual BOOL		GetIsSubTableExist (DWORD dwTableId) const;

//----- 06.01.10 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	virtual FCDbGroup	GetSubGroup (DWORD dwGroupId);
//	virtual FCDbTable	GetSubTable (DWORD dwTableId);
//----- 06.01.10 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	virtual FCDbGroup	GetSubGroup (	DWORD dwTableId0,
										DWORD dwTableId1 = DWORD(-1),
										DWORD dwTableId2 = DWORD(-1),
										DWORD dwTableId3 = DWORD(-1));
	virtual FCDbTable	GetSubTable (	DWORD dwTableId0,
										DWORD dwTableId1 = DWORD(-1),
										DWORD dwTableId2 = DWORD(-1),
										DWORD dwTableId3 = DWORD(-1));
//----- 06.01.10 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----

//----- 06.02.04 Fukushiro M. _xZkqqHx_jFmPiNfIjBeP_xHqqkZx_ ()-----
//	virtual BOOL		TryLockLower (	FCDbReadLockVector& vReadLock,
//										FCDbWriteLockVector& vWriteLock);
//----- 06.02.04 Fukushiro M. _xZkqqHx_jFmPiNfIiMoD_xHqqkZx_ ()-----
	virtual BOOL		TryLockLower (FCDbLockBank& lockBank);
//----- 06.02.04 Fukushiro M. _xZkqqHx_jFmPiNfIiPeJ_xHqqkZx_ ()-----
	virtual void		DeleteSubGroup (DWORD dwGroupId);
	virtual void		DeleteSubTable (DWORD dwTableId);
	virtual FCTableName	GetGroupName () const;
	virtual FCTableName	GetSubTableName (	DWORD dwTableId0,
											DWORD dwTableId1 = DWORD(-1),
											DWORD dwTableId2 = DWORD(-1),
											DWORD dwTableId3 = DWORD(-1)) const;
	virtual void		GetControlRecord (BYTE& byType, DWORD& dwId, BYTEVector* vData, DWORD dwIndex);
	virtual DWORD		FindEntry (BYTE byType, DWORD dwId);

protected:
	virtual void		AppendControlRecord (BYTE byType, DWORD dwId, const void* pData, size_t szDataSize);
	virtual void		myDeleteLower ();
	virtual void		GetEntryList (DWORDSet& stTableId, BYTE byType);
	virtual BOOL		GetIsLockLower (BOOL bIsCheckWriteLock);

	static void			MakeControlRecord (BYTEVector& vBuff, BYTE byType, DWORD dwId, const BYTE* pData, size_t szData);
	static BYTE			GetTypeFromControlRecord (const BYTE* pData);
	static DWORD		GetIdFromControlRecord (const BYTE* pData);
	static const BYTE*	GetDataFromControlRecord (const BYTE* pData);

public:
	// _xZkqqHx_iKmHjHjNiDgFiBfLiDhFiDiLiCmMjDgPjIfOiDfOiDeDiDhGiBeC_xHqqkZx_
	enum
	{
		FDCT_TYPE_TABLE = 0,		// _xZkqqHx_iDgFiBfLiDhFiDiLiBeC_xHqqkZx_
		FDCT_TYPE_GROUP = 1,		// _xZkqqHx_iDePiDiLiBfLiDhGiBeC_xHqqkZx_
		FDCT_TYPE_ASCII = 2,		// ASCII_xZkqqHx_iDgFiDeMiDfIiDgHiDgGiBfLiDfOiBeC_xHqqkZx_
		FDCT_TYPE_UNICODE = 3,		// UNICODE_xZkqqHx_iDgFiDeMiDfIiDgHiDgGiBfLiDfOiBeC_xHqqkZx_
		FDCT_TYPE_BINARY = 4,		// _xZkqqHx_iDgPiDeDiDgJiDiKiDgGiBfLiDfOiBeC_xHqqkZx_
	};
}; // class FCDbGroup.

/////////////////////////////////////////////////////////////////////////////

#endif // !defined(AFX_DBGROUP_H__E9F5B3D7_0BE9_49FD_A12D_FEE8C8561E3C__INCLUDED_)
