Line data Source code
1 : // SPDX-FileCopyrightText: 2024 PairInteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #include "./Database.py.hpp" 5 : 6 : #include "pairinteraction/database/Database.hpp" 7 : #include "pairinteraction/database/GitHubDownloader.hpp" 8 : 9 : #include <nanobind/nanobind.h> 10 : #include <nanobind/stl/filesystem.h> 11 : #include <nanobind/stl/string.h> 12 : 13 : namespace nb = nanobind; 14 : using namespace nb::literals; 15 : using namespace pairinteraction; 16 : 17 2 : static void declare_database(nb::module_ &m) { 18 2 : m.def("set_ca_bundle_path", &set_ca_bundle_path, "path"_a); 19 : 20 2 : nb::class_<Database>(m, "Database") 21 4 : .def(nb::init<>()) 22 2 : .def(nb::init<bool>(), "download_missing"_a) 23 2 : .def(nb::init<std::filesystem::path>(), "database_dir"_a) 24 2 : .def(nb::init<bool, bool, std::filesystem::path>(), "download_missing"_a, "use_cache"_a, 25 2 : "database_dir"_a) 26 2 : .def("get_download_missing", &Database::get_download_missing) 27 2 : .def("get_use_cache", &Database::get_use_cache) 28 2 : .def("get_database_dir", &Database::get_database_dir) 29 4 : .def("get_versions_info", &Database::get_versions_info); 30 2 : } 31 : 32 2 : void bind_database(nb::module_ &m) { declare_database(m); }