| 757 | } |
| 758 | |
| 759 | virtual int32_t getNbErrors() const noexcept override |
| 760 | { |
| 761 | try |
| 762 | { |
| 763 | PYBIND11_OVERLOAD_PURE_NAME(int32_t, IErrorRecorder, "get_num_errors", getNbErrors); |
| 764 | } |
| 765 | catch (std::exception const& e) |
| 766 | { |
| 767 | std::cerr << "[ERROR] Exception caught in get_num_errors(): " << e.what() << std::endl; |
| 768 | } |
| 769 | catch (...) |
| 770 | { |
| 771 | std::cerr << "[ERROR] Exception caught in get_num_errors()" << std::endl; |
| 772 | } |
| 773 | return -1; |
| 774 | } |
| 775 | |
| 776 | virtual bool hasOverflowed() const noexcept override |
| 777 | { |
| 778 | try |
| 779 | { |
| 780 | PYBIND11_OVERLOAD_PURE_NAME(bool, IErrorRecorder, "has_overflowed", hasOverflowed); |
| 781 | } |
| 782 | catch (std::exception const& e) |
| 783 | { |
| 784 | std::cerr << "[ERROR] Exception caught in has_overflowed(): " << e.what() << std::endl; |
| 785 | } |
| 786 | catch (...) |
| 787 | { |
| 788 | std::cerr << "[ERROR] Exception caught in has_overflowed()" << std::endl; |
| 789 | } |
| 790 | return false; |
| 791 | } |
| 792 | |
| 793 | virtual RefCount incRefCount() noexcept override |
| 794 | { |
| 795 | return ++mRefCount; |
| 796 | } |
| 797 | |
| 798 | virtual RefCount decRefCount() noexcept override |
| 799 | { |
| 800 | return --mRefCount; |
| 801 | } |
| 802 | |
| 803 | private: |
| 804 | int32_t mRefCount{0}; |
| 805 | }; |
| 806 | |
| 807 | py::class_<IErrorRecorder, PyErrorRecorder>(m, "IErrorRecorder", IErrorRecorderDoc::descr, py::module_local()) |
| 808 | .def(py::init<>()) |
| 809 | .def_property_readonly("MAX_DESC_LENGTH", []() { return IErrorRecorder::kMAX_DESC_LENGTH; }) |
| 810 | .def("num_errors", &IErrorRecorder::getNbErrors, IErrorRecorderDoc::get_num_errors) |
| 811 | .def("get_error_code", &IErrorRecorder::getErrorCode, IErrorRecorderDoc::get_error_code) |
| 812 | .def("get_error_desc", &IErrorRecorder::getErrorDesc, IErrorRecorderDoc::get_error_desc) |
| 813 | .def("has_overflowed", &IErrorRecorder::hasOverflowed, IErrorRecorderDoc::has_overflowed) |
| 814 | .def("clear", &IErrorRecorder::clear, IErrorRecorderDoc::clear) |
| 815 | .def("report_error", &IErrorRecorder::reportError, IErrorRecorderDoc::report_error); |
| 816 |
nothing calls this directly
no test coverage detected