7 auto py_gate_library_manager = m.def_submodule(
"GateLibraryManager", R
"(
8 The gate library manager keeps track of all gate libraries that are used within HAL. Further, it takes care of loading and saving gate libraries on demnand.
11 py_gate_library_manager.def(
15 py::arg(
"reload") =
false,
17 Load a gate library from file.
19 :param pathlib.Path file_path: The input path.
20 :param bool reload: If true, reloads the library in case it is already loaded.
21 :returns: The gate library on success, None otherwise.
22 :rtype: hal_py.GateLibrary or None
26 Load all gate libraries available in standard gate library directories.
28 :param bool reload: If true, reloads all libraries that have already been loaded.
31 py_gate_library_manager.def("save", &
gate_library_manager::save, py::arg(
"file_path"), py::arg(
"gate_lib"), py::arg(
"overwrite") =
false, R
"(
32 Save a gate library to file.
34 :param pathlib.Path file_path: The output path.
35 :param hal_py.GateLibrary gate_lib: The gate library.
36 :param bool overwrite: If true, overwrites already existing files.
37 :returns: True on success, false otherwise.
41 py_gate_library_manager.def(
43 Get a gate library by file path. If no library with the given name is loaded, loading the gate library from file will be attempted.
45 :param str file_path: The input path.
46 :returns: The gate library on success, None otherwise.
47 :rtype: hal_py.GateLibrary or None
50 py_gate_library_manager.def(
51 "get_gate_library_by_name",
55 Get a gate library by name. If no library with the given name is loaded, None will be returned.
57 :param str lib_name: The name of the gate library.
58 :returns: The gate library on success, None otherwise.
59 :rtype: hal_py.GateLibrary or None
62 py_gate_library_manager.def(
65 std::vector<RawPtrWrapper<GateLibrary>> result;
68 result.emplace_back(lib);
73 Get all loaded gate libraries.
75 :returns: A list of gate libraries.
76 :rtype: list[hal_py.GateLibrary]
std::unique_ptr< T, py::nodelete > RawPtrWrapper
void gate_library_manager_init(py::module &m)
const Module * module(const Gate *g, const NodeBoxes &boxes)
GateLibrary * get_gate_library_by_name(const std::string &lib_name)
std::vector< GateLibrary * > get_gate_libraries()
void load_all(bool reload)
GateLibrary * get_gate_library(const std::string &file_path)
GateLibrary * load(std::filesystem::path file_path, bool reload)
bool save(std::filesystem::path file_path, GateLibrary *gate_lib, bool overwrite)