Refactored and relocated the set and get functions of all column types,

both within and out of the context of a view
This commit is contained in:
Celine Mercier
2016-04-13 15:10:24 +02:00
parent 5ec2d8842e
commit 9d042f7bd0
28 changed files with 1079 additions and 1320 deletions

View File

@ -1,7 +1,7 @@
#cython: language_level=3
from .capi.obidmscolumn cimport obi_truncate_and_close_column, \
obi_column_get_obistr_with_elt_name_in_view, \
from .capi.obidmscolumn cimport obi_truncate_and_close_column
from .capi.obiview cimport obi_column_get_obistr_with_elt_name_in_view, \
obi_column_get_obistr_with_elt_idx_in_view, \
obi_column_set_obistr_with_elt_name_in_view, \
obi_column_set_obistr_with_elt_idx_in_view
@ -16,8 +16,8 @@ from libc.string cimport strcmp
cdef class OBIDMS_column_str(OBIDMS_column):
cpdef object get_line(self, index_t line_nb):
cdef char* value
cdef object result
cdef const_char_p value
cdef object result
value = obi_column_get_obistr_with_elt_idx_in_view(self.view, (self.pointer)[0], line_nb, 0)
if obi_errno > 0 :
raise IndexError(line_nb)
@ -41,8 +41,8 @@ cdef class OBIDMS_column_str(OBIDMS_column):
cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
cpdef object get_item(self, index_t line_nb, str element_name):
cdef char* value
cdef object result
cdef const_char_p value
cdef object result
value = obi_column_get_obistr_with_elt_name_in_view(self.view, (self.pointer)[0], line_nb, str2bytes(element_name))
if obi_errno > 0 :
raise IndexError(line_nb, element_name)
@ -54,11 +54,11 @@ cdef class OBIDMS_column_multi_elts_str(OBIDMS_column_multi_elts):
return result
cpdef object get_line(self, index_t line_nb) :
cdef char* value
cdef object value_in_result
cdef dict result
cdef index_t i
cdef bint all_NA
cdef const_char_p value
cdef object value_in_result
cdef dict result
cdef index_t i
cdef bint all_NA
result = {}
all_NA = True
for i in range(self.nb_elements_per_line) :