Commit a3e7188d authored by d22's avatar d22
Browse files

Reset propertly the arrays properties used to read spectra data

parent 5fd4e9b3
......@@ -73,8 +73,11 @@ void RealQE65000Driver::start() {
//Delete current arrays
if (owner()->xData()) {
delete[] owner()->xData();
owner()->xData.set(nullptr);
} else if (owner()->yData()) {
delete[] owner()->yData();
owner()->yData.set(nullptr);
}
//Modification of 17/08/2016 -> really slow access to the following methods. Call them only in init method.
......@@ -207,9 +210,12 @@ void RealQE65000Driver::setIntegrationTime(int32 integrationTime) {
void RealQE65000Driver::getFormattedSpectrum() {
int32 error = 0;
float64* doubleBuffer = (float64 *) calloc(owner()->size(), sizeof(float64));
float64* doubleBuffer = new float64[owner()->size()];
sbapi_spectrometer_get_formatted_spectrum(deviceId, spectrometerId, &error, doubleBuffer, owner()->size());
// Delete previous data.
delete [] owner()->yData();
//Spectrum = Y data
owner()->yData.set(doubleBuffer);
owner()->yData.setSize((int64) owner()->size());
......@@ -222,9 +228,12 @@ void RealQE65000Driver::getWavelength() {
int32 error = 0;
int32 length = sbapi_spectrometer_get_formatted_spectrum_length(deviceId, spectrometerId, &error);
float64* valuesBuffer = (float64 *) calloc(owner()->size(), sizeof(float64));
float64* valuesBuffer = new float64[owner()->size()];
sbapi_spectrometer_get_wavelengths(deviceId, spectrometerId, &error, valuesBuffer, owner()->size());
// Delete previous data.
delete [] owner()->xData();
owner()->xData.set(valuesBuffer);
owner()->xData.setSize((int64) owner()->size());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment