1 // SWIG file Indices.i 2 3 %{ 4 #include "openturns/Indices.hxx" 5 %} 6 7 %include BaseTypCollection.i 8 9 %typemap(in) const Indices & ($1_basetype temp) { 10 if (!SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, SWIG_POINTER_NO_NULL))) { 11 try { 12 temp = OT::convert<OT::_PySequence_,OT::Indices>($input); 13 $1 = &temp; catch(OT::InvalidArgumentException &)14 } catch (OT::InvalidArgumentException &) { 15 SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to an Indices"); 16 } 17 } 18 } 19 20 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Indices & { 21 $1 = SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, SWIG_POINTER_NO_NULL)) || 22 OT::isAPythonBufferOf<OT::UnsignedInteger, 1>($input) || OT::isAPythonSequenceOf<OT::_PyInt_>($input); 23 } 24 25 %apply const Indices & { const OT::Indices & }; 26 %ignore OT::Indices::Indices(std::initializer_list<UnsignedInteger> initList); 27 28 %include Indices_doc.i 29 30 %include openturns/Indices.hxx 31 namespace OT { 32 33 %extend Indices { 34 Indices(const Indices & other)35 Indices(const Indices & other) { return new OT::Indices(other); } 36 Indices(PyObject * pyObj)37 Indices(PyObject * pyObj) { return new OT::Indices( OT::convert<OT::_PySequence_,OT::Indices>(pyObj) ); } 38 39 OTCollectionOperatorsHelper(OT::Indices, OT::UnsignedInteger) 40 41 } // Indices 42 43 } // OT 44