// VirtualTable.cpp : _xZkqqHx_iDeDiDjDiDhGiDiKiDiBiDjDiDgFiBfLiDfGiDiHiDjD_xHqqkZx_ _xZkqqHx_iDhEiDeAiDeDiDiL_xHqqkZx_
//

#include "stdafx.h"
#include <assert.h>
#include "UtilErr.h"			// For FFThrowMiscUnknown.
#include "VirtualWriteTable.h"	// This header.

//----- 05.12.24 Fukushiro M. _xZkqqHx_iNoNiPjMiOgO_xHqqkZx_ ()-----
//#ifdef _DEBUG
//#define new DEBUG_NEW
//#undef THIS_FILE
//static char THIS_FILE[] = __FILE__;
//#endif
//----- 05.12.24 Fukushiro M. _xZkqqHx_iNoNiPjMiPeJ_xHqqkZx_ ()-----

/////////////////////////////////////////////////////////////////////////////
// FCVirtualWriteTable
//
// WRITE_xZkqqHx_iJlMjBhKiDgFiBfLiDhFiDiLiCmNiBeBjFkIjHjNiDgFiBfLiDhFiDiLiCmJjBmOiClFiCmEjFmPiNfIiCpAiKeKiOgOiClHiCoJiImKjChFiBgJiCgAiBgKiCmGiBeB_xHqqkZx_
// _xZkqqHx_jFmPiNfIiClHiCoJiDiMiDfCiBfLiDgIiDgGiBfLiDfOiBgJiCgBiBgKiCpAjFnLiOjNiClHiCoJiBeC_xHqqkZx_
// _xZkqqHx_iCgAiBiB_xHqqkZx_m_dwWriteRecordBeginIndex_xZkqqHx_iBeBiCgBiBiB_xHqqkZx_m_vVirtualWriteTable _xZkqqHx_iCmFiCkAiCoJiBeC_xHqqkZx_
//
//             _xZkqqHx_iEkBiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEkC_xHqqkZx_
// _xZkqqHx_jFkIjHjNiDgFiBfLiDhFiDiLiEkA_xHqqkZx_                        _xZkqqHx_iEkA_xHqqkZx_
//             _xZkqqHx_iEkEiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEkD_xHqqkZx_
//                         _xZkqqHx_iBkK_xHqqkZx_
//                         _xZkqqHx_iCgA_xHqqkZx_                    _xZkqqHx_iCgC_xHqqkZx_
//                         _xZkqqHx_iEkBiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEkC_xHqqkZx_
// _xZkqqHx_iJlMjBhKiDgFiBfLiDhFiDiL_xHqqkZx_            _xZkqqHx_iEkA_xHqqkZx_                    _xZkqqHx_iEkA_xHqqkZx_
//                         _xZkqqHx_iEkEiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEjPiEkD_xHqqkZx_
//                         _xZkqqHx_iEkFiEjPiEjPiEjPiEjP_xHqqkZx_ _xZkqqHx_iCgB_xHqqkZx_ _xZkqqHx_iEjPiEjPiEjPiEjPiEkH_xHqqkZx_
//
// _xZkqqHx_iNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iBeBjCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCmNiBeB_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmFiCkAiCoIiBeB_xHqqkZx_
// _xZkqqHx_iDiNiDgCiDeOiPiKjHeMiMkAiDhEiDeAiDeDiDiLiCmM_xHqqkZx_Identifier_xZkqqHx_iCmGiIoKjChGiClHiCoJiCmGiCmNiMmAiCoHiCmIiCkCiBeC_xHqqkZx_
// _xZkqqHx_iNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iCmNiBeBiDiMiDfCiBfLiDgIiCmMiNoNiPjMiCkKiCkAiCoJjDhIiCmJiJmBiOfKiClDiCoKiCoJiBeC_xHqqkZx_
// _xZkqqHx_jCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCmNiBeBiDiMiDfCiBfLiDgIiCmMjCmHiJmBiCkKiCkAiCoJjDhIiCmJiJmBiOfKiClDiCoKiCoJiBeC_xHqqkZx_
// _xZkqqHx_iClBiCoKiCoHiCmM_xHqqkZx_Identifier_xZkqqHx_iCmNiBeBiDhEiDiJiDgCiDfGiDiFiCmFiPiJiCnPiCmEiDiNiDgCiDeOiPiKjHeMiMkAiDhEiDeAiDeDiDiLiCmJ_xHqqkZx_
// _xZkqqHx_jElNiJgGiClDiCoKiCoJiBeC_xHqqkZx_
// FCVirtualRealTable_xZkqqHx_iCmFiCoAiNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iBeBjCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCkKjHhAiInDiClDiCoKiCmEiCkCiCoJiCkKiBeB_xHqqkZx_
// FCVirtualRealTable_xZkqqHx_iCmM_xHqqkZx_Identifier_xZkqqHx_iCmNiBeBiDiNiDgCiDeOiCpAiJpAiPjMiClFiCmEiCkCiClNiKnEiCmJjFkIjHjNiDgFiBfLiDhFiDiL_xHqqkZx_
// _xZkqqHx_iCmGjAeIiCkCiIoBiCkCiCkKjAlGiClGiCmEiCkCiCmIiCkCiCkJjClCiCnHiCoJiClNiCnPiCmMjCgMiCmFiCkAiCoIiBeBiDiNiDgCiDeOiCkKiDeMiBfLiDhGiClDiCoKiCmE_xHqqkZx_
// _xZkqqHx_iCkCiCoJiKnEiCmNiDiNiDgCiDeOiPiKjHeMiMkAiDhEiDeAiDeDiDiLiCmM_xHqqkZx_Identifier_xZkqqHx_iCmGjCgMiCkKiIoKjChGiClFiCmEiCkCiCoJiBeC_xHqqkZx_
//

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::FCVirtualWriteTable
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCVirtualWriteTable::FCVirtualWriteTable ()
			:	m_dwWriteRecordBeginIndex(0),
				m_guidTable(GUID_NULL),
				m_dwWriteDeleteIdentifier(DWORD(-1)),
				m_dwWriteAppendIdentifier(DWORD(-1))
{
} // FCVirtualWriteTable::FCVirtualWriteTable.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::~FCVirtualWriteTable
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCVirtualWriteTable::~FCVirtualWriteTable ()
{
//----- 06.02.13 Fukushiro M. _xZkqqHx_jCmHiJmBiOgO_xHqqkZx_ ()-----
	// _xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCpAjBfDiCmEiNoNiPjMiBeCiDhBiBfLiDhGiCkJiCoHiDgGiBfLiDfOiCpAiNoNiPjMiClHiCoJiBeC_xHqqkZx_
	ResetWriteRecordCache(0, DWORD(-1), DWORD(-1));
//----- 06.02.13 Fukushiro M. _xZkqqHx_jCmHiJmBiPeJ_xHqqkZx_ ()-----
} // FCVirtualWriteTable::~FCVirtualWriteTable.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteRecordBegin
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiCmMiDiMiDfCiBfLiDgIiKeKiOgOiImKjChFiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiCmMiDiMiDfCiBfLiDgIiKeKiOgOiImKjChFiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iPoDiCmMiJpAjAoAiCpAiOfBiPmGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::GetWriteRecordBegin () const
{
	return m_dwWriteRecordBeginIndex;
} // FCVirtualWriteTable::GetWriteRecordBegin.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteRecordEnd
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiCmMiDiMiDfCiBfLiDgIiPeJjCfLiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiCmMiDiMiDfCiBfLiDgIiPeJjCfLiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iPoDiCmMiJpAjAoAiCpAiOfBiPmGiBeCjAhNjCiGiCmMiCgCiCmJiCkAiClNiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::GetWriteRecordEnd () const
{
	// _xZkqqHx_iClBiClBiCmFiCmN_xHqqkZx_GetIsWriteRecordTerminated_xZkqqHx_iCmNiDgAiDeGiDgCiDeOiClFiCmEiCmNiCkCiCkPiCmIiCkCiBeC_xHqqkZx_
	// _xZkqqHx_iPeJjCfLjAnNjCoIiOjOiCmFiCoAiBeBiDgPiDgCiDhEiDeAiCmJiPeJjCfLiCkKiCkAiCoJiCkJiCmHiCkEiCkJjClCiCnHiCoJ_xHqqkZx_
	// _xZkqqHx_jFeLjHhGiCkKiCkAiCoJiClNiCnPiBeC_xHqqkZx_
	return GetWriteRecordBegin() + m_vVirtualWriteTable.size();
} // FCVirtualWriteTable::GetWriteRecordEnd.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteRecordDataSize
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDeDiDjDiDgGiDgCiDeOiDfIiCmM_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCmMiDfEiDeDiDfJiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwIndex	:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCmMiDfEiDeDiDfJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::GetWriteRecordDataSize (DWORD dwIndex) const
{
	return GetTableWriteRecord(dwIndex).m_dwSize;
} // FCVirtualWriteTable::GetWriteRecordDataSize.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteRecordData
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDeDiDjDiDgGiDgCiDeOiDfIiCmM_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCmMiDgGiBfLiDfOiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	pDataBuff	:_xZkqqHx_iDgGiBfLiDfOiCpAiOpDiCkPiOoGiCoJiDgPiDgCiDhEiDeAiCpAiOhHjCoIiBeC_xHqqkZx_
 *			dwBuffSize	:_xZkqqHx_iDgPiDgCiDhEiDeAiDfEiDeDiDfJiCpAiOhHjCoIiBeCjBfDiCmEiCmMiDgGiBfLiDfOiCpA_xHqqkZx_
 *						 _xZkqqHx_iOoGjDlOiClHiCoJiPoKiNiHiCmN_xHqqkZx_ DOWRD(-1) _xZkqqHx_iCpAiOhHjCoIiClFiCmEiCoAjHmHiCkCiBeC_xHqqkZx_
 *			dwIndex		:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jDmHiCnNiPgPiClDiCoKiClNiDgGiBfLiDfOiDfEiDeDiDfJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.12.19 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::GetWriteRecordData (void* pDataBuff, DWORD dwBuffSize, DWORD dwIndex) const
{
	return m_heap.GetData(pDataBuff, dwBuffSize, 0, GetTableWriteRecord(dwIndex).m_dwDataId);
} // FCVirtualWriteTable::GetWriteRecordData.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteRecordData
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDeDiDjDiDgGiDgCiDeOiDfIiCmM_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCmMiDgGiBfLiDfOiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	vDataBuff	:_xZkqqHx_iDgGiBfLiDfOiCpAiOpDiCkPiOoGiCoJiDgPiDgCiDhEiDeAiCpAiOhHjCoIiBeC_xHqqkZx_
 *			dwIndex		:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCVirtualWriteTable::GetWriteRecordData (BYTEVector& vDataBuff, DWORD dwIndex) const
{
	vDataBuff.resize(GetWriteRecordDataSize(dwIndex));
	GetWriteRecordData(&vDataBuff.front(), vDataBuff.size(), dwIndex);
} // FCVirtualWriteTable::GetWriteRecordData.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteRecord
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDeDiDjDiDgGiDgCiDeOiDfIiCmM_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwAppendIdentifier	:_xZkqqHx_iDiMiDfCiBfLiDgIiCmMjCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *			fliPrimaryId	:_xZkqqHx_iDhGiDiJiDeDiDhNiDiKiBfL_xHqqkZx_ID_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *			vDataBuff		:_xZkqqHx_iDgGiBfLiDfOiCpAiOpDiCkPiOoGiCoJiDgPiDgCiDhEiDeAiCpAiOhHjCoIiBeC_xHqqkZx_
 *			dwIndex			:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCVirtualWriteTable::GetWriteRecord (	DWORD& dwAppendIdentifier,
											flint& fliPrimaryId,
											BYTEVector& vRecordData,
											DWORD dwIndex) const
{
	dwAppendIdentifier = GetTableWriteRecord(dwIndex).m_dwAppendIdentifier;
	fliPrimaryId = GetTableWriteRecord(dwIndex).m_fliPrimaryId;
	GetWriteRecordData(vRecordData, dwIndex);
} // FCVirtualWriteTable::GetWriteRecord.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetTableGuid
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_GUID_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_GUID_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
GUID FCVirtualWriteTable::GetTableGuid () const
{
	return m_guidTable;
} // FCVirtualWriteTable::GetTableGuid.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::SetTableGuid
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_GUID_xZkqqHx_iCpAjAnNjCoIiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	guidTable	:_xZkqqHx_iDgFiBfLiDhFiDiL_xHqqkZx_GUID_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCVirtualWriteTable::SetTableGuid (GUID guidTable)
{
	m_guidTable = guidTable;
} // FCVirtualWriteTable::SetTableGuid.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteDeleteIdentifier
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmMiNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmMiNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::GetWriteDeleteIdentifier () const
{
	return m_dwWriteDeleteIdentifier;
} // FCVirtualWriteTable::GetWriteDeleteIdentifier.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetWriteAppendIdentifier
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmMjCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmMjCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::GetWriteAppendIdentifier () const
{
	return m_dwWriteAppendIdentifier;
} // FCVirtualWriteTable::GetWriteAppendIdentifier.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::ResetWriteRecordCache
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	WRITE_xZkqqHx_iDiMiDfCiBfLiDgIiDeMiDiDiDgCiDfGiDiFiCpAiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwRecordSize
 *					:_xZkqqHx_iMlLiNnNiCmMjFkIjHjNiDgFiBfLiDhFiDiLiCmMiDiMiDfCiBfLiDgIjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *					 _xZkqqHx_iJlMjBhKiDgFiBfLiDhFiDiLiCmM_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiCmMiKeKiOgOiImKjChFiCkKjAnNjCoIiClDiCoKiCoJiBeC_xHqqkZx_
 *			dwDeleteIdentifier
 *					:_xZkqqHx_iNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmM_xHqqkZx_
 *					 _xZkqqHx_iNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iCkKjAnNjCoIiClDiCoKiCoJiBeC_xHqqkZx_
 *			dwAppendIdentifier
 *					:_xZkqqHx_jCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFjAoKjHhAiCmM_xHqqkZx_
 *					 _xZkqqHx_jCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCkKjAnNjCoIiClDiCoKiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCVirtualWriteTable::ResetWriteRecordCache (	DWORD dwRecordSize,
													DWORD dwDeleteIdentifier,
													DWORD dwAppendIdentifier)
{
	vector<FCVirtualRecord>::iterator i;
	for (i = m_vVirtualWriteTable.begin(); i != m_vVirtualWriteTable.end(); i++)
	{
		if (i->m_dwDataId != DWORD(-1))
			m_heap.FreeData(i->m_dwDataId);
	}
	m_vVirtualWriteTable.clear();
	m_dwWriteRecordBeginIndex = dwRecordSize;
	m_dwWriteDeleteIdentifier = dwDeleteIdentifier;
	m_dwWriteAppendIdentifier = dwAppendIdentifier;
} // FCVirtualWriteTable::ResetWriteRecordCache.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::AppendWriteRecord
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgFiBfLiDhFiDiLiCmMiNmFiMoDiCmJiDiMiDfCiBfLiDgIiCpAjCmHiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	bIsFirstOfMulti	:_xZkqqHx_iNmFiPiJiCmMjCmHiJmBiCkJiCmHiCkEiCkJiCpAiOhHjCoIiBeC_xHqqkZx_
 *							 _xZkqqHx_jCfAjDmGiCmFjCmHiJmBiClHiCoJiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iCpAiOhHjCoIiBeBiCfBiCmCiImIiPoDiCmM_xHqqkZx_
 *							 _xZkqqHx_jIeBjBlBiClFiClNjCmHiJmBiCmMiPoKiNiHiCmNiCfAjEnEjGnKiCkK_xHqqkZx_TRUE_xZkqqHx_iBeBiCfBjEnEjGnKiImIiNhOiCmN_xHqqkZx_
 *							 FALSE_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_CMD_COPY_RECORD _xZkqqHx_iCmFiOgHiCkEiBeC_xHqqkZx_
 *			fliPrimaryId	:_xZkqqHx_iDhGiDiJiDeDiDhNiDiK_xHqqkZx_ID_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *			pRecordData		:_xZkqqHx_iDiMiDfCiBfLiDgIiDgGiBfLiDfOiCpAiOhHjCoIiBeCjFhDjHhGiCmMiPoKiNiHiCmN_xHqqkZx_NULL_xZkqqHx_iCpAiOhHjCoIiBeC_xHqqkZx_
 *			szRecordData	:_xZkqqHx_iDiMiDfCiBfLiDgIiDgGiBfLiDfOiCmMiDfEiDeDiDfJiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	_xZkqqHx_jCmHiJmBiClDiCoKiClNiDiMiDfCiBfLiDgIiCmMiDeDiDjDiDgGiDgCiDeOiDfIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.07 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
DWORD FCVirtualWriteTable::AppendWriteRecord (	BOOL bIsFirstOfMulti,
												flint fliPrimaryId,
												const void* pRecordData,
												size_t szRecordData)
{
	// _xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCkKjFmCiClGiCmEiCkCiCoJiPoKiNiHiCmNiDeHiDiJiBfLiBeC_xHqqkZx_
	if (GetIsWriteRecordTerminated())
		FFThrowMiscUnknown();
	FCVirtualRecord tableRecord;
	tableRecord.m_fliPrimaryId = fliPrimaryId;
	tableRecord.m_dwAppendIdentifier = GetWriteAppendIdentifier();
	if (bIsFirstOfMulti)
	//----- _xZkqqHx_iNmFiPiJiCmMjCmHiJmBiCmMiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_jCmHiJmB_xHqqkZx_Identifier_xZkqqHx_iCpAiNfIjAfGiBeC_xHqqkZx_
		m_dwWriteAppendIdentifier++;
		if (m_dwWriteAppendIdentifier == DWORD(-1))
			m_dwWriteAppendIdentifier = 0;
	}
	tableRecord.m_dwSize = szRecordData;
	if (szRecordData != 0)
	{
		tableRecord.m_dwDataId = m_heap.AllocateData(pRecordData, szRecordData);
	} else
	{
		tableRecord.m_dwDataId = DWORD(-1);
	}
	m_vVirtualWriteTable.push_back(tableRecord);
	return GetWriteRecordEnd() - 1;
} // FCVirtualWriteTable::AppendWriteRecord.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::ReduceWriteRecordCount
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiMiDfCiBfLiDgIjAjEiCpAjFmPiNfIiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwRecordSize	:_xZkqqHx_jFmPiNfIiClHiCoJjAjEiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iMlLiNnNiCmMiDiMiDfCiBfLiDgIjAjEiCoGiCoIiPkNiCmIiCkNiClHiCoJiPoKiNiHiCmNiDiMiDfCiBfLiDgIiCpAiNoNiPjMiClFiBeB_xHqqkZx_
 *			_xZkqqHx_jBoFiCkLiCkNiClHiCoJiPoKiNiHiCmNjGlDiMpIiCmIjCgMiCmMiDiMiDfCiBfLiDgIiCpAjCmHiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	05.12.16 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCVirtualWriteTable::ReduceWriteRecordCount (DWORD dwRecordSize)
{
	// _xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCkKjFmCiClGiCmEiCkCiCoJiPoKiNiHiCmNiDeHiDiJiBfLiBeC_xHqqkZx_
	if (GetIsWriteRecordTerminated())
		FFThrowMiscUnknown();
	assert(dwRecordSize <= GetWriteRecordEnd());
	if (GetWriteRecordEnd() != dwRecordSize)
	//----- _xZkqqHx_iKpJjBlGiDiMiDfCiBfLiDgIiDfEiDeDiDfJiCoGiCoIiPkMiClDiCkNiClHiCoJiPoKiNiH_xHqqkZx_ -----
	{
		// _xZkqqHx_iNoNiPjM_xHqqkZx_Identifier_xZkqqHx_iCpAiNfIjAfGiBeC_xHqqkZx_
		m_dwWriteDeleteIdentifier++;
		if (m_dwWriteDeleteIdentifier == DWORD(-1))
			m_dwWriteDeleteIdentifier = 0;

		while (GetWriteRecordEnd() != dwRecordSize)
		{
			if (m_vVirtualWriteTable.empty())
			{
				m_dwWriteRecordBeginIndex--;
			} else
			{
				if (m_vVirtualWriteTable.back().m_dwDataId != DWORD(-1))
					m_heap.FreeData(m_vVirtualWriteTable.back().m_dwDataId);
				m_vVirtualWriteTable.pop_back();
			}
		}
	}
} // FCVirtualWriteTable::ReduceWriteRecordCount.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::AppendWriteRecordTermination
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiDeMiDiDiDgCiDfGiDiFiCmJiPeJjCfLiCpAjCmHiJmBiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	_xZkqqHx_iDgHiDiJiDjDiDfFiDeOiDfGiDiHiDjDiDfCiDhNiDjDiDgIiCmMiBhF_xHqqkZx_CMD_COPY_RECORD_xZkqqHx_iBhGiCmNiDfEiBfLiDgPiBfLiDfEiDeDiDgI_xHqqkZx_
 *			_xZkqqHx_iCmMiJlMjBhKiDgFiBfLiDhFiDiLiCmFiCmMiCnNiPiIjHjNiClDiCoKiBeBiDeOiDiJiDeDiDeBiDjDiDgHiDfEiDeDiDgIiCmFiCmN_xHqqkZx_
 *			_xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCmJiPeJjCfLiCpAjAnNjCoIiClHiCoJiClBiCmGiCmFjBoDjHhAiClHiCoJiBeC_xHqqkZx_
 *			_xZkqqHx_iDeOiDiJiDeDiDeBiDjDiDgHiDfEiDeDiDgIiCmFiCmNiBeBiDiMiDfCiBfLiDgIiCmJiPeJjCfLiCkKjAnNjCoIiClDiCoKiCoJiCmGiImIiMoDiClLiCmM_xHqqkZx_
 *			_xZkqqHx_iDfEiBfLiDgPiBfLiCmJiCmNiPjBiCkLiNjOiCnNiCkKiPgPjHiIiCmIiCkCiBeCiOjPiCmMiDhEiDiJiDgCiDfGiDiFiOjOiCmJ_xHqqkZx_
 *			_xZkqqHx_jDmHiCnNiPgPiClFiDiMiDfCiBfLiDgIiDeMiDiDiDgCiDfGiDiFiClCiCmGiDgFiBfLiDhFiDiLiCmMiDeMiDiDiDgCiDfGiDiFiCpAiNoNiPjMiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void FCVirtualWriteTable::AppendWriteRecordTermination ()
{
	// _xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCkKjFmCiClGiCmEiCkCiCoJiPoKiNiHiCmNiDeHiDiJiBfLiBeC_xHqqkZx_
	if (GetIsWriteRecordTerminated())
		FFThrowMiscUnknown();

	// _xZkqqHx_jCmHiJmB_xHqqkZx_Identifier=DWORD(-1)_xZkqqHx_iCmMiDiMiDfCiBfLiDgIiCpAjCmHiJmBiBeC_xHqqkZx_
	// _xZkqqHx_jCmKiPoNiCmMjCmHiJmBiCmFiCmNiBeBjCmHiJmB_xHqqkZx_Identifier _xZkqqHx_iCmNiMiIiClFiCmE_xHqqkZx_ DWORD(-1)_xZkqqHx_iCmJiCmNiCmIiCoHiCmIiCkCiBeC_xHqqkZx_
	AppendWriteRecord(TRUE, -1, NULL, 0);
	m_vVirtualWriteTable.back().m_dwAppendIdentifier = DWORD(-1);
} // FCVirtualWriteTable::AppendWriteRecordTermination.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetIsWriteRecordTerminated
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiDeMiDiDiDgCiDfGiDiFiCmJiPeJjCfLiCkKjAnNjCoIiClDiCoKiCmEiCkCiCoJiCkJjClCiCnHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iJpAjAoA_xHqqkZx_>	AppendWriteRecordTermination _xZkqqHx_iCmMiJpAjAoAiCpAiOfBiPmGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.01 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCVirtualWriteTable::GetIsWriteRecordTerminated () const
{
	if (m_vVirtualWriteTable.empty())
		return FALSE;
	else
		return (m_vVirtualWriteTable.back().m_dwAppendIdentifier == DWORD(-1));
} // FCVirtualWriteTable::GetIsWriteRecordTerminated.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetTableWriteRecord
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCmMiBeB_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwIndex	:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *					 _xZkqqHx_jFeLiClI_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCkKjBlGiNnNiClHiCoJiClBiCmGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
FCVirtualRecord& FCVirtualWriteTable::GetTableWriteRecord (DWORD dwIndex)
{
	// _xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCkKjFmCiClGiCmEiCkCiCoJiPoKiNiHiCmNiDeHiDiJiBfLiBeC_xHqqkZx_
	if (GetIsWriteRecordTerminated())
		FFThrowMiscUnknown();
	return m_vVirtualWriteTable[dwIndex - GetWriteRecordBegin()];
} // FCVirtualWriteTable::GetTableWriteRecord.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::GetTableWriteRecord
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCmMiBeB_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCpAjFnEiClHiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwIndex	:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *					 _xZkqqHx_jFeLiClI_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCkKjBlGiNnNiClHiCoJiClBiCmGiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
const FCVirtualRecord& FCVirtualWriteTable::GetTableWriteRecord (DWORD dwIndex) const
{
	// _xZkqqHx_iPjBiCkLiNjOiCnNiDiMiDfCiBfLiDgIiCkKjFmCiClGiCmEiCkCiCoJiPoKiNiHiCmNiDeHiDiJiBfLiBeC_xHqqkZx_
	if (GetIsWriteRecordTerminated())
		FFThrowMiscUnknown();
	return m_vVirtualWriteTable[dwIndex - GetWriteRecordBegin()];
} // FCVirtualWriteTable::GetTableWriteRecord.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	FCVirtualWriteTable::IsWriteRecordInside
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iOhHjCoIiClDiCoKiClNiDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCmJiBeB_xHqqkZx_WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiCkKjBlGiNnNiClHiCoJiCkJ_xHqqkZx_
 *			_xZkqqHx_jClCiCnHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	dwIndex	:_xZkqqHx_iDiMiDfCiBfLiDgIiDeDiDjDiDgGiDgCiDeOiDfIiCpAiOhHjCoIiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jFnEjCgM_xHqqkZx_>	WRITE_xZkqqHx_iDeMiDiDiDgCiDfGiDiFiDiMiDfCiBfLiDgIiCkKjBlGiNnNiClHiCoJiPoKiNiHiCmN_xHqqkZx_TRUE_xZkqqHx_iBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	06.02.13 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
BOOL FCVirtualWriteTable::IsWriteRecordInside (DWORD dwIndex) const
{
	return (GetWriteRecordBegin() <= dwIndex && dwIndex < GetWriteRecordEnd());
} // FCVirtualWriteTable::IsWriteRecordInside.
