obi arrays that don't work because of cython bug passing wrong pointers

This commit is contained in:
Celine Mercier
2015-11-03 14:22:00 +01:00
parent ecb9d97adb
commit 456551ffeb
25 changed files with 1669 additions and 128 deletions

View File

@ -42,10 +42,10 @@ from ._obidmscolumn_char cimport OBIDMS_column_char, \
OBIDMS_column_char_multi_elts, \
OBIDMS_column_char_multi_elts_writable
# from ._obidmscolumn_idx cimport OBIDMS_column_idx, \
# OBIDMS_column_idx_writable, \
# OBIDMS_column_idx_multi_elts, \
# OBIDMS_column_idx_multi_elts_writable
from ._obidmscolumn_str cimport OBIDMS_column_str, \
OBIDMS_column_str_writable, \
OBIDMS_column_str_multi_elts, \
OBIDMS_column_str_multi_elts_writable
cdef class OBIDMS :
@ -119,7 +119,8 @@ cdef class OBIDMS :
OBIType_t data_type= <OBIType_t> 0,
size_t nb_lines=0,
size_t nb_elements_per_line=0,
list elements_names=None):
list elements_names=None,
str array_name="default_obiarray"):
# Declarations
cdef OBIDMS_column column
@ -202,17 +203,17 @@ cdef class OBIDMS :
subclass = OBIDMS_column_char
else :
subclass = OBIDMS_column_char_multi_elts
# elif data_type == 5 :
# if (create or clone) :
# if nb_elements_per_line == 1 :
# subclass = OBIDMS_column_idx_writable
# else :
# subclass = OBIDMS_column_idx_multi_elts_writable
# else :
# if nb_elements_per_line == 1 :
# subclass = OBIDMS_column_idx
# else :
# subclass = OBIDMS_column_idx_multi_elts
elif data_type == 5 :
if (create or clone) :
if nb_elements_per_line == 1 :
subclass = OBIDMS_column_str_writable
else :
subclass = OBIDMS_column_str_multi_elts_writable
else :
if nb_elements_per_line == 1 :
subclass = OBIDMS_column_str
else :
subclass = OBIDMS_column_str_multi_elts
else :
raise Exception("Problem with the data type")
@ -220,7 +221,7 @@ cdef class OBIDMS :
create, clone, clone_data,
version_number, data_type,
nb_lines, nb_elements_per_line,
elements_names)
elements_names, array_name)
return column
@ -238,11 +239,13 @@ cdef class OBIDMS_column :
OBIType_t type,
size_t nb_lines,
size_t nb_elements_per_line,
list elements_names):
list elements_names,
str array_name):
# Declarations
cdef bytes column_name_b
cdef bytes dms_name_b
cdef bytes array_name_b
cdef bytes elements_names_b
# Fill structure
@ -255,6 +258,7 @@ cdef class OBIDMS_column :
# Format the character strings to send them to C functions
column_name_b = str2bytes(column_name)
dms_name_b = str2bytes(self.dms.dms_name)
array_name_b = str2bytes(array_name)
# Create, clone or open column
if create :
@ -262,7 +266,9 @@ cdef class OBIDMS_column :
elements_names_b = column_name_b
else :
elements_names_b = str2bytes(";".join(elements_names))
self.pointer = obi_create_column(self.dms.pointer, column_name_b, type, nb_lines, nb_elements_per_line, elements_names_b)
self.pointer = obi_create_column(self.dms.pointer, column_name_b, type,
nb_lines, nb_elements_per_line,
elements_names_b, array_name_b)
else :
if clone :
self.pointer = obi_clone_column(self.dms.pointer, column_name_b, version_number, clone_data)