// Copyright (c) 2024 The pybind Community. #pragma once #include #include "test_cpp_conduit_traveler_types.h" #include namespace pybind11_tests { namespace test_cpp_conduit { namespace py = pybind11; inline void wrap_traveler(py::module_ m) { py::class_(m, "Traveler") .def(py::init()) .def_readwrite("luggage", &Traveler::luggage) // See issue #3788: .def("__getattr__", [](const Traveler &self, const std::string &key) { return "Traveler GetAttr: " + key + " luggage: " + self.luggage; }); m.def("get_luggage", [](const Traveler &person) { return person.luggage; }); py::class_(m, "PremiumTraveler") .def(py::init()) .def_readwrite("points", &PremiumTraveler::points) // See issue #3788: .def("__getattr__", [](const PremiumTraveler &self, const std::string &key) { return "PremiumTraveler GetAttr: " + key + " points: " + std::to_string(self.points); }); m.def("get_points", [](const PremiumTraveler &person) { return person.points; }); } inline void wrap_lonely_traveler(py::module_ m) { py::class_(std::move(m), "LonelyTraveler"); } inline void wrap_very_lonely_traveler(py::module_ m) { py::class_(std::move(m), "VeryLonelyTraveler"); } } // namespace test_cpp_conduit } // namespace pybind11_tests