Code:

class spectrum
{
public:
spectrum(spectrometer *Owner,const unsigned short arrSize,String Title);
spectrometer *owner;
unsigned short size;
double *data;
void __fastcall fill(double val);
String title;
double max;
String __fastcall asString();
~spectrum()
{
delete[] data;
delete &title;
delete &max;
delete &size;
}
double &operator [](const int i)
{
return data[i];
}
spectrum operator +(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
spectrum result(owner,rsize,"result");
int i=-1;
while(++i<rsize)
{
result[i]=data[i] + A.data[i];
}
return result;
};
spectrum operator *(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
spectrum result(owner,rsize,"result");
int i=-1;
while(++i<rsize)
{
result[i]=data[i] * A.data[i];
}
return result;
};
spectrum operator -(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
spectrum result(owner,rsize,"result");
int i=-1;
while(++i<rsize)
{
result[i]=data[i] - A.data[i];
}
return result;
};
spectrum operator /(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
spectrum result(owner,rsize,"result");
int i=-1;
while(++i<rsize)
{
result[i]=data[i] / A.data[i];
}
return result;
};
operator -=(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
int i=-1;
while(++i<rsize)
{
data[i]-= A.data[i];
}
};
operator +=(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
int i=-1;
while(++i<rsize)
{
data[i]+= A.data[i];
}
};
operator *=(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
int i=-1;
while(++i<rsize)
{
data[i]*= A.data[i];
}
};
operator /=(const spectrum &A)
{
int rsize = size;
if(A.size<size)
{
rsize = A.size;
}
int i=-1;
while(++i<rsize)
{
data[i]/= A.data[i];
}
};
operator =(const unsigned short *A)
{
int i=-1;
while(++i<size)
{
data[i]= (double)A[i]/65536;
}
};
};