/usr/include/openturns/swig/BaseFuncCollection.i is in python-openturns-dev 1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | // SWIG file BaseFuncCollection.i
%{
#include "PythonNumericalMathEvaluationImplementation.hxx"
namespace OT {
template <>
struct traitsPythonType< OT::NumericalMathFunction >
{
typedef _PyObject_ Type;
};
template <>
inline
bool
canConvert< _PyObject_, OT::NumericalMathFunction >(PyObject * pyObj)
{
void * ptr = 0;
if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIGTYPE_p_OT__NumericalMathFunction, 0 ))) {
OT::NumericalMathFunction * p_nmf = reinterpret_cast< OT::NumericalMathFunction * >( ptr );
return p_nmf != NULL;
} else if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIGTYPE_p_OT__NumericalMathFunctionImplementation, 0 ))) {
OT::NumericalMathFunctionImplementation * p_impl = reinterpret_cast< OT::NumericalMathFunctionImplementation * >( ptr );
return p_impl != NULL;
} else if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIG_TypeQuery("OT::Pointer<OT::NumericalMathFunctionImplementation> *"), 0))) {
OT::Pointer<OT::NumericalMathFunctionImplementation> * p_impl = reinterpret_cast< OT::Pointer<OT::NumericalMathFunctionImplementation> * >( ptr );
return p_impl != NULL && !p_impl->isNull();
} else {
return PyCallable_Check( pyObj );
}
}
template <>
inline
OT::NumericalMathFunction
convert< _PyObject_, OT::NumericalMathFunction >(PyObject * pyObj)
{
void * ptr = 0;
if ( SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIGTYPE_p_OT__NumericalMathFunction, 0 ) ) ) {
OT::NumericalMathFunction * p_nmf = reinterpret_cast< OT::NumericalMathFunction * >( ptr );
return *p_nmf;
} else if ( SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIGTYPE_p_OT__NumericalMathFunctionImplementation, 0 ) ) ) {
OT::NumericalMathFunctionImplementation * p_impl = reinterpret_cast< OT::NumericalMathFunctionImplementation * >( ptr );
return *p_impl;
} else if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIG_TypeQuery("OT::Pointer<OT::NumericalMathFunctionImplementation> *"), 0))) {
OT::Pointer<OT::NumericalMathFunctionImplementation> * p_impl = reinterpret_cast< OT::Pointer<OT::NumericalMathFunctionImplementation> * >( ptr );
return **p_impl;
} else if (!PyCallable_Check( pyObj )) {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object (function or class) - can not be convertible to a NumericalMathFunction";
}
return OT::NumericalMathFunction(new OT::NumericalMathFunctionImplementation(new OT::PythonNumericalMathEvaluationImplementation(pyObj) ) );
}
} /* namespace OT */
%}
|