@@ -233,7 +233,7 @@ bool MDA_IO<T_real>::load_quantification_scalers(std::string path, data_struct::
233233// -----------------------------------------------------------------------------
234234
235235template <typename T_real>
236- bool MDA_IO<T_real>::load_spectra_volume(std::string path,
236+ Load_Status MDA_IO<T_real>::load_spectra_volume(std::string path,
237237 size_t detector_num,
238238 data_struct::Spectra_Volume<T_real>* vol,
239239 bool hasNetCDF,
@@ -252,22 +252,22 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
252252
253253 if (fptr == nullptr )
254254 {
255- return false ;
255+ return Load_Status::Failed ;
256256 }
257257
258258
259259 _mda_file = mda_load (fptr);
260260 std::fclose (fptr);
261261 if (_mda_file == nullptr || vol == nullptr )
262262 {
263- return false ;
263+ return Load_Status::Failed ;
264264 }
265265 logI<<" mda info ver:" <<_mda_file->header ->version <<" data rank:" <<_mda_file->header ->data_rank <<" \n " ;
266266
267267 if (_mda_file->header ->data_rank == 1 )
268268 {
269269 logE << " Cannot load mda file data rank == 1" << " \n " ;
270- return false ;
270+ return Load_Status::Failed ;
271271 }
272272
273273 _load_scalers (false ,hasNetCDF, subtract_two_cols);
@@ -311,7 +311,7 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
311311 }
312312
313313 vol->resize_and_zero (rows, cols, 2048 );
314- return true ;
314+ return Load_Status::Half_need_spectra ;
315315 }
316316 else
317317 {
@@ -322,7 +322,7 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
322322 {
323323 logE<<" Max detectors saved = " <<_mda_file->scan ->sub_scans [0 ]->number_detectors << " \n " ;
324324 unload ();
325- return false ;
325+ return Load_Status::Failed ;
326326 }
327327
328328 rows = 1 ;
@@ -347,7 +347,7 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
347347 // if not then we don't know what is dataset is.
348348 logE << " Don't understand this dataset layout. Can not load it.\n " ;
349349 unload ();
350- return false ;
350+ return Load_Status::Failed ;
351351 }
352352 }
353353 }
@@ -392,15 +392,15 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
392392 cols = 1 ;
393393 }
394394 vol->resize_and_zero (rows, cols, 2048 );
395- return true ;
395+ return Load_Status::Half_need_spectra ;
396396 }
397397 // TODO: might need to check if is XANES like above
398398 }
399399 if (_mda_file->scan ->sub_scans [0 ]->sub_scans [0 ]->number_detectors -1 < (int )detector_num)
400400 {
401401 logE<<" Max detectors saved = " <<_mda_file->scan ->sub_scans [0 ]->sub_scans [0 ]->number_detectors << " \n " ;
402402 unload ();
403- return false ;
403+ return Load_Status::Failed ;
404404 }
405405
406406 if (_mda_file->scan ->requested_points == 0 || _mda_file->scan ->last_point == 0 )
@@ -442,7 +442,7 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
442442 {
443443 logE<<" No support for data rank " << _mda_file->header ->data_rank <<" \n " ;
444444 unload ();
445- return false ;
445+ return Load_Status::Failed ;
446446 }
447447
448448 elt_arr = _scan_info.scaler_values (STR_ELT + std::to_string (detector_num + 1 ));
@@ -524,10 +524,10 @@ bool MDA_IO<T_real>::load_spectra_volume(std::string path,
524524 {
525525 logE<<" Caught exception loading mda file." <<" \n " ;
526526 std::cerr << " Exception catched : " << e.what () << " \n " ;
527- return false ;
527+ return Load_Status::Failed ;
528528 }
529529
530- return true ;
530+ return Load_Status::Loaded ;
531531}
532532
533533
0 commit comments