/usr/include/openturns/swig/HistogramPair.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 HistogramPair.i
%{
#include "HistogramPair.hxx"
namespace OT {
template <>
struct traitsPythonType<OT::HistogramPair>
{
typedef _PyObject_ Type;
};
template <>
inline
OT::HistogramPair *
buildObjectFromPySequence<OT::HistogramPair>(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<_PyFloat_>( elt1 );
PyObject * elt2 = PySequence_Fast_GET_ITEM( pyObj, 1 );
check<_PyFloat_>( elt2 );
return new OT::HistogramPair( convert<_PyFloat_,OT::NumericalScalar>( elt1 ),
convert<_PyFloat_,OT::NumericalScalar>( elt2 ) );
}
template <>
inline
OT::HistogramPair
convert<_PySequence_,OT::HistogramPair>(PyObject * pyObj)
{
OT::Pointer<OT::HistogramPair> ptr = buildObjectFromPySequence<OT::HistogramPair>( pyObj );
return *ptr;
}
template <>
inline
OT::HistogramPair
convert<_PyObject_,OT::HistogramPair>(PyObject * pyObj)
{
void * ptr = 0;
if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIG_TypeQuery("OT::HistogramPair *"), 0 | 0 ))) {
OT::HistogramPair * p_hp = reinterpret_cast< OT::HistogramPair * >( ptr );
return *p_hp;
} else if (isAPython<_PySequence_>( pyObj )) {
return convert<_PySequence_,OT::HistogramPair>( pyObj );
} else {
throw OT::InvalidArgumentException(HERE) << "Object passed as argument is neither an HistogramPair nor an object convertible to an HistogramPair";
}
return OT::HistogramPair();
}
} /* namespace OT */
%}
%include HistogramPair_doc.i
%include HistogramPair.hxx
namespace OT { %extend HistogramPair { HistogramPair(const HistogramPair & other) { return new OT::HistogramPair(other); } } }
|