// file: $isip/class/pr/VerifyHMM/vhmm_03.cc
// version: $Id: vhmm_03.cc 9454 2004-04-13 19:30:22Z gao $
//

// isip include files
//
#include "VerifyHMM.h"
#include <Sof.h>

// method: read
//
// arguments:
//  Sof& sof: (input) sof file object
//  long tag: (input) sof object instance tag
//  const String& name: (input) sof object instance name
//
// return: a boolean indicating status
//
// this method has the object read itself from an Sof file
//
boolean VerifyHMM::read(Sof& sof_a, long tag_a, const String& name_a) {

  // get the instance of the object from the Sof file
  //
  if (!sof_a.find(name_a, tag_a)) {
    return false;
  }

  // read the actual data from the sof file
  //
  return readData(sof_a);
}

// method: readData
//
// arguments:
//  Sof& sof: (input) sof file object
//  const String& pname: (input) parameter name
//  long size: (input) number of bytes in file
//  boolean param: (input) is the parameter specified?
//  boolean nested: (input) is this nested?
//
// return: logical error status
//
// this method has the object read itself from an Sof file. it assumes
// that the Sof file is already positioned correctly.
//
boolean VerifyHMM::readData(Sof& sof_a, const String& pname_a,
			    long size_a,
			    boolean param_a, boolean nested_a) {

  // allocate a parser
  //
  SofParser parser;
  parser.setDebug(debug_level_d);

  // ignore implicit parameter setting
  //
  
  // are we nested?
  //
  if (nested_a) {
    parser.setNest();
  }
    
  // load the parser
  //
  if (!parser.load(sof_a, size_a)) {

      // return a warning message
      //
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
  }
  
  // read the algorithm
  //
  if (parser.isPresent(sof_a, PARAM_ALGORITHM)) {
    if (!ALGO_MAP.readElementData((long&)algorithm_d, sof_a, PARAM_ALGORITHM,
				  parser.getEntry(sof_a, PARAM_ALGORITHM))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    algorithm_d = DEF_ALGORITHM;
  }

  // read the implementation
  //
  if (parser.isPresent(sof_a, PARAM_IMPLEMENTATION)) {
    if (!IMPL_MAP.readElementData((long&)implementation_d, sof_a,
				  PARAM_IMPLEMENTATION,
			      parser.getEntry(sof_a, PARAM_IMPLEMENTATION))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    implementation_d = DEF_IMPLEMENTATION;
  }
  
  // read the number of mixtures
  //
  if (parser.isPresent(sof_a, PARAM_NUM_MIXTURES)) {
    if (!num_mixtures_d.readData(sof_a, PARAM_NUM_MIXTURES,
				 parser.getEntry(sof_a,
						 PARAM_NUM_MIXTURES))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    num_mixtures_d.assign(DEF_NUM_MIXTURES);
  }
  
  // read the levels to update
  //
  if (parser.isPresent(sof_a, PARAM_UPDATE_LEVELS)) {
    if (!update_levels_str_d.readData(sof_a, PARAM_UPDATE_LEVELS,
				      parser.getEntry(sof_a,
						      PARAM_UPDATE_LEVELS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }
  }
  
  // read the levels to decoding output
  //
  if (parser.isPresent(sof_a, PARAM_OUTPUT_LEVELS)) {
    if (!output_levels_str_d.readData(sof_a, PARAM_OUTPUT_LEVELS,
				      parser.getEntry(sof_a,
						      PARAM_OUTPUT_LEVELS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }
  }
  
  // read the number of iterations across the data
  //
  if (parser.isPresent(sof_a, PARAM_NUM_ITERATIONS)) {
    if (!num_iterations_d.readData(sof_a, PARAM_NUM_ITERATIONS,
				   parser.getEntry(sof_a,
						   PARAM_NUM_ITERATIONS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    num_iterations_d.assign(DEF_NUM_ITERATIONS);
  }  

  // read the minimum model probability deviance
  //
  if (parser.isPresent(sof_a, PARAM_MIN_MPD)) {
    if (!min_mpd_d.readData(sof_a, PARAM_MIN_MPD,
			    parser.getEntry(sof_a,
					    PARAM_MIN_MPD))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    min_mpd_d.assign(DEF_MIN_MPD);
  }

  // read the floor on the occupancy probability
  //
  if (parser.isPresent(sof_a, PARAM_MIN_OCCUPANCY)) {
    if (!min_occupancy_d.readData(sof_a, PARAM_MIN_OCCUPANCY,
				  parser.getEntry(sof_a,
						  PARAM_MIN_OCCUPANCY))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    min_occupancy_d.assign(DEF_MIN_OCCUPANCY);
  }

  // read the minimum number of times a model must occur before update
  //
  if (parser.isPresent(sof_a, PARAM_MIN_MODEL_COUNT)) {
    if (!min_model_count_d.readData(sof_a, PARAM_MIN_MODEL_COUNT,
				    parser.getEntry(sof_a,
						    PARAM_MIN_MODEL_COUNT))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    min_model_count_d.assign(DEF_MIN_MODEL_COUNT);
  }      

  // read the context level
  //
  if (parser.isPresent(sof_a, PARAM_CONTEXT_LEVEL)) {
    if (!context_level_d.readData(sof_a, PARAM_CONTEXT_LEVEL,
				  parser.getEntry(sof_a,
						  PARAM_CONTEXT_LEVEL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the context order
  //
  if (parser.isPresent(sof_a, PARAM_CONTEXT_ORDER)) {
    if (!context_order_d.readData(sof_a, PARAM_CONTEXT_ORDER,
				  parser.getEntry(sof_a,
						  PARAM_CONTEXT_ORDER))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }    

  // read the transcription level
  //
  if (parser.isPresent(sof_a, PARAM_TRANSCRIPTION_LEVEL)) {
    if (!transcription_level_d.readData(sof_a, PARAM_TRANSCRIPTION_LEVEL,
					parser.getEntry(sof_a,
							PARAM_TRANSCRIPTION_LEVEL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    transcription_level_d.assign(DEF_TRANSCRIPTION_LEVEL);
  }

  // read the force alignment level
  //
  if (parser.isPresent(sof_a, PARAM_FORCE_ALIGNMENT_LEVEL)) {
    if (!force_alignment_level_d.readData(sof_a, PARAM_FORCE_ALIGNMENT_LEVEL,
					  parser.getEntry(sof_a,
							  PARAM_FORCE_ALIGNMENT_LEVEL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    force_alignment_level_d.assign(DEF_FORCE_ALIGNMENT_LEVEL);
  }
  
  // read the model file
  //
  if (parser.isPresent(sof_a, PARAM_LANGUAGE_MODEL)) {
    if (!lm_file_d.readData(sof_a, PARAM_LANGUAGE_MODEL,
			    parser.getEntry(sof_a,
					    PARAM_LANGUAGE_MODEL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the stat file
  //
  if (parser.isPresent(sof_a, PARAM_STATISTICAL_MODEL_POOL)) {
    if (!smp_file_d.readData(sof_a, PARAM_STATISTICAL_MODEL_POOL,
 			      parser.getEntry(sof_a,
 					      PARAM_STATISTICAL_MODEL_POOL))) {
       
      // return a warning message
      //
      return Error::handle(name(), L"readData", Error::READ,
  			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the imposter model file
  //
  if (parser.isPresent(sof_a, PARAM_IMPOSTER_LANGUAGE_MODEL)) {
    if (!imp_lm_file_d.readData(sof_a, PARAM_IMPOSTER_LANGUAGE_MODEL,
				parser.getEntry(sof_a,
						PARAM_IMPOSTER_LANGUAGE_MODEL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the imposter stat file
  //
  if (parser.isPresent(sof_a, PARAM_IMPOSTER_STATISTICAL_MODEL_POOL)) {
    if (!imp_smp_file_d.readData(sof_a, PARAM_IMPOSTER_STATISTICAL_MODEL_POOL,
				 parser.getEntry(sof_a,
						 PARAM_IMPOSTER_STATISTICAL_MODEL_POOL))) {
       
      // return a warning message
      //
      return Error::handle(name(), L"readData", Error::READ,
  			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the config file
  //
  if (parser.isPresent(sof_a, PARAM_CONFIGURATION)) {
    if (!cnfg_file_d.readData(sof_a, PARAM_CONFIGURATION,
 			      parser.getEntry(sof_a,
 					      PARAM_CONFIGURATION))) {
       
      // return a warning message
      //
      return Error::handle(name(), L"readData", Error::READ,
  			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the front-end file
  //
  if (parser.isPresent(sof_a, PARAM_FRONT_END)) {
    if (!fend_file_d.readData(sof_a, PARAM_FRONT_END,
 			      parser.getEntry(sof_a,
 					      PARAM_FRONT_END))) {
       
      // return a warning message
      //
      return Error::handle(name(), L"readData", Error::READ,
  			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  
  // read the updated model file
  //
  if (parser.isPresent(sof_a, PARAM_UPDATE_LANGUAGE_MODEL)) {
    if (!update_lm_file_d.readData(sof_a, PARAM_UPDATE_LANGUAGE_MODEL,
				   parser.getEntry(sof_a,
						   PARAM_UPDATE_LANGUAGE_MODEL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the updated statistics file
  //
  if (parser.isPresent(sof_a, PARAM_UPDATE_STATISTICAL_MODEL_POOL)) {
    if (!update_smp_file_d.readData(sof_a,
				    PARAM_UPDATE_STATISTICAL_MODEL_POOL,
				    parser.getEntry(sof_a,
						    PARAM_UPDATE_STATISTICAL_MODEL_POOL))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }  

  // read the variance floor file
  //
  if (parser.isPresent(sof_a, PARAM_VAR_FLOOR_FILE)) {
    if (!variance_floor_file_d.readData(sof_a, PARAM_VAR_FLOOR_FILE,
					parser.getEntry(sof_a,
							PARAM_VAR_FLOOR_FILE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the variance floor
  //
  if (parser.isPresent(sof_a, PARAM_VAR_FLOOR)) {
    if (!variance_floor_d.readData(sof_a, PARAM_VAR_FLOOR,
				   parser.getEntry(sof_a,
						   PARAM_VAR_FLOOR))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    variance_floor_d.assign(DEF_VAR_FLOOR);
  }    

  // read the n-best paths
  //
  if (parser.isPresent(sof_a, PARAM_NBEST_PATHS)) {
    if (!nbest_paths_d.readData(sof_a, PARAM_NBEST_PATHS,
				parser.getEntry(sof_a,
						PARAM_NBEST_PATHS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    nbest_paths_d.assign(PARAM_NBEST_PATHS);
  }

  // read the max n-best paths
  //
  if (parser.isPresent(sof_a, PARAM_MAX_NBEST_PATHS)) {
    if (!max_nbest_paths_d.readData(sof_a, PARAM_MAX_NBEST_PATHS,
				    parser.getEntry(sof_a,
						    PARAM_MAX_NBEST_PATHS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    max_nbest_paths_d.assign(PARAM_MAX_NBEST_PATHS);
  }

  // read the n-best beam
  //
  if (parser.isPresent(sof_a, PARAM_NBEST_BEAM)) {
    if (!nbest_beam_d.readData(sof_a, PARAM_NBEST_BEAM,
			       parser.getEntry(sof_a,
					       PARAM_NBEST_BEAM))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    nbest_beam_d.assign(PARAM_NBEST_BEAM);
  }      
  
  // read the beta threshold
  //
  if (parser.isPresent(sof_a, PARAM_BETA_THRESHOLD)) {
    if (!beta_threshold_d.readData(sof_a, PARAM_BETA_THRESHOLD,
				   parser.getEntry(sof_a,
						   PARAM_BETA_THRESHOLD))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    beta_threshold_d.assign(DEF_BETA_PRUNING_THRESHOLD);
  }    
  
  // read the transcription file
  //
  if (parser.isPresent(sof_a, PARAM_TRANS_DB)) {
    if (!transcription_db_file_d.readData(sof_a, PARAM_TRANS_DB,
					  parser.getEntry(sof_a,
							  PARAM_TRANS_DB))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the audio database file
  //
  if (parser.isPresent(sof_a, PARAM_AUDIO_DB)) {
    if (!audio_db_file_d.readData(sof_a, PARAM_AUDIO_DB,
				  parser.getEntry(sof_a,
						  PARAM_AUDIO_DB))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the output mode
  //
  if (parser.isPresent(sof_a, PARAM_OUTPUT_MODE)) {
    if (!MODE_MAP.readElementData((long&)output_mode_d, sof_a,
					 PARAM_OUTPUT_MODE,
					 parser.getEntry(sof_a,
							 PARAM_OUTPUT_MODE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    output_mode_d = DEF_MODE;
  }

  // read the cross-word mode
  //
  if (parser.isPresent(sof_a, PARAM_FUNCTION_MODE)) {
    if (!FUNCTION_MODE_MAP.readElementData((long&)function_mode_d, sof_a,
					   PARAM_FUNCTION_MODE,
					   parser.getEntry(sof_a,
							   PARAM_FUNCTION_MODE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    function_mode_d = DEF_FUNCTION_MODE;
  }

  // read the context mode
  //
  if (parser.isPresent(sof_a, PARAM_CONTEXT_MODE)) {
    if (!CONTEXT_MODE_MAP.readElementData((long&)context_mode_d, sof_a,
					  PARAM_CONTEXT_MODE,
					  parser.getEntry(sof_a,
							  PARAM_CONTEXT_MODE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    context_mode_d = DEF_CONTEXT_MODE;
  }
  
  // read the output format
  //
  if (parser.isPresent(sof_a, PARAM_OUTPUT_FORMAT)) {
    if (!FORMAT_MAP.readElementData((long&)output_format_d, sof_a,
					   PARAM_OUTPUT_FORMAT,
					   parser.getEntry(sof_a,
							   PARAM_OUTPUT_FORMAT))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    output_format_d = DEF_FORMAT;
  }
  
  // read the output type
  //
  if (parser.isPresent(sof_a, PARAM_OUTPUT_TYPE)) {
    if (!TYPE_MAP.readElementData((long&)output_type_d, sof_a,
					 PARAM_OUTPUT_TYPE,
					 parser.getEntry(sof_a,
							 PARAM_OUTPUT_TYPE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    output_type_d = DEF_TYPE;
  }
  
  // read the update mode
  //
  if (parser.isPresent(sof_a, PARAM_UPDATE_MODE)) {
    if (!UPDATE_MODE_MAP.readElementData((long&)update_mode_d, sof_a,
					 PARAM_UPDATE_MODE,
					 parser.getEntry(sof_a,
							 PARAM_UPDATE_MODE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  else {
    update_mode_d = DEF_UPDATE_MODE;
  }  

  // read the output file name
  //
  if (parser.isPresent(sof_a, PARAM_OUTPUT_FILE)) {
    if (!output_file_d.readData(sof_a, PARAM_OUTPUT_FILE,
				parser.getEntry(sof_a,
						PARAM_OUTPUT_FILE))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  
  // read the accumulator file name
  //
  if (parser.isPresent(sof_a, PARAM_ACCUMULATOR)) {
    if (!accum_file_d.readData(sof_a, PARAM_ACCUMULATOR,
			       parser.getEntry(sof_a,
					       PARAM_ACCUMULATOR))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the accumulator list name
  //
  if (parser.isPresent(sof_a, PARAM_ACCUMULATOR_LIST)) {
    if (!accum_list_d.readData(sof_a, PARAM_ACCUMULATOR_LIST,
			       parser.getEntry(sof_a,
					       PARAM_ACCUMULATOR_LIST))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }  

  // read the output list
  //
  if (parser.isPresent(sof_a, PARAM_OUTPUT_LIST)) {
    if (!output_list_d.readData(sof_a, PARAM_OUTPUT_LIST,
				parser.getEntry(sof_a,
						PARAM_OUTPUT_LIST))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the context list
  //
  if (parser.isPresent(sof_a, PARAM_CONTEXT_LIST)) {
    if (!context_list_d.readData(sof_a, PARAM_CONTEXT_LIST,
				 parser.getEntry(sof_a,
						 PARAM_CONTEXT_LIST))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }

  // read the phonetic questions and answers filename
  //
  if (parser.isPresent(sof_a, PARAM_QUES_ANS)) {
    if (!ques_ans_file_d.readData(sof_a, PARAM_QUES_ANS,
				  parser.getEntry(sof_a,
						     PARAM_QUES_ANS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  
  // read the phonetic decisiontree filename
  //
  if (parser.isPresent(sof_a, PARAM_PHONETIC_DT)) {
    if (!phonetic_dt_file_d.readData(sof_a, PARAM_PHONETIC_DT,
				     parser.getEntry(sof_a,
						     PARAM_PHONETIC_DT))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }       
  }
  
  // read the split threshold for parametertying process
  //
  if (parser.isPresent(sof_a, PARAM_PHONETIC_DT_SPLIT_THRESHOLD)) {
    if (!phonetic_dt_split_threshold_d.readData(sof_a, PARAM_PHONETIC_DT_SPLIT_THRESHOLD,
						parser.getEntry(sof_a,
								PARAM_PHONETIC_DT_SPLIT_THRESHOLD))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }
  }
  else{
    phonetic_dt_split_threshold_d.assign(PhoneticDecisionTree::DEF_SPLIT_THRESHOLD);
  }
  
  // read the merge threshold for parametertying process
  //
  if (parser.isPresent(sof_a, PARAM_PHONETIC_DT_MERGE_THRESHOLD)) {
    if (!phonetic_dt_merge_threshold_d.readData(sof_a, PARAM_PHONETIC_DT_MERGE_THRESHOLD,
				     parser.getEntry(sof_a,
						     PARAM_PHONETIC_DT_MERGE_THRESHOLD))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }
  }
  else{
    phonetic_dt_merge_threshold_d.assign(PhoneticDecisionTree::DEF_MERGE_THRESHOLD);
  }
  
  // read the num_occ threshold for parametertying process
  //
  if (parser.isPresent(sof_a, PARAM_PHONETIC_DT_NUM_OCC_THRESHOLD)) {
    if (!phonetic_dt_num_occ_threshold_d.readData(sof_a, PARAM_PHONETIC_DT_NUM_OCC_THRESHOLD,
						  parser.getEntry(sof_a,
								  PARAM_PHONETIC_DT_NUM_OCC_THRESHOLD))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }
  }
  else{
    phonetic_dt_num_occ_threshold_d.assign(PhoneticDecisionTree::DEF_NUM_OCC_THRESHOLD);
  }

  // read the decision thresholds for decision process
  //
  if (parser.isPresent(sof_a, PARAM_DECISION_THRESHOLDS)) {
    String thresh;
    if (!thresh.readData(sof_a, PARAM_DECISION_THRESHOLDS,
			 parser.getEntry(sof_a,
					 PARAM_DECISION_THRESHOLDS))) {
      return Error::handle(name(), L"readData", Error::READ,
			   __FILE__, __LINE__, Error::WARNING);
    }
    decision_thresholds_d.assign(thresh);
  }
  
  // check that all parameters are accounted for
  //
  if (!parser.checkParams(sof_a)) {
    return Error::handle(name(), L"readData", Error::IO, __FILE__, __LINE__,
			 Error::WARNING);
  }

  // exit gracefully
  //
  return true;
}



