--- /dev/null
+// Copyright (C) 2014-2015 EDF-R&D
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%ExportedHeaderCode
+#include <vector>
+%End
+
+// std::vector<TYPE> is implemented as a Python list.
+template<TYPE>
+%MappedType std::vector<TYPE>
+{
+%TypeHeaderCode
+#include <vector>
+%End
+
+%ConvertFromTypeCode
+ // Create the list.
+ PyObject *l;
+
+ if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
+ return NULL;
+
+ // Set the list elements.
+ for ( int i = 1, n = sipCpp->size(); i <= n; ++i )
+ {
+ TYPE* t = new TYPE( (*sipCpp)[i] );
+
+ PyObject* pobj;
+ if ( ( pobj = sipConvertFromNewType( t, sipType_TYPE, sipTransferObj ) ) == NULL )
+ {
+ Py_DECREF( l );
+ delete t;
+
+ return NULL;
+ }
+
+ PyList_SET_ITEM( l, i - 1, pobj );
+ }
+
+ return l;
+%End
+
+%ConvertToTypeCode
+ SIP_SSIZE_T len;
+
+ // Check the type if that is all that is required.
+ if (sipIsErr == NULL)
+ {
+ if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0)
+ return 0;
+
+ for (SIP_SSIZE_T i = 0; i < len; ++i)
+ {
+ PyObject *itm = PySequence_ITEM(sipPy, i);
+ bool ok = (itm && sipCanConvertToType(itm, sipType_TYPE, SIP_NOT_NONE));
+
+ Py_XDECREF(itm);
+
+ if (!ok)
+ return 0;
+ }
+
+ return 1;
+ }
+
+ std::vector<TYPE> *aSeq = new std::vector<TYPE>;
+ len = PySequence_Size(sipPy);
+ aSeq->reserve( len );
+
+ for (SIP_SSIZE_T i = 0; i < len; ++i)
+ {
+ PyObject *itm = PySequence_ITEM(sipPy, i);
+ int state;
+ TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(itm, sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
+
+ Py_DECREF(itm);
+
+ if (*sipIsErr)
+ {
+ sipReleaseType(t, sipType_TYPE, state);
+
+ delete aSeq;
+ return 0;
+ }
+
+ aSeq->push_back(*t);
+
+ sipReleaseType(t, sipType_TYPE, state);
+ }
+
+ *sipCppPtr = aSeq;
+
+ return sipGetState(sipTransferObj);
+%End
+};
+
+// std::vector<double> is implemented as a Python list of floats.
+%MappedType std::vector<double>
+{
+%TypeHeaderCode
+#include <vector>
+%End
+
+%ConvertFromTypeCode
+ // Create the list.
+ PyObject *l;
+
+ if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
+ return NULL;
+
+ // Set the list elements.
+ for ( int i = 1, n = sipCpp->size(); i <= n; ++i )
+ {
+ PyObject *pobj;
+ if ( ( pobj = PyFloat_FromDouble( (*sipCpp)[i] ) ) == NULL )
+ {
+ Py_DECREF(l);
+
+ return NULL;
+ }
+
+ PyList_SET_ITEM( l, i - 1, pobj );
+ }
+
+ return l;
+%End
+
+%ConvertToTypeCode
+ // Check the type if that is all that is required.
+ if ( sipIsErr == NULL )
+ return ( PySequence_Check( sipPy) && PySequence_Size( sipPy ) >= 0 );
+
+ std::vector<double> *aSeq = new std::vector<double>;
+
+ SIP_SSIZE_T len = PySequence_Size(sipPy);
+ aSeq->reserve( len );
+ for ( SIP_SSIZE_T i = 0; i < len; ++i )
+ {
+ PyObject *itm = PySequence_ITEM( sipPy, i );
+ if ( !itm )
+ {
+ delete aSeq;
+ *sipIsErr = 1;
+
+ return 0;
+ }
+
+ aSeq->push_back( PyFloat_AsDouble( itm ) );
+
+ Py_DECREF( itm );
+ }
+
+ *sipCppPtr = aSeq;
+
+ return sipGetState( sipTransferObj );
+%End
+};
+
+// std::vector<int> is implemented as a Python list of integers.
+%MappedType std::vector<int>
+{
+%TypeHeaderCode
+#include <vector>
+%End
+
+%ConvertFromTypeCode
+ // Create the list.
+ PyObject *l;
+
+ if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
+ return NULL;
+
+ // Set the list elements.
+ for ( int i = 1, n = sipCpp->size(); i <= n; ++i )
+ {
+ PyObject *pobj;
+ if ( ( pobj = SIPLong_FromLong( (*sipCpp)[i] ) ) == NULL )
+ {
+ Py_DECREF(l);
+
+ return NULL;
+ }
+
+ PyList_SET_ITEM( l, i - 1, pobj );
+ }
+
+ return l;
+%End
+
+%ConvertToTypeCode
+ // Check the type if that is all that is required.
+ if ( sipIsErr == NULL )
+ return ( PySequence_Check( sipPy) && PySequence_Size( sipPy ) >= 0 );
+
+ std::vector<int> *aSeq = new std::vector<int>;
+
+ SIP_SSIZE_T len = PySequence_Size(sipPy);
+ aSeq->reserve( len );
+ for ( SIP_SSIZE_T i = 0; i < len; ++i )
+ {
+ PyObject *itm = PySequence_ITEM( sipPy, i );
+ if ( !itm )
+ {
+ delete aSeq;
+ *sipIsErr = 1;
+
+ return 0;
+ }
+
+ aSeq->push_back( SIPLong_AsLong( itm ) );
+
+ Py_DECREF( itm );
+ }
+
+ *sipCppPtr = aSeq;
+
+ return sipGetState( sipTransferObj );
+%End
+};
+
+// std::vector<bool> is implemented as a Python list of integers.
+%MappedType std::vector<bool>
+{
+%TypeHeaderCode
+#include <vector>
+%End
+
+%ConvertFromTypeCode
+ // Create the list.
+ PyObject *l;
+
+ if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
+ return NULL;
+
+ // Set the list elements.
+ for ( int i = 1, n = sipCpp->size(); i <= n; ++i )
+ {
+ PyObject *pobj;
+ if ( ( pobj = SIPLong_FromLong( (*sipCpp)[i] ) ) == NULL )
+ {
+ Py_DECREF(l);
+
+ return NULL;
+ }
+
+ PyList_SET_ITEM( l, i - 1, pobj );
+ }
+
+ return l;
+%End
+
+%ConvertToTypeCode
+ // Check the type if that is all that is required.
+ if ( sipIsErr == NULL )
+ return ( PySequence_Check( sipPy) && PySequence_Size( sipPy ) >= 0 );
+
+ std::vector<bool> *aSeq = new std::vector<bool>;
+
+ SIP_SSIZE_T len = PySequence_Size(sipPy);
+ aSeq->reserve( len );
+ for ( SIP_SSIZE_T i = 0; i < len; ++i )
+ {
+ PyObject *itm = PySequence_ITEM( sipPy, i );
+ if ( !itm )
+ {
+ delete aSeq;
+ *sipIsErr = 1;
+
+ return 0;
+ }
+
+ aSeq->push_back( SIPLong_AsLong( itm ) != 0 );
+
+ Py_DECREF( itm );
+ }
+
+ *sipCppPtr = aSeq;
+
+ return sipGetState( sipTransferObj );
+%End
+};
\ No newline at end of file