3
from libc.stdlib cimport malloc, free
5
from ecbufr cimport caf
8
cdef caf.BufrAF* _this_ptr
13
self._this=self._this_ptr
15
def __dealloc__(self):
16
if self._this_ptr is not NULL:
17
caf.bufr_free_af(self._this_ptr)
19
def allocate(self,blens):
23
my_ints = <int *>malloc(dlen*4)
26
for i in xrange(dlen):
29
self._this_ptr=caf.bufr_create_af( my_ints, dlen )
30
if self._this_ptr is NULL:
32
self._this=self._this_ptr
35
def get_value(self,int pos):
36
return caf.bufr_af_get_value(self._this,pos)
38
def get_sig(self, int pos):
39
return caf.bufr_af_get_sig(self._this,pos)
41
def set_value(self,int pos,int val):
42
return caf.bufr_af_set_value(self._this,pos,val)
44
def set_sig(self,int pos,int sig):
45
return caf.bufr_af_set_sig(self._this,pos,sig)
48
cdef char string[2048]
51
caf.bufr_print_af(string,self._this)