flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
database.hpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
19#include <string>
20#include <vector>
21#include <Eigen/Core>
22
23struct sqlite3;
24
25namespace flexiblesusy {
26namespace database {
27
28class Database {
29public:
30 Database(const std::string& file_name);
31 Database(const Database&) = delete;
32 Database(Database&&) = delete;
33 ~Database();
34
36 void insert(const std::string&, const std::vector<std::string>&, const Eigen::ArrayXd&);
37
39 Eigen::ArrayXd extract(const std::string&, long long);
40
41private:
42 using TCallback = int (*)(void*, int, char**, char**);
43
44 sqlite3* db{nullptr};
45
46 void execute(const std::string&);
47 void execute(const std::string&, TCallback, void*);
48 template <typename T>
49 void create_table(const std::string&, const std::vector<std::string>&);
50};
51
52} // namespace database
53} // namespace flexiblesusy
void execute(const std::string &)
Definition: database.cpp:285
void create_table(const std::string &, const std::vector< std::string > &)
Definition: database.cpp:281
Database(const Database &)=delete
Database(const std::string &file_name)
Definition: database.cpp:261
int(*)(void *, int, char **, char **) TCallback
Definition: database.hpp:42
Eigen::ArrayXd extract(const std::string &, long long)
extract a row of doubles from a table
Definition: database.cpp:275
void insert(const std::string &, const std::vector< std::string > &, const Eigen::ArrayXd &)
insert a row of doubles into a table
Definition: database.cpp:269
Database(Database &&)=delete
sqlite3 * db
pointer to database object
Definition: database.hpp:44