checkpoint
[greylag.git] / cgreylag.i
blob27b8f48e5f3c878de4b4df8aadef684af9d5c845
1 // SWIG interface definition for module cgreylag
3 // $Id$
5 // Copyright (C) 2006-2007, Stowers Institute for Medical Research
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this program; if not, write to the Free Software Foundation, Inc.,
19 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 %module cgreylag
25 // Declare this read-only, to suppress a warning about a possible memory leak.
26 %immutable mass_trace_item::description;
29 %feature("autodoc");
32 #include "cgreylag.hpp"
36 // catch STL exceptions, etc
37 %include "exception.i"
38 %exception {
39 try {
40 $action
41 } catch (const std::exception& e) {
42 SWIG_exception(SWIG_RuntimeError, e.what());
43 } catch (...) {
44 PyErr_SetString(PyExc_RuntimeError,"unknown C++ (swig) exception");
45 return NULL;
49 // not sure these are useful--just avoiding SWIG warning
50 %rename(ion_increment) operator++(ion &);
51 %rename(ion_post_increment) operator++(ion &, int);
54 %include std_string.i
55 %apply const std::string & { std::string *name };
57 // %include std_list.i
58 %include std_vector.i
60 // Note: SWIG currently only exposes the outermost vector (in a vector of
61 // vector of X) as a modifiable object. Inner vectors appear as tuples, and
62 // are thus unmodifiable. They must therefore be assigned all at once. This
63 // shortcoming will probably be fixed in a future version of SWIG.
65 %template(vector_int) std::vector<int>;
66 %template(vector_double) std::vector<double>;
67 %template(vector_peak) std::vector<peak>;
68 %template(vector_spectrum) std::vector<spectrum>;
69 %template(vector_match) std::vector<match>;
70 %template(vector_mass_regime_parameters) std::vector<mass_regime_parameters>;
71 %template(vector_mass_trace_item) std::vector<mass_trace_item>;
72 %template(vector_vector_int) std::vector< std::vector<int> >;
73 %template(vector_vector_double) std::vector< std::vector<double> >;
74 %template(vector_vector_match) std::vector< std::vector<match> >;
75 %template(vector_vector_vector_double) std::vector< std::vector< std::vector<double> > >;
78 %include std_pair.i
79 %include std_map.i
80 %include std_multimap.i
82 %template(pair_double_vector_size_type)
83 std::pair<double, std::vector<spectrum>::size_type>;
85 // These two lines seem to be required to make the multimap template work.
86 // The multimap is only exposed for debugging purposes, anyway, though.
87 %template() std::pair<swig::PyObject_ptr, swig::PyObject_ptr>;
88 %template(pymap) std::map<swig::PyObject_ptr, swig::PyObject_ptr>;
90 %template(multimap_double_vector_size_type)
91 std::multimap<double, std::vector<spectrum>::size_type>;
93 // currently unused
94 //%template(pair_char_int) std::pair<char, int>;
95 //%template(pair_char_double) std::pair<char, double>;
97 //%template(map_char_int) std::map<char, int>;
98 //%template(map_char_double) std::map<char, double>;
101 %include "typemaps.i"
102 %apply int *OUTPUT { int *peak_count };
105 %include file.i
108 %include "cgreylag.hpp"