📄 typeclass.cpp
字号:
// TypeClass.cpp: implementation of the CTypeClass class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TypeClass.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CTypeClass::CTypeClass()
{
m_pdCenter = NULL;
m_pdVariance = NULL;
}
CTypeClass::CTypeClass(int iPattDim)
{
m_iPattDim = iPattDim;
m_pdCenter = NULL;
m_pdVariance = NULL;
m_pdCenter = new double[m_iPattDim];//Class Center
memset(m_pdCenter, 0, sizeof(double)*m_iPattDim);
m_pdVariance = new double[m_iPattDim];//Class Variance;
memset(m_pdVariance, 0, sizeof(double)*m_iPattDim);
}
CTypeClass::~CTypeClass()
{
delete[] m_pdVariance;
m_pdVariance = NULL;
delete[] m_pdCenter;
m_pdCenter = NULL;
}
CTypeClass::CTypeClass(const CTypeClass& CopyClass)
{
m_iPattDim = CopyClass.m_iPattDim;
m_pdCenter = new double[m_iPattDim];//Class Center
m_pdVariance = new double[m_iPattDim];//Class Variance;
memcpy(m_pdCenter, CopyClass.m_pdCenter, sizeof(double)*m_iPattDim);
memcpy(m_pdVariance, CopyClass.m_pdVariance, sizeof(double)*m_iPattDim);
}
CTypeClass CTypeClass::operator =(const CTypeClass& RClass)
{
m_iPattDim = RClass.m_iPattDim;
if(m_pdCenter != NULL)
delete[] m_pdCenter;
m_pdCenter = new double[m_iPattDim];//Class Center
if(m_pdVariance != NULL)
delete[] m_pdVariance;
m_pdVariance = new double[m_iPattDim];//Class Variance;
memcpy(m_pdCenter, RClass.m_pdCenter, sizeof(double)*m_iPattDim);
memcpy(m_pdVariance, RClass.m_pdVariance, sizeof(double)*m_iPattDim);
return *this;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -