+ parameter transfer to python layer works
[qpalma.git] / QPalmaDP / QPalmaDP.i
1 %module QPalmaDP
2 %{
3 #include "common.h"
4 #include "Mathmatics.h"
5 #include "penalty_info.h"
6 #include "qpalma_dp.h"
7 %}
8
9 %include "std_vector.i"
10 %include "std_string.i"
11
12 %include "carrays.i"
13
14 %include "common.h"
15 %include "Mathmatics.h"
16 %include "penalty_info.h"
17 %include "qpalma_dp.h"
18
19 %array_class(int, intArray) ;
20 %array_class(double, doubleArray) ;
21 %array_functions(double, doubleFArray) ;
22 %array_functions(struct penalty_struct, penaltyArray) ;
23
24 /*
25 %array_functions(int, intArray) ;
26 %array_functions(double, doubleArray) ;
27 */
28 %array_class(Pre_score, Pre_scoreArray) ;
29
30 %pythoncode
31 %{
32
33 def createPenaltyArrayFromList(list):
34 array = new_penaltyArray(len(list))
35 for i in range(len(list)):
36 penaltyArray_setitem(array, i, list[i])
37 return array
38
39 def createDoubleArrayFromList(list):
40 #array = new_doubleArray(len(list))
41 array = doubleArray(len(list))
42 for i in range(len(list)):
43 # doubleArray_setitem(array, i, list[i])
44 array[i] = list[i]
45 return array
46
47 def createIntArrayFromList(list):
48 #array = new_intArray(len(list))
49 array = intArray(len(list))
50 for i in range(len(list)):
51 #intArray_setitem(array, i, list[i])
52 array[i] = list[i]
53 return array
54
55 def createListFromIntArray(array, array_len):
56 list = [0]*array_len
57 for i in range(array_len):
58 list[i] = intArray_getitem(array,i)
59 return list
60
61 def createListFromDoubleArray(array, array_len):
62 list = [0]*array_len
63 for i in range(array_len):
64 list[i] = doubleArray_getitem(array,i)
65 return list
66
67 %}