1 //==============================================================================
2 // Copyright Intel Corporation
3 //
4 // SPDX-License-Identifier: MIT
5 //==============================================================================
6 #include "vpl/preview/impl_selector.hpp"
7 #include "vpl/preview/option_tree.hpp"
8 #include "vpl_python.hpp"
9 namespace vpl = oneapi::vpl;
10 
init_impl_selector(const py::module & m)11 void init_impl_selector(const py::module &m) {
12     // Note: we are handling a pointer to the base class. All instances of default_selector
13     // simply have alternate constructors.
14     py::class_<vpl::implementation_selector, std::shared_ptr<vpl::implementation_selector>>(
15         m,
16         "default_selector")
17         .def(py::init<>([]() {
18             return new vpl::default_selector<vpl::property_list>();
19         }))
20         .def(py::init<>([](vpl::property_list &props) {
21             return new vpl::default_selector<vpl::property_list>(props);
22         }))
23         .def(py::init<>([](vpl::properties &props) {
24             return new vpl::default_selector<vpl::properties>(props);
25         }))
26         .def(py::init<>([](std::vector<vpl::property *> props) {
27             std::vector<vpl::property> list;
28             for (auto prop : props) {
29                 list.push_back(*prop);
30             }
31             return new vpl::default_selector<vpl::property_list>(list);
32         }));
33 
34     py::class_<vpl::cpu_selector, vpl::implementation_selector, std::shared_ptr<vpl::cpu_selector>>(
35         m,
36         "cpu_selector")
37         .def(py::init<>());
38 
39     py::class_<vpl::gpu_selector, vpl::implementation_selector, std::shared_ptr<vpl::gpu_selector>>(
40         m,
41         "gpu_selector")
42         .def(py::init<>());
43 }