From d93352d2b049d272de41ba6731f627d3b0992fa8 Mon Sep 17 00:00:00 2001
From: Martin Beseda <martin.beseda@vsb.cz>
Date: Sun, 6 Jan 2019 09:34:36 +0100
Subject: [PATCH] ENH: Added method for saving DataSet values to the text file.

---
 src/DataSet/DataSet.cpp | 16 ++++++++++++++++
 src/DataSet/DataSet.h   |  6 ++++++
 2 files changed, 22 insertions(+)

diff --git a/src/DataSet/DataSet.cpp b/src/DataSet/DataSet.cpp
index 98579370..08b4ffc2 100644
--- a/src/DataSet/DataSet.cpp
+++ b/src/DataSet/DataSet.cpp
@@ -195,6 +195,22 @@ namespace lib4neuro {
         }
     }
 
+    void DataSet::store_data_text(std::ofstream* file_path) {
+        for (auto e : this->data) {
+            /* First part of the pair */
+            for (unsigned int i = 0; i < e.first.size() - 1; i++) {
+                *file_path << e.first.at(i) << ",";
+            }
+            *file_path << e.first.back() << " ";
+
+            /* Second part of the pair */
+            for (unsigned int i = 0; i < e.second.size() - 1; i++) {
+                *file_path << e.second.at(i) << ",";
+            }
+            *file_path << e.second.back() << std::endl;
+        }
+    }
+
     void DataSet::store_data_text(std::string file_path) {
         std::ofstream ofs(file_path);
 
diff --git a/src/DataSet/DataSet.h b/src/DataSet/DataSet.h
index e1ff9bb1..52ed4e74 100644
--- a/src/DataSet/DataSet.h
+++ b/src/DataSet/DataSet.h
@@ -215,6 +215,12 @@ namespace lib4neuro {
          */
         LIB4NEURO_API void store_text(std::string file_path);
 
+        /**
+         *
+         * @param file_path
+         */
+        LIB4NEURO_API void store_data_text(std::ofstream* file_path);
+
         /**
          * Stores the data to the text file in a human readable format
          *
-- 
GitLab