1 // SWIG file BaseTypCollection.i
2 
3 %{
4 #include "openturns/PythonWrappingFunctions.hxx"
5 
6 namespace OT {
7   template <>
8   inline
9   bool
10   canConvert< _PySequence_, Indices >(PyObject * pyObj)
11   {
12     void * ptr = 0;
13     if (SWIG_IsOK(SWIG_ConvertPtr(pyObj, &ptr, SWIGTYPE_p_OT__Indices, SWIG_POINTER_NO_NULL))) {
14       Indices * p_it = reinterpret_cast< Indices * >(ptr);
15       return p_it != NULL;
16     } else {
17       return canConvertCollectionObjectFromPySequence< UnsignedInteger >(pyObj);
18     }
19     return false;
20   }
21 }
22 %}
23 
24 %typemap(in) const OT::Collection<OT::Indices> & (OT::Pointer<OT::Collection<OT::Indices> > temp) {
25   if (SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, SWIG_POINTER_NO_NULL))) {
26     // From interface class, ok
27   } else {
28     try {
29       temp = OT::buildCollectionFromPySequence<OT::Indices>($input);
30       $1 = temp.get();
catch(OT::InvalidArgumentException &)31     } catch (OT::InvalidArgumentException &) {
32       SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to a collection of Indices");
33     }
34   }
35 }
36 
37 %typemap(typecheck,precedence=SWIG_TYPECHECK_INT64_ARRAY) const OT::Collection<OT::Indices> & {
38   $1 = SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, SWIG_POINTER_NO_NULL))
39     || OT::canConvertCollectionObjectFromPySequence<OT::Indices>($input);
40 }
41 
42