// EverestDataSources.h: interface for the CEverestDataSources class.
//
// created by Unwinder
//////////////////////////////////////////////////////////////////////
#ifndef _EVERESTSHAREDMEMORY_H_INCLUDED_
#define _EVERESTSHAREDMEMORY_H_INCLUDED_
//////////////////////////////////////////////////////////////////////
#include <afxtempl.h>
//////////////////////////////////////////////////////////////////////
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//////////////////////////////////////////////////////////////////////
typedef struct EVEREST_DATA_SOURCE_DESC
{
	char	szID[32];
		//internal everest source ID (e.g. TCPU)

	char	szName[32];
		//source name
	char	szDim[32];
		//source dimension
	char	szDesc[64];
		//source description
	char	szGroup[16];
		//source group

	FLOAT	fltMaxLimit;
		//maximum limit
	FLOAT	fltMinLimit;
		//minimum limit
	FLOAT	fltGridDim;
		//grid dimension 

	FLOAT	fltData;
		//source data

} EVEREST_DATA_SOURCE_DESC, *LPEVEREST_DATA_SOURCE_DESC;
//////////////////////////////////////////////////////////////////////
class CEverestDataSources : public CList<LPEVEREST_DATA_SOURCE_DESC,LPEVEREST_DATA_SOURCE_DESC>
{
public:
	BOOL						Init(LPCSTR lpFilename);
	void						Uninit();
	void						InvalidateSources();

	LPCSTR						GetCache();

	LPEVEREST_DATA_SOURCE_DESC	GetSourceDesc(DWORD dwSource);
	FLOAT						GetSourceData(DWORD dwSource);

	CEverestDataSources();
	virtual ~CEverestDataSources();

private:

	CString	m_strID;
	CString m_strValue;
	CString m_strCache;

	BOOL ParseXML(LPCSTR lpText);
	void ParseXMLElement(LPCSTR lpTag, LPCSTR lpVal, int nLevel);

	BOOL UpdateSource(LPCSTR lpID, LPCSTR lpValue);
	void UpdateSources();
};
//////////////////////////////////////////////////////////////////////
#endif 
//////////////////////////////////////////////////////////////////////
