Revision 299, 1.0 KB
(checked in by trnewman, 15 years ago)
|
Added python swig interface
|
Line | |
---|
1 | %module cross |
---|
2 | %{ |
---|
3 | #include "libvtcross.h" |
---|
4 | #include "containers.h" |
---|
5 | %} |
---|
6 | |
---|
7 | %typemap(in) uint32_t = int; |
---|
8 | |
---|
9 | %include "std_string.i" |
---|
10 | |
---|
11 | %include "containers.h" |
---|
12 | %include "libvtcross.h" |
---|
13 | |
---|
14 | %apply const std::string & { std::string * }; |
---|
15 | |
---|
16 | %extend Parameter { |
---|
17 | |
---|
18 | Parameter(int nparameters) { |
---|
19 | Parameter * p = new Parameter[nparameters]; |
---|
20 | return p; |
---|
21 | }; |
---|
22 | |
---|
23 | ~Parameter() { |
---|
24 | delete [] $self; |
---|
25 | }; |
---|
26 | |
---|
27 | Parameter *__getitem__(int i) { |
---|
28 | return self+i; |
---|
29 | }; |
---|
30 | |
---|
31 | |
---|
32 | }; |
---|
33 | |
---|
34 | %extend Observable { |
---|
35 | Observable(int nobservables) { |
---|
36 | Observable * o = new Observable[nobservables]; |
---|
37 | return o; |
---|
38 | }; |
---|
39 | |
---|
40 | ~Observable() { |
---|
41 | delete [] $self; |
---|
42 | }; |
---|
43 | |
---|
44 | Observable *__getitem__(int i) { |
---|
45 | return self+i; |
---|
46 | }; |
---|
47 | }; |
---|
48 | |
---|
49 | %extend Utility { |
---|
50 | Utility(int nutilities) { |
---|
51 | Utility * u = new Utility[nutilities]; |
---|
52 | return u; |
---|
53 | }; |
---|
54 | |
---|
55 | ~Utility() { |
---|
56 | delete [] $self; |
---|
57 | }; |
---|
58 | |
---|
59 | Utility *__getitem__(int i) { |
---|
60 | return self+i; |
---|
61 | }; |
---|
62 | }; |
---|