/usr/include/openturns/swig/UserDefinedPair.i is in libopenturns-dev 1.7-3.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 | // SWIG file UserDefinedPair.i
%{
#include "UserDefinedPair.hxx"
namespace OT {
template <>
struct traitsPythonType<OT::UserDefinedPair>
{
typedef _PyObject_ Type;
};
template <>
inline
OT::UserDefinedPair *
buildObjectFromPySequence<OT::UserDefinedPair>(PyObject * pyObj)
{
check<_PySequence_>( pyObj );
const UnsignedInteger size = PySequence_Fast_GET_SIZE( pyObj );
if (size != 2) {
throw OT::InvalidArgumentException(HERE) << "Sequence object has incorrect size " << size << ". Must be 2.";
}
PyObject * elt1 = PySequence_Fast_GET_ITEM( pyObj, 0 );
check<_PySequence_>( elt1 );
PyObject * elt2 = PySequence_Fast_GET_ITEM( pyObj, 1 );
check<_PyFloat_>( elt2 );
return new OT::UserDefinedPair( convert<_PySequence_,OT::NumericalPoint>( elt1 ),
convert<_PyFloat_,OT::NumericalScalar>( elt2 ) );
}
template <>
inline
OT::UserDefinedPair
convert<_PySequence_,OT::UserDefinedPair>(PyObject * pyObj)
{
OT::Pointer<OT::UserDefinedPair> ptr = buildObjectFromPySequence<OT::UserDefinedPair>( pyObj );
return *ptr;
}
template <>
inline
OT::UserDefinedPair
convert<_PyObject_,OT::UserDefinedPair>(PyObject * pyObj)
{
void * ptr = 0;
if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIG_TypeQuery("OT::UserDefinedPair *"), 0 | 0 ))) {
OT::UserDefinedPair * p_hp = reinterpret_cast< OT::UserDefinedPair * >( ptr );
return *p_hp;
} else if (isAPython<_PySequence_>( pyObj )) {
return convert<_PySequence_,OT::UserDefinedPair>( pyObj );
} else {
throw OT::InvalidArgumentException(HERE) << "Object passed as argument is neither an UserDefinedPair nor an object convertible to an UserDefinedPair";
}
return OT::UserDefinedPair();
}
} /* namespace OT */
%}
%include UserDefinedPair_doc.i
%include UserDefinedPair.hxx
namespace OT { %extend UserDefinedPair { UserDefinedPair(const UserDefinedPair & other) { return new OT::UserDefinedPair(other); } } }
|