HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
python_bindings.cpp
Go to the documentation of this file.
1 #include "pybind11/operators.h"
2 #include "pybind11/pybind11.h"
3 #include "pybind11/stl.h"
4 #include "pybind11/stl_bind.h"
6 
8 
9 namespace py = pybind11;
10 
11 namespace hal
12 {
13 
14  // the name in PYBIND11_MODULE/PYBIND11_PLUGIN *MUST* match the filename of the output library (without extension),
15  // otherwise you will get "ImportError: dynamic module does not define module export function" when importing the module
16 
17  #ifdef PYBIND11_MODULE
18  PYBIND11_MODULE(genlib_writer, m)
19  {
20  m.doc() = "hal GenlibWriterPlugin python bindings";
21  #else
22  PYBIND11_PLUGIN(genlib_writer)
23  {
24  py::module m("genlib_writer", "hal GenlibWriterPlugin python bindings");
25  #endif // ifdef PYBIND11_MODULE
26 
27  py::class_<GenlibWriterPlugin, RawPtrWrapper<GenlibWriterPlugin>, BasePluginInterface>(m, "GenlibWriterPlugin")
28  .def_property_readonly("name", &GenlibWriterPlugin::get_name)
29  .def("get_name", &GenlibWriterPlugin::get_name)
30  .def_property_readonly("version", &GenlibWriterPlugin::get_version)
31  .def("get_version", &GenlibWriterPlugin::get_version)
32  ;
33 
34  #ifndef PYBIND11_MODULE
35  return m.ptr();
36  #endif // PYBIND11_MODULE
37  }
38 }
std::string get_version() const override
std::string get_name() const override
const Module * module(const Gate *g, const NodeBoxes &boxes)
Definition: defines.h:45
PYBIND11_PLUGIN(hal_py)