-
Notifications
You must be signed in to change notification settings - Fork 1
/
wfdb.i
118 lines (90 loc) · 2.77 KB
/
wfdb.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
File : wfdb.i I. Henry October 17 2001
Last revised: 20 August 2010 (by I. Henry)
SWIG interface file for WFDB
_______________________________________________________________________________
wfdb-bindings: SWIG (www.swig.org) wrappers for the WFDB library. Allows for
reading and writing annotated waveforms (time series data) from a variety of
computer languages.
Copyright (C) 2010 Isaac C. Henry
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Library General Public License for more
details.
You should have received a copy of the GNU Library General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
You may contact the author by e-mail (ihenry@physionet.org) or postal mail
(MIT Room E25-505A, Cambridge, MA 02139 USA). For updates to this software,
please visit PhysioNet (http://www.physionet.org/).
_______________________________________________________________________________
*/
%module wfdb
%header %{
#include <wfdb/wfdb.h>
%}
%module(directors="1") wfdb
%include carrays.i
%array_class(WFDB_Sample, WFDB_SampleArray);
%array_class(WFDB_Siginfo, WFDB_SiginfoArray);
%array_class(WFDB_Anninfo, WFDB_AnninfoArray);
%array_class(WFDB_Annotation, WFDB_AnnotationArray);
%include wfdb/ecgcodes.h
%include wfdb/wfdb.h
#ifdef SWIGJAVA
%include wfdb-java/jwfdb.i
#endif
#ifdef SWIGPYTHON
%include wfdb-python/pywfdb.i
#endif
%inline %{
static int _nvsig;
int spy_nvsig()
{
return _nvsig;
}
static int _nsamps;
int spy_nsamps()
{
return _nsamps;
}
FINT getvec2(WFDB_Sample *vector, int nsamples)
{
FINT r;
int i=0,j;
WFDB_Sample *tmpv;
if ( nsamples < 1 ) nsamples = _nsamps;
tmpv = (WFDB_Sample *)malloc(_nvsig * sizeof(WFDB_Sample));
r = getvec(tmpv);
while ( r > 0 && i<nsamples ) {
for (j=0; j<_nvsig; j++)
*(vector+i*_nvsig+j) = tmpv[j];
i++;
r = getvec(tmpv);
}
free(tmpv);
return r;
}
FINT getvec2p(double *vector, int nsamples)
{
FINT r;
int i=0,j;
WFDB_Sample *tmpv;
if ( nsamples < 1 )
nsamples = _nsamps;
tmpv = (WFDB_Sample *) malloc( _nvsig * sizeof(WFDB_Sample) );
r = getvec(tmpv);
while ( r > 0 && i<nsamples ) {
for (j=0; j<_nvsig; j++)
*(vector+i*_nvsig+j) = aduphys(j,tmpv[j]);
i++;
r = getvec(tmpv);
}
free(tmpv);
return r;
}
%}