#include "Inc.hpp"
//----------------------------------------------------------------
//ResultUnit 클래스 함수들
//----------------------------------------------------------------
void ResultUnit::Init(long period, long fieldnum, short keynum, char** key)
{
this->Period = period;
this->FieldNum = fieldnum;
this->KeyNum = keynum;
Key = new char* [KeyNum];
for(int i=0; i<KeyNum; i++)
{
Key[i] = new char [30];
strcpy(Key[i], key[i]);
}
value = new double* [Period];
for(int i=0; i<Period; i++)
{
value[i] = new double [FieldNum];
for(int j=0; j<FieldNum; j++)
{
value[i][j] = 0.0;
}
}
}
ResultUnit::~ResultUnit()
{
for(int i=0; i<KeyNum; i++)
{
delete [] Key[i];
}
delete [] Key;
for(int i=0; i<Period; i++)
{
delete [] value[i];
}
delete [] value;
}
bool ResultUnit::GroupCmp(char** key)
{
for(int i=0; i<KeyNum; i++)
{
if(strcmp(key[i], this->Key[i])!=0) return false;
}
return true;
}
void ResultUnit::Save(double** result)
{
for(int i=0; i<Period; i++)
{
for(int j=0; j<FieldNum; j++)
{
value[i][j] += result[i][j];
}
}
}
'Programs' 카테고리의 다른 글
| ModelEV.cpp (2) | 2014.08.14 |
|---|---|
| GrpKeyTable.cpp (0) | 2014.08.14 |
| FieldInfoSet.cpp (0) | 2014.08.14 |
| Inc.hpp (0) | 2014.08.14 |
| Group.cpp (0) | 2014.08.14 |
