added methods to .pyx
This commit is contained in:
parent
607e671852
commit
97d26f57da
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ pytdm_ripper.cpp
|
|||||||
build/
|
build/
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
|
*.dat
|
||||||
|
@ -3,4 +3,11 @@ import tdm_ripper
|
|||||||
tdmpath = b"samples/SineData.tdm"
|
tdmpath = b"samples/SineData.tdm"
|
||||||
tdxpath = b"samples/SineData.tdx"
|
tdxpath = b"samples/SineData.tdx"
|
||||||
|
|
||||||
tdm_ripper.pytdmripper(tdmpath)
|
rippobj = tdm_ripper.pytdmripper(tdmpath)
|
||||||
|
|
||||||
|
rippobj.show_channels()
|
||||||
|
|
||||||
|
print(rippobj.num_channels())
|
||||||
|
print(rippobj.num_groups())
|
||||||
|
|
||||||
|
rippobj.print_channel(1,b"SineData_extract.dat")
|
||||||
|
@ -1,38 +1,12 @@
|
|||||||
|
|
||||||
#include "tdm_ripper.hpp"
|
#include "tdm_ripper.hpp"
|
||||||
|
|
||||||
// tdm_ripper::tdm_ripper():
|
|
||||||
// tdmfile_(""), tdxfile_(""), filesprovided_(false),
|
|
||||||
// num_channels_(0), num_groups_(0),
|
|
||||||
// channel_id_(0), group_id_(0), channel_name_(0), group_name_(0),
|
|
||||||
// num_channels_group_(0), channels_group_(0),
|
|
||||||
// byteoffset_(0), length_(0), type_(0)
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile):
|
tdm_ripper::tdm_ripper(std::string tdmfile, std::string tdxfile):
|
||||||
tdmfile_(tdmfile), tdxfile_(tdxfile), //filesprovided_(true),
|
tdmfile_(tdmfile), tdxfile_(tdxfile), num_channels_(0), num_groups_(0),
|
||||||
num_channels_(0), num_groups_(0),
|
|
||||||
channel_id_(0), group_id_(0), channel_name_(0), group_name_(0),
|
channel_id_(0), group_id_(0), channel_name_(0), group_name_(0),
|
||||||
num_channels_group_(0), channels_group_(0),
|
num_channels_group_(0), channels_group_(0),
|
||||||
byteoffset_(0), length_(0), type_(0)
|
byteoffset_(0), length_(0), type_(0)
|
||||||
{
|
{
|
||||||
setup();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// void tdm_ripper::setfiles(std::string tdmfile, std::string tdxfile)
|
|
||||||
// {
|
|
||||||
// tdmfile_ = tdmfile;
|
|
||||||
// tdxfile_ = tdxfile;
|
|
||||||
// filesprovided_ = true;
|
|
||||||
// setup();
|
|
||||||
// }
|
|
||||||
|
|
||||||
void tdm_ripper::setup()
|
|
||||||
{
|
|
||||||
// assert( filesprovided_ );
|
|
||||||
|
|
||||||
// TODO directly provide the C datatype to be used!!
|
// TODO directly provide the C datatype to be used!!
|
||||||
datatypes_ = {
|
datatypes_ = {
|
||||||
{"eInt8Usi",8},
|
{"eInt8Usi",8},
|
||||||
|
@ -17,7 +17,6 @@ class tdm_ripper
|
|||||||
// .tdm and .tdx filenames
|
// .tdm and .tdx filenames
|
||||||
std::string tdmfile_;
|
std::string tdmfile_;
|
||||||
std::string tdxfile_;
|
std::string tdxfile_;
|
||||||
// bool filesprovided_;
|
|
||||||
|
|
||||||
// endianness (true = little, false = big)
|
// endianness (true = little, false = big)
|
||||||
bool endianness_, machine_endianness_;
|
bool endianness_, machine_endianness_;
|
||||||
@ -45,12 +44,8 @@ class tdm_ripper
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// tdm_ripper();
|
|
||||||
tdm_ripper(std::string tdmfile, std::string tdxfile = "");
|
tdm_ripper(std::string tdmfile, std::string tdxfile = "");
|
||||||
|
|
||||||
// void setfiles(std::string tdmfile, std::string tdxfile = "");
|
|
||||||
void setup();
|
|
||||||
|
|
||||||
void parse_structure();
|
void parse_structure();
|
||||||
|
|
||||||
void show_channels(int width = 15, int maxshow = 300);
|
void show_channels(int width = 15, int maxshow = 300);
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# cython: language_level = 3
|
# cython: language_level = 3
|
||||||
# distutils: language = c++
|
# distutils: language = c++
|
||||||
|
|
||||||
## distutils: sources = lib/tdm_ripper.cpp
|
|
||||||
|
|
||||||
from tdm_ripper cimport tdm_ripper
|
from tdm_ripper cimport tdm_ripper
|
||||||
|
|
||||||
cdef class pytdmripper:
|
cdef class pytdmripper:
|
||||||
@ -16,5 +14,14 @@ cdef class pytdmripper:
|
|||||||
def __dealloc__(self):
|
def __dealloc__(self):
|
||||||
del self.cripp
|
del self.cripp
|
||||||
|
|
||||||
# def setfiles(self, string tdmfile, string tdxfile):
|
def show_channels(self):
|
||||||
# self.cripp(tdmfile,tdxfile)
|
self.cripp.show_channels()
|
||||||
|
|
||||||
|
def num_channels(self):
|
||||||
|
return self.cripp.num_channels()
|
||||||
|
|
||||||
|
def num_groups(self):
|
||||||
|
return self.cripp.num_groups()
|
||||||
|
|
||||||
|
def print_channel(self,int channelid, const char* filename):
|
||||||
|
self.cripp.print_channel(channelid,filename)
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
from libcpp.string cimport string
|
from libcpp.string cimport string
|
||||||
from libcpp.vector cimport vector
|
from libcpp.vector cimport vector
|
||||||
|
|
||||||
# use only in absence of # distutils: sources = lib/tdm_ripper.cpp in .pyx
|
|
||||||
cdef extern from "tdm_ripper.cpp":
|
cdef extern from "tdm_ripper.cpp":
|
||||||
pass
|
pass
|
||||||
|
|
||||||
cdef extern from "tdm_ripper.hpp":
|
cdef extern from "tdm_ripper.hpp":
|
||||||
cdef cppclass tdm_ripper:
|
cdef cppclass tdm_ripper:
|
||||||
# tdm_ripper() except +
|
|
||||||
tdm_ripper(string) except +
|
tdm_ripper(string) except +
|
||||||
# void setfiles(string, string)
|
void show_channels()
|
||||||
# void setup()
|
int num_channels()
|
||||||
|
int num_groups()
|
||||||
|
void print_channel(int,const char*)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user