From c0f205c677cbd6fc45d45cac900d13a2ac1d5076 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de>
Date: Thu, 24 Dec 2015 17:50:11 +0100
Subject: [PATCH] Replace IterateD,C by IterateO(selD,C)

---
 pub/lib/fsel.cpp | 17 +++++++++++++++++
 pub/lib/fsel.hpp |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/pub/lib/fsel.cpp b/pub/lib/fsel.cpp
index a3fe83ab..db2ccfc5 100644
--- a/pub/lib/fsel.cpp
+++ b/pub/lib/fsel.cpp
@@ -9,6 +9,7 @@
 
 #include "defs.hpp"
 #include <cmath>
+#include <algorithm>
 
 #include "olf.hpp"
 #include "ptr.hpp"
@@ -29,6 +30,22 @@ namespace NSel {
         return FSel;
     }
 
+    //! Returns list of data files in current selection
+    const vector<int> selD()
+    {
+        vector<int> ret;
+        copy_if( FSel.begin(), FSel.end(), ret.begin(), [](int k){ return P2D(NOlm::mem_get(k)); } );
+        return ret;
+    }
+
+    //! Returns list of curve files in current selection
+    const vector<int> selC()
+    {
+        vector<int> ret;
+        copy_if( FSel.begin(), FSel.end(), ret.begin(), [](int k){ return P2C(NOlm::mem_get(k)); } );
+        return ret;
+    }
+
     //! First selected file.
     const ROlo sel_first()
     {
diff --git a/pub/lib/fsel.hpp b/pub/lib/fsel.hpp
index 541c5a08..3ef3c058 100644
--- a/pub/lib/fsel.hpp
+++ b/pub/lib/fsel.hpp
@@ -13,6 +13,8 @@ namespace NSel {
 
     // Read file selection:
     const vector<int>& sel();
+    const vector<int> selD();
+    const vector<int> selC();
     const ROlo sel_first();
     const int nJ_max();
 
-- 
GitLab