#include "stdafx.h"
#include "2LinkManager.h"	// This header.

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

////////////////////////////////////////////////////////////////////////////
// MC2LinkRec_xZkqqHx_iDiBiDjDiDgPiKnGjAjEiBeC_xHqqkZx_

////////////////////////////////////////////////////////////////////////////
// MC2LinkManager_xZkqqHx_iDiBiDjDiDgPiKnGjAjEiBeC_xHqqkZx_

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2LinkManager::MC2LinkManager
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDfCiDjDiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
MC2LinkManager::MC2LinkManager ()
{
} // MC2LinkManager::MC2LinkManager.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2LinkManager::~MC2LinkManager
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDgGiDfIiDgHiDiJiDeOiDfOiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.18 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
MC2LinkManager::~MC2LinkManager ()
{
	ClearAll();
} // MC2LinkManager::~MC2LinkManager.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2LinkManager::ClearAll
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_jBfDiCmEiCmMiPoOjFpBiCpAiPmBiLiOiClFiBeBiPiJiKpKiJlLiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void MC2LinkManager::ClearAll ()
{
	// _xZkqqHx_iDiKiDjDiDeOiDeJiDhFiDfHiDeGiDeOiDgHiCpAiNoNiPjMiClHiCoJiBeC_xHqqkZx_
	map<DWORD, MC2LinkRec*>::iterator i;
	for (i = m_mpLinkID.begin(); i != m_mpLinkID.end(); i++)
		delete (*i).second;
	// _xZkqqHx_iDiBiDeDiDjDiDiKiDjDiDeOiDgFiBfLiDhFiDiLiCpAiPmBiLiOiClHiCoJiBeC_xHqqkZx_
	m_mpLinkID.clear();
} // MC2LinkManager::ClearAll.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2LinkManager::OutStream
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiBiDeDiDjDiDgFiBfLiDhFiDiLiCkJiCoHiDiKiDjDiDeOiPoOjFpBiCpAiDfIiDgHiDiKiBfLiDiAiCmJiPgPjHmNiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ar	:_xZkqqHx_iPgPjHmNjAoGiDeBiBfLiDeKiDeDiDhFiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void MC2LinkManager::OutStream (MCARCHIVE& ar)
{
	// _xZkqqHx_iDiBiDeDiDjDiDgFiBfLiDhFiDiLiCmMiDiKiDjDiDeOiCfAiCmCiClIiCmCiCpAiDiLiBfLiDhGiBeC_xHqqkZx_
	map<DWORD, MC2LinkRec*>::iterator i;
	for (i = m_mpLinkID.begin(); i != m_mpLinkID.end(); i++)
	{
		DWORD dwLinkID = (*i).first;
		MC2LinkRec* linkRec = (*i).second;
		// _xZkqqHx_iDiKiDjDiDeO_xHqqkZx_ID_xZkqqHx_iCpAiPgPjHmNiClHiCoJiBeC_xHqqkZx_
		ar << dwLinkID;
		// _xZkqqHx_iDiKiDjDiDeOiDiMiDfCiBfLiDgIiCpAiPgPjHmNiClHiCoJiBeC_xHqqkZx_
		ar.Write(linkRec, sizeof(*linkRec));
	}
	// _xZkqqHx_iPeJjHlJiDfCiBfLiDgIiCpAiPgPjHmNiClHiCoJiBeC_xHqqkZx_
	ar << DWORD(-1);
} // MC2LinkManager::OutStream.

/*************************************************************************
 * <_xZkqqHx_iKnGjAjE_xHqqkZx_>	MC2LinkManager::InStream
 *
 * <_xZkqqHx_iLeAjEfM_xHqqkZx_>	_xZkqqHx_iDiKiDjDiDeOiPoOjFpBiCpAiDfIiDgHiDiKiBfLiDiAiCkJiCoHjDpMjHmNiClFiBeBiDiBiDeDiDjDiDgFiBfLiDhFiDiLiCmJiNoMjAkMiBeFjDgPjIfOiClHiCoJiBeC_xHqqkZx_
 *
 * <_xZkqqHx_iIpIjAjE_xHqqkZx_>	ar	:_xZkqqHx_jDpMjHmNiMlDiDeBiBfLiDeKiDeDiDhFiBeC_xHqqkZx_
 *
 * <_xZkqqHx_jHjKjHpA_xHqqkZx_>	99.05.24 Fukushiro M. _xZkqqHx_iNoMjAkM_xHqqkZx_
 *************************************************************************/
void MC2LinkManager::InStream (MCARCHIVE& ar)
{
	// _xZkqqHx_jBfDiCmEiCmMjDoAjFjEiPoOjFpBiCpAjGjFiPmBiBeC_xHqqkZx_
	ClearAll();
	DWORD dwLinkID;
	for (;;)
	{
		// _xZkqqHx_iDiKiDjDiDeO_xHqqkZx_ID_xZkqqHx_iCpAjDmHiCnNiNjOiCnOiBeC_xHqqkZx_
		ar >> dwLinkID;
		// _xZkqqHx_iDiKiDjDiDeO_xHqqkZx_ID_xZkqqHx_iCkKiPeJjHlJiDfCiBfLiDgIiCmIiCoHiCmOiPeJjHlJiBeC_xHqqkZx_
		if (dwLinkID == DWORD(-1)) break;
		// _xZkqqHx_iDiKiDjDiDeOiCpAiNoMjAkMiBeC_xHqqkZx_
		MC2LinkRec* linkRec = new MC2LinkRec;
		// _xZkqqHx_iDiKiDjDiDeOiCpAjDmHiCnNiNjOiCnOiBeC_xHqqkZx_
		ar.Read(linkRec, sizeof(*linkRec));
		// _xZkqqHx_iDiKiDjDiDeO_xHqqkZx_ID->_xZkqqHx_iDiKiDjDiDeOiDgFiBfLiDhFiDiLiCnGjDgPjIfOiBeC_xHqqkZx_
		m_mpLinkID[dwLinkID] = linkRec;
	}
} // MC2LinkManager::InStream.

