add threshold/window flag getter/setters
[mussa.git] / alg / mussa.cpp
index 9a5935e19947cbd68e28e7c7a3f88b267816030f..0912cb428be56d6ea4f1e270cf4b0acb2b9517a9 100644 (file)
@@ -90,6 +90,26 @@ Mussa::clear()
   set_dirty(false);
 }
 
+void Mussa::set_append_window(bool v) 
+{
+  win_append = v;
+}
+
+bool Mussa::get_append_window()
+{
+  return win_append;
+}
+
+void Mussa::set_append_threshold(bool v)
+{
+  thres_append = v;
+}
+
+bool Mussa::get_append_threshold()
+{
+  return thres_append;
+}
+
 void Mussa::set_dirty(bool new_state)
 {
   if (dirty != new_state) {
@@ -381,6 +401,7 @@ Mussa::load_mupa_file(fs::path para_file_path)
 void
 Mussa::load_mupa_stream(std::istream& para_file, fs::path& file_path_base)
 {
+  bool error_occured = false;
   string file_data_line;
   string param, value; 
   fs::path annot_file;
@@ -454,11 +475,13 @@ Mussa::load_mupa_stream(std::istream& para_file, fs::path& file_path_base)
       did_seq = true;
     }
     //ignore empty lines or that start with '#'
-    else if ((param == "") || (param == "#")) {}
+    else if ( (param.size() == 0) || (param[0] == '#')) 
+    {} // pass
     else
     {
       clog << "Illegal/misplaced mussa parameter in file\n";
       clog << param << "\n";
+      error_occured = true;
     }
 
     if (!did_seq)
@@ -471,6 +494,9 @@ Mussa::load_mupa_stream(std::istream& para_file, fs::path& file_path_base)
     }
   }
 
+  if (error_occured) {
+    throw mussa_load_error("Error parsing MUPA file");
+  }
   soft_thres = threshold;
   // no file was loaded, signal error
   set_dirty(true);
@@ -662,7 +688,7 @@ Mussa::load(fs::path ana_file)
   // us know what our threshold and window sizes were when we load a muway
   window = the_paths.get_window();
   threshold = the_paths.get_threshold();
-  soft_thres = threshold;
+  soft_thres = the_paths.get_soft_threshold();
 
 
   //--------------------------------------------------------