+ changed interface array_function to array_class
[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 /*
22 %array_functions(int, intArray) ;
23 %array_functions(double, doubleArray) ;
24 */
25 %array_class(Pre_score, Pre_scoreArray) ;
26
27 %pythoncode
28 %{
29
30 def createDoubleArrayFromList(list):
31 #array = new_doubleArray(len(list))
32 array = doubleArray(len(list))
33 for i in range(len(list)):
34 # doubleArray_setitem(array, i, list[i])
35 array[i] = list[i]
36 return array
37
38 def createIntArrayFromList(list):
39 #array = new_intArray(len(list))
40 array = intArray(len(list))
41 for i in range(len(list)):
42 #intArray_setitem(array, i, list[i])
43 array[i] = list[i]
44 return array
45
46 def createListFromIntArray(array, array_len):
47 list = [0]*array_len
48 for i in range(array_len):
49 list[i] = intArray_getitem(array,i)
50 return list
51
52 def createListFromDoubleArray(array, array_len):
53 list = [0]*array_len
54 for i in range(array_len):
55 list[i] = doubleArray_getitem(array,i)
56 return list
57
58 %}