/usr/include/openturns/swig/NumericalPointWithDescription.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 71 72 73 74 | // SWIG file NumericalPointWithDescription.i
%{
#include "NumericalPointWithDescription.hxx"
namespace OT {
template <>
struct traitsPythonType<OT::NumericalPointWithDescription>
{
typedef _PySequence_ Type;
};
template <>
inline
OT::NumericalPointWithDescription
convert<_PySequence_,OT::NumericalPointWithDescription>(PyObject * pyObj)
{
check<_PySequence_>( pyObj );
ScopedPyObjectPointer newPyObj(PySequence_Fast( pyObj, "" ));
const OT::UnsignedInteger size = PySequence_Fast_GET_SIZE( newPyObj.get() );
OT::NumericalPointWithDescription coll( size );
OT::Description desc = OT::Description( size );
for(OT::UnsignedInteger i=0; i<size; ++i) {
PyObject * elt = PySequence_Fast_GET_ITEM( newPyObj.get(), i );
check<_PySequence_>( elt );
if (PySequence_Fast_GET_SIZE( elt ) == 2) {
PyObject * item_0 = PySequence_Fast_GET_ITEM( elt, 0 );
check<_PyString_>( item_0 );
desc[i] = convert<_PyString_,OT::String>( item_0 );
PyObject * item_1 = PySequence_Fast_GET_ITEM( elt, 1 );
check<_PyFloat_>( item_1 );
coll[i] = convert<_PyFloat_,OT::NumericalScalar>( item_1 );
} else {
throw OT::InvalidArgumentException(HERE) << "Sequence item " << i << " passed as argument is not a pair (String, NumericalScalar)";
}
}
coll.setDescription( desc );
return coll;
}
} /* namespace OT */
%}
%include NumericalPointWithDescription_doc.i
%rename(NumericalPointWithDescription_operator___eq__) OT::operator ==(const NumericalPointWithDescription & lhs, const NumericalPointWithDescription & rhs);
%include NumericalPointWithDescription.hxx
namespace OT{
%extend NumericalPointWithDescription {
NumericalPointWithDescription(const NumericalPointWithDescription & other)
{
return new OT::NumericalPointWithDescription(other);
}
NumericalPointWithDescription(PyObject * pyObj)
{
return new OT::NumericalPointWithDescription( OT::convert<OT::_PySequence_,OT::NumericalPointWithDescription>(pyObj) );
}
}
}
%template(NumericalPointWithDescriptionCollection) OT::Collection<OT::NumericalPointWithDescription>;
%template(NumericalPointWithDescriptionPersistentCollection) OT::PersistentCollection<OT::NumericalPointWithDescription>;
|