HEX
Server: nginx/1.29.3
System: Linux 11979.bigscoots-wpo.com 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User: nginx (1068)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_open,proc_close,popen,show_source,cmd# Do not modify this line # 1684243876
Upload Files
File: //usr/include/Imath/PyImathDecorators.h
//
// 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 <boost/python.hpp>

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 <class T>
static T
copy(const T& x)
{
    return T(x);
}

template <class T>
static T
deepcopy(const T& x, boost::python::dict&)
{
    return copy(x);
}

template <class T, class X1, class X2, class X3>
boost::python::class_<T,X1,X2,X3>&
decoratecopy(boost::python::class_<T,X1,X2,X3>& cls)
{
    cls.def("__copy__",&copy<T>);
    cls.def("__deepcopy__",&deepcopy<T>);
    return cls;
}

} // namespace PyImath

#endif // INCLUDED_PYIMATH_DECORATORS_H