// // SPDX-License-Identifier: BSD-3-Clause // Copyright Contributors to the OpenEXR Project. // // clang-format off #ifndef INCLUDED_PYIMATH_DECORATORS_H #define INCLUDED_PYIMATH_DECORATORS_H #include namespace PyImath { // These function add __copy__ and __deepcopy__ methods // to python classes by simply wrapping the copy constructors // This interface is needed for using these classes with // the python copy module. template static T copy(const T& x) { return T(x); } template static T deepcopy(const T& x, boost::python::dict&) { return copy(x); } template boost::python::class_& decoratecopy(boost::python::class_& cls) { cls.def("__copy__",©); cls.def("__deepcopy__",&deepcopy); return cls; } } // namespace PyImath #endif // INCLUDED_PYIMATH_DECORATORS_H