Files and functions for OBIDMS columns with the data type OBI_BOOL
This commit is contained in:
@ -5,8 +5,11 @@ from libc.stdint cimport *
|
||||
cdef extern from "obitypes.h" nogil:
|
||||
enum OBIType:
|
||||
pass
|
||||
enum OBIBool:
|
||||
pass
|
||||
|
||||
ctypedef OBIType OBIType_t
|
||||
ctypedef OBIBool obibool_t
|
||||
ctypedef int32_t obiint_t
|
||||
ctypedef double obifloat_t
|
||||
ctypedef char obichar_t
|
||||
|
@ -3,6 +3,9 @@
|
||||
from .capidmscolumn cimport *
|
||||
from obitools3.obidms.obidmscolumn.obidmscolumn_int.capidmscolumn_int import OBIDMS_column_int
|
||||
from obitools3.obidms.obidmscolumn.obidmscolumn_float.capidmscolumn_float import OBIDMS_column_float
|
||||
from obitools3.obidms.obidmscolumn.obidmscolumn_bool.capidmscolumn_bool import OBIDMS_column_bool
|
||||
#from obitools3.obidms.obidmscolumn.obidmscolumn_char.capidmscolumn_char import OBIDMS_column_char
|
||||
from obitools3.obidms.obidmscolumn.obidmscolumn_idx.capidmscolumn_idx import OBIDMS_column_idx
|
||||
|
||||
|
||||
cdef class OBIDMS_column:
|
||||
@ -100,6 +103,24 @@ cdef class OBIDMS_column:
|
||||
create, version_number,
|
||||
type, nb_elements,
|
||||
nb_elements_per_line, elements_names)
|
||||
|
||||
elif type == 3 :
|
||||
column = OBIDMS_column_bool(dms_name, column_name,
|
||||
create, version_number,
|
||||
type, nb_elements,
|
||||
nb_elements_per_line, elements_names)
|
||||
|
||||
# elif type == 4 :
|
||||
# column = OBIDMS_column_char(dms_name, column_name,
|
||||
# create, version_number,
|
||||
# type, nb_elements,
|
||||
# nb_elements_per_line, elements_names)
|
||||
|
||||
elif type == 5 :
|
||||
column = OBIDMS_column_idx(dms_name, column_name,
|
||||
create, version_number,
|
||||
type, nb_elements,
|
||||
nb_elements_per_line, elements_names)
|
||||
|
||||
else :
|
||||
"Problem with the data type"
|
||||
|
@ -0,0 +1,16 @@
|
||||
../../../../../src/obidmscolumn_bool.c
|
||||
../../../../../src/obidmscolumn_bool.h
|
||||
../../../../../src/obidmscolumn.h
|
||||
../../../../../src/obidmscolumn.c
|
||||
../../../../../src/obidmscolumndir.h
|
||||
../../../../../src/obidmscolumndir.c
|
||||
../../../../../src/obidms.h
|
||||
../../../../../src/obidms.c
|
||||
../../../../../src/obierrno.h
|
||||
../../../../../src/obierrno.c
|
||||
../../../../../src/obilittlebigman.h
|
||||
../../../../../src/obilittlebigman.c
|
||||
../../../../../src/obitypes.h
|
||||
../../../../../src/obitypes.c
|
||||
../../../../../src/private_at_functions.h
|
||||
../../../../../src/private_at_functions.c
|
@ -0,0 +1,7 @@
|
||||
from obitools3.obidms.obidmscolumn.capidmscolumn cimport *
|
||||
|
||||
|
||||
cdef extern from "obidmscolumn_bool.h" nogil:
|
||||
|
||||
int obi_column_set_bool(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obibool_t value)
|
||||
obibool_t obi_column_get_bool(OBIDMS_column_p column, size_t line_nb, size_t element_idx)
|
@ -0,0 +1,30 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .capidmscolumn_bool cimport *
|
||||
|
||||
|
||||
cdef class OBIDMS_column_bool(OBIDMS_column) :
|
||||
|
||||
def set_item(self, line_nb, element_name, value):
|
||||
if element_name != "" :
|
||||
element_idx = self.get_element_index_from_name(element_name)
|
||||
else :
|
||||
if obi_column_get_nb_elements_per_line(self.pointer) == 1 :
|
||||
element_idx = 0
|
||||
else :
|
||||
print("An element name must be specified")
|
||||
return -1
|
||||
return obi_column_set_bool(self.pointer, line_nb, element_idx, value)
|
||||
|
||||
def get_item(self, line_nb, element_name):
|
||||
if element_name != "" :
|
||||
element_idx = self.get_element_index_from_name(element_name)
|
||||
else :
|
||||
if obi_column_get_nb_elements_per_line(self.pointer) == 1 :
|
||||
element_idx = 0
|
||||
else :
|
||||
print("An element name must be specified")
|
||||
return -1
|
||||
return obi_column_get_bool(self.pointer, line_nb, element_idx)
|
||||
|
||||
|
Reference in New Issue
Block a user