1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 %typemap(python,in) string * , const string * , const string * const {
27 /* typemap in for string * , const string * , const string * const */
28 /* Check if is a list */
29 if (PyList_Check($input)) {
30 int size = PyList_Size($input);
32 $1 = new string[size];
33 for (i = 0; i < size; i++) {
34 PyObject *o = PyList_GetItem($input,i);
35 if (PyString_Check(o))
36 $1[i] = string(PyString_AsString(PyList_GetItem($input,i)));
38 PyErr_SetString(PyExc_TypeError,"list must contain strings");
46 PyErr_SetString(PyExc_TypeError,"not a list");
51 %typemap(python,in) double * , const double * , const double * const
53 /* typemap in for double * , const double * , const double * const */
54 /* Check if is a list */
55 if (PyList_Check($input)) {
56 int size = PyList_Size($input);
58 $1 = (double *) malloc(size*sizeof(double));
59 for (i = 0; i < size; i++) {
60 PyObject *o = PyList_GetItem($input,i);
62 $1[i] = PyFloat_AsDouble(PyList_GetItem($input,i));
64 PyErr_SetString(PyExc_TypeError,"list must contain floats");
72 PyErr_SetString(PyExc_TypeError,"not a list");
77 %typemap(python,in) int * , const int * , const int * const
79 /* typemap in for int * , const int * , const int * const */
80 /* Check if is a list */
81 if (PyList_Check($input)) {
82 int size = PyList_Size($input);
84 $1 = (int *) malloc(size*sizeof(int));
85 for (i = 0; i < size; i++) {
86 PyObject *o = PyList_GetItem($input,i);
88 $1[i] = PyInt_AsLong(PyList_GetItem($input,i));
90 PyErr_SetString(PyExc_TypeError,"list must contain integers");
98 PyErr_SetString(PyExc_TypeError,"not a list");
104 %typemap(python,in) medGeometryElement * , const medGeometryElement * , const medGeometryElement * const
106 /* typemap in for medGeometryElement * , const medGeometryElement * , const medGeometryElement * const */
107 /* Check if is a list */
108 if (PyList_Check($input)) {
109 int size = PyList_Size($input);
111 $1 = (medGeometryElement *) malloc(size*sizeof(int));
112 for (i = 0; i < size; i++) {
113 PyObject *o = PyList_GetItem($input,i);
115 $1[i] = (medGeometryElement) PyInt_AsLong(PyList_GetItem($input,i));
117 PyErr_SetString(PyExc_TypeError,"list must contain integers");
125 PyErr_SetString(PyExc_TypeError,"not a list");
130 %typemap(python,out) list<string> {
132 list<string>::iterator iL;
134 $result = PyList_New($1->size());
135 for (i=0, iL=$1->begin(); iL!=$1->end(); i++, iL++)
136 PyList_SetItem($result,i,PyString_FromString((*iL).c_str()));
139 %typemap(freearg) int * , const int * , const int * const {
140 /* free the memory allocated in the typemap in for int * , const int * , const int * const */
144 %typemap(freearg) double * , const double * , const double * const {
145 /* free the memory allocated in the typemap in for double * , const double * , const double * const */
149 %typemap(freearg) medGeometryElement * , const medGeometryElement * , const medGeometryElement * const {
150 /* free the memory allocated in the typemap in for medGeometryElement * , const medGeometryElement * , const medGeometryElement * const */