* rawmerge.hpp: generalize/fix condition for consistent timeseries
* introduce propagation of C++ exceptions to Cython/Python * convert all cout/cerr output to exceptions * Cython: introduce separate 'do_conversion' => avoid constructor to trigger conversion
This commit is contained in:
@@ -14,14 +14,18 @@ from libcpp cimport bool
|
||||
#
|
||||
# for how to overload the constructor see
|
||||
# https://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html
|
||||
# and propagating exceptions from C++ to Python
|
||||
# http://docs.cython.org/en/latest/src/userguide/wrapping_CPlusPlus.html#exceptions
|
||||
|
||||
cdef extern from "../lib/raweat.hpp":
|
||||
cdef cppclass raw_eater:
|
||||
# constructor(s)
|
||||
raw_eater() except+
|
||||
raw_eater() except +
|
||||
raw_eater(string) except +
|
||||
# set new file for decoding
|
||||
void set_file(string)
|
||||
# perform conversion (pass any C++ exceptions to Python)
|
||||
void setup_and_conversion() except +
|
||||
# get validity of data format
|
||||
bool get_valid()
|
||||
# get channel name and unit
|
||||
|
@@ -30,6 +30,9 @@ cdef class raweater:
|
||||
raise ValueError("'" + str(rawfile) + "' does not exist")
|
||||
self.rawit.set_file(rawfile)
|
||||
|
||||
def do_conversion(self):
|
||||
self.rawit.setup_and_conversion()
|
||||
|
||||
def validity(self):
|
||||
return self.rawit.get_valid()
|
||||
|
||||
|
@@ -23,8 +23,8 @@ cdef extern from "../lib/rawmerge.hpp":
|
||||
vector[double] get_data()
|
||||
# dump all data to .csv
|
||||
void write_table(const char*,char)
|
||||
# add channel and try to merge it
|
||||
bool add_channel(string)
|
||||
# add channel and try to merge it (pass C++ exceptions to Python)
|
||||
bool add_channel(string) except +
|
||||
# get total number of (added) channels
|
||||
int get_num_channels()
|
||||
# get list of channel names
|
||||
|
Reference in New Issue
Block a user