/usr/include/openturns/swig/UserDefinedPair.i is in libopenturns-dev 0.15-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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | // SWIG file UserDefinedPair.i
// Author : $LastChangedBy: lebrun $
// Date : $LastChangedDate: 2010-11-21 22:52:28 +0100 (dim. 21 nov. 2010) $
// Id : $Id: UserDefinedPair.i 1658 2010-11-21 21:52:28Z lebrun $
%{
#include "UserDefinedPair.hxx"
namespace OpenTURNS {
template <>
struct traitsPythonType<OpenTURNS::Uncertainty::Distribution::UserDefinedPair>
{
typedef _PyObject_ Type;
};
template <>
inline
OpenTURNS::Uncertainty::Distribution::UserDefinedPair *
buildObjectFromPySequence<OpenTURNS::Uncertainty::Distribution::UserDefinedPair>(PyObject * pyObj)
{
check<_PySequence_>( pyObj );
const UnsignedLong size = PySequence_Fast_GET_SIZE( pyObj );
if (size != 2) {
throw OpenTURNS::Base::Common::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 OpenTURNS::Uncertainty::Distribution::UserDefinedPair( convert<_PyFloat_,OpenTURNS::NumericalScalar>( elt1 ),
convert<_PyFloat_,OpenTURNS::NumericalScalar>( elt2 ) );
}
template <>
inline
OpenTURNS::Uncertainty::Distribution::UserDefinedPair
convert<_PySequence_,OpenTURNS::Uncertainty::Distribution::UserDefinedPair>(PyObject * pyObj)
{
OpenTURNS::Pointer<OpenTURNS::Uncertainty::Distribution::UserDefinedPair> ptr = buildObjectFromPySequence<OpenTURNS::Uncertainty::Distribution::UserDefinedPair>( pyObj );
return *ptr;
}
template <>
inline
OpenTURNS::Uncertainty::Distribution::UserDefinedPair
convert<_PyObject_,OpenTURNS::Uncertainty::Distribution::UserDefinedPair>(PyObject * pyObj)
{
void * ptr = 0;
if (SWIG_IsOK(SWIG_ConvertPtr( pyObj, &ptr, SWIG_TypeQuery("OpenTURNS::Uncertainty::Distribution::UserDefinedPair *"), 0 | 0 ))) {
OpenTURNS::Uncertainty::Distribution::UserDefinedPair * p_hp = reinterpret_cast< OpenTURNS::Uncertainty::Distribution::UserDefinedPair * >( ptr );
return *p_hp;
} else if (isAPython<_PySequence_>( pyObj )) {
return convert<_PySequence_,OpenTURNS::Uncertainty::Distribution::UserDefinedPair>( pyObj );
} else {
throw OpenTURNS::Base::Common::InvalidArgumentException(HERE) << "Object passed as argument is neither an UserDefinedPair nor an object convertible to an UserDefinedPair";
}
return OpenTURNS::Uncertainty::Distribution::UserDefinedPair();
}
} /* namespace OpenTURNS */
%}
%include UserDefinedPair.hxx
namespace OpenTURNS { namespace Uncertainty { namespace Distribution { %extend UserDefinedPair { UserDefinedPair(const UserDefinedPair & other) { return new OpenTURNS::Uncertainty::Distribution::UserDefinedPair(other); } } }}}
|