summaryrefslogtreecommitdiff
path: root/Simulator/include/database/QueryResult.h
diff options
context:
space:
mode:
authorMDBijman <matthijs@bijman.org>2017-01-24 12:15:26 +0100
committerMDBijman <matthijs@bijman.org>2017-01-24 12:15:26 +0100
commit070ce923574dcc57435cb3fb2dfe86b6a38cd249 (patch)
treeffd69a842ac4ad22aaf7161f923b9f0b47c7147a /Simulator/include/database/QueryResult.h
Initial code commit with organized dependencies
Diffstat (limited to 'Simulator/include/database/QueryResult.h')
-rw-r--r--Simulator/include/database/QueryResult.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/Simulator/include/database/QueryResult.h b/Simulator/include/database/QueryResult.h
new file mode 100644
index 00000000..c1534be3
--- /dev/null
+++ b/Simulator/include/database/QueryResult.h
@@ -0,0 +1,25 @@
+#pragma once
+#include <tuple>
+
+namespace Database
+{
+ template<class ...ReturnTypes>
+ class QueryResult
+ {
+ public:
+ explicit QueryResult(ReturnTypes... returnValues) : values(returnValues...) {}
+ explicit QueryResult(std::tuple<ReturnTypes...> returnValues) : values(returnValues) {}
+
+ /*
+ Returns the item at the given index.
+ ReturnType must be the same as the type of the item at position Index in the tuple.
+ */
+ template<class ReturnType, int Index>
+ ReturnType get()
+ {
+ return std::get<Index>(values);
+ }
+
+ std::tuple<ReturnTypes...> values;
+ };
+}