[go: up one dir, main page]

File: print.cpp

package info (click to toggle)
iminuit 2.11.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,780 kB
  • sloc: cpp: 24,851; python: 6,975; makefile: 18
file content (26 lines) | stat: -rw-r--r-- 811 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <Minuit2/MnPrint.h>
#include <pybind11/pybind11.h>

namespace py = pybind11;
using namespace ROOT::Minuit2;
using cstr = const char*;
using namespace pybind11::literals;

void bind_print(py::module m) {
  py::class_<MnPrint>(m, "MnPrint")

      .def(py::init<cstr, int>(), "prefix"_a, "level"_a)
      .def("error", &MnPrint::Error<cstr>)
      .def("warn", &MnPrint::Warn<cstr>)
      .def("info", &MnPrint::Info<cstr>)
      .def("debug", &MnPrint::Debug<cstr>)
      .def_property_static(
          "global_level", [](py::object) { return MnPrint::GlobalLevel(); },
          [](py::object, int x) { MnPrint::SetGlobalLevel(x); })

      .def("show_prefix_stack", &MnPrint::ShowPrefixStack)
      .def("add_filter", &MnPrint::AddFilter)
      .def("clear_filter", &MnPrint::ClearFilter)

      ;
}