// apset.cpp : implementation file
//

#include "dllafx.h"
#include <afxext.h>
#include "example.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CApset

IMPLEMENT_DYNAMIC(CApset, CBtrFile)

CApset::CApset():CBtrFile()
{
	m_Group = 0;
	m_NPoint = 0;
	m_AX = 0;
	m_AY = 0;
	m_BX = 0;
	m_BY = 0;
	m_CX = 0;
	m_CY = 0;
	m_eps = 0;
	m_nFields = 9;
	CreateField(0,4,CField::integer,0);
	CreateField(d_group,2,CField::integer,0);
	CreateField(d_npoint,2,CField::integer,0);
	CreateField(d_ax,4,CField::floats,0);
	CreateField(d_ay,4,CField::floats,0);
	CreateField(d_bx,4,CField::floats,0);
	CreateField(d_by,4,CField::floats,0);
	CreateField(d_cx,4,CField::floats,0);
	CreateField(d_cy,4,CField::floats,0);
	CreateField(d_eps,4,CField::floats,0);
	CreateKey(0,0,0);
	CreateKey(1,0,d_group,0);
	CreateKey(1,1,d_npoint,1);
	TRY
	 {
	   Open("groups.dat",CBtrFile::openFast);
	 }
	CATCH (CBtrException,e)
	 {                   
	   char a[200];     
	   e->GetErrorText((LPSTR)a);
	   OutputDebugString(a);
	 }  
	END_CATCH 
	UseKey(1);
	DoFieldExchange();
}

CApset::~CApset()
{
Close();
}

void CApset::DoFieldExchange()
{
	m_Group=GetFieldInt(d_group);
	m_NPoint=GetFieldInt(d_npoint);
	m_AX=GetFieldFloat(d_ax);
	m_AY=GetFieldFloat(d_ay);
	m_BX=GetFieldFloat(d_bx);
	m_BY=GetFieldFloat(d_by);
	m_CX=GetFieldFloat(d_cx);
	m_CY=GetFieldFloat(d_cy);
	m_eps=GetFieldFloat(d_eps);
}

