diff --git a/pub/lib/fsel.cpp b/pub/lib/fsel.cpp index a3fe83ab766ba52372b658c7770f95bfa61bc3f9..db2ccfc5f360c643b958ab68916cbd0f230b1b0e 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 541c5a08ebee60a4a61508c6e00ec2531337bcbc..3ef3c058a6e1ed7f66e23ef0ff5767049d4ccd41 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();