From 90525013a3fadc0ad40d9215e3aa93d476b904e3 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 22 Mar 2016 00:21:54 -0400 Subject: [PATCH] Database: Implemented ::getAllIntervals --- src/Database.cpp | 16 ++++++++++++++++ src/Database.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/Database.cpp b/src/Database.cpp index 6b316244..180bb846 100644 --- a/src/Database.cpp +++ b/src/Database.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -78,6 +79,21 @@ Interval Database::getLatestInterval () return _files[0].getLatestInterval (); } +//////////////////////////////////////////////////////////////////////////////// +std::vector Database::getAllIntervals () +{ + std::vector all; + for (auto& file : _files) + { + auto i = file.getAllIntervals (); + all.insert (all.end (), + std::make_move_iterator (i.begin ()), + std::make_move_iterator (i.end ())); + } + + return all; +} + //////////////////////////////////////////////////////////////////////////////// void Database::addExclusion (const std::string& exclusion) { diff --git a/src/Database.h b/src/Database.h index 83297816..711e35aa 100644 --- a/src/Database.h +++ b/src/Database.h @@ -40,6 +40,7 @@ public: void commit (); Interval getLatestInterval (); + std::vector getAllIntervals (); void addExclusion (const std::string&); void addInterval (const Interval&);