Remove warnings (work package 1)
[anna.git] / source / statistics / Engine.cpp
index e804599..622e58c 100644 (file)
@@ -99,12 +99,9 @@ bool Engine::enableSampleLog(const int & id, const char *sampleFileName) throw()
   // For all concepts:
   _concept_identification_map_nc_iter it_min(a_concept_identification_map.begin());
   _concept_identification_map_nc_iter it_max(a_concept_identification_map.end());
-
   for(it = it_min; it != it_max; it++) {
     realName = "";
-
     if(providedName != "") realName = anna::functions::asString("%s.%d.csv", providedName.c_str(), (*it).first);
-
     SampleFile_ptr = &((*it).second.SampleFile);
     *SampleFile_ptr = realName;
   }
@@ -117,14 +114,20 @@ bool Engine::enableSampleLog(const int & id, const char *sampleFileName) throw()
 //--------------------------------------------------- Engine::disableSampleLog()
 //------------------------------------------------------------------------------
 bool Engine::disableSampleLog(const int & id) throw() {
-  _concept_identification_map_nc_iter it = a_concept_identification_map.find(id);
 
-  if(it == a_concept_identification_map.end()) return false;
+  if(id != -1) {
+    _concept_identification_map_nc_iter it = a_concept_identification_map.find(id);
 
-  // Access to map
-  std::string *SampleFile_ptr = &((*it).second.SampleFile);
-  *SampleFile_ptr = "";
-  return true;
+    if(it == a_concept_identification_map.end()) return false;
+
+    // Access to map
+    std::string *SampleFile_ptr = &((*it).second.SampleFile);
+    *SampleFile_ptr = "";
+    return true;
+  }
+
+  // For all concepts:
+  return enableSampleLog(id /* -1 */, "");
 }
 
 
@@ -206,7 +209,7 @@ std::string Engine::asString(void) const throw() {
     trace += "\n";
     trace += "\n   Concept id:            "; trace += anna::functions::asString((*iter).first);
 
-    if((*iter).second.SampleFile != "") trace += "\n   Sample file:           "; trace += (*iter).second.SampleFile;
+    if((*iter).second.SampleFile != "") { trace += "\n   Sample file:           "; trace += (*iter).second.SampleFile; }
 
     trace += "\n   Description:           "; trace += (*iter).second.Description;
     trace += "\n   Unit:                  "; trace += (*iter).second.Unit;