-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyef.cpp
More file actions
116 lines (101 loc) · 4.95 KB
/
Copy pathpyef.cpp
File metadata and controls
116 lines (101 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <boost/ref.hpp>
#include <boost/utility.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <boost/python/module.hpp>
#include <boost/python/class.hpp>
#include <boost/python/operators.hpp>
#include <boost/python/def.hpp>
#include <boost/python/pure_virtual.hpp>
#include <boost/python/copy_const_reference.hpp>
#include <boost/python/call.hpp>
#include <boost/python/call_method.hpp>
#include <boost/python/manage_new_object.hpp>
#include <boost/python/return_opaque_pointer.hpp>
#include <boost/operators.hpp>
#include <boost/python/tuple.hpp>
#include <boost/python/overloads.hpp>
#include <vector>
#include <mutex>
#include <fstream>
using namespace boost::python;
using namespace boost;
#include "data_file.hpp"
BOOST_PYTHON_MODULE (native)
{
class_<std::vector<std::uint32_t>> ("vec_u32", boost::python::init<size_t> ())
.def (boost::python::init<>())
.def (vector_indexing_suite<std::vector<std::uint32_t>> ())
.def ("append", (void (std::vector<std::uint32_t>::*) (const std::uint32_t &)) & std::vector<std::uint32_t>::push_back);
class_<std::vector<std::uint16_t>> ("vec_u16", boost::python::init<size_t> ())
.def (boost::python::init<>())
.def (vector_indexing_suite<std::vector<std::uint16_t>> ())
.def ("append", (void (std::vector<std::uint16_t>::*) (const std::uint16_t &)) & std::vector<std::uint16_t>::push_back);
class_<std::vector<local_station_t>> ("vec_ls", boost::python::init<size_t> ())
.def (boost::python::init<>())
.def (vector_indexing_suite<std::vector<local_station_t>> ())
.def ("append", (void (std::vector<local_station_t>::*) (const local_station_t &)) & std::vector<local_station_t>::push_back);
class_<std::vector<event_t>> ("vec_event", boost::python::init<size_t> ())
.def (boost::python::init<>())
.def (vector_indexing_suite<std::vector<event_t>> ())
.def ("append", (void (std::vector<event_t>::*) (const event_t &)) & std::vector<event_t>::push_back);
class_<file_header_t>("file_header", boost::python::init<>())
.def("length", &file_header_t::length)
.def("runnr", &file_header_t::runnr)
.def("run_mode", &file_header_t::run_mode)
.def("serial", &file_header_t::run_mode)
.def("first_event", &file_header_t::first_event)
.def("first_event_sec", &file_header_t::first_event_sec)
.def("last_event", &file_header_t::last_event)
.def("last_event_sec", &file_header_t::last_event_sec)
.def("additional_header", &file_header_t::get_additional_header)
.def(str(self))
;
class_<event_header_t>("event_header", boost::python::init<>())
.def_readonly("header_length", &event_header_t::header_length)
.def_readonly("runnr", &event_header_t::runnr)
.def_readonly("eventnr",&event_header_t::eventnr)
.def_readonly("t3eventnr",&event_header_t::t3eventnr)
.def_readonly("first_ls",&event_header_t::first_ls)
.def_readonly("event_sec",&event_header_t::event_sec)
.def_readonly("event_nsec",&event_header_t::event_nsec)
.def_readonly("event_type",&event_header_t::event_type)
.def_readonly("event_vers",&event_header_t::event_vers)
.def_readonly("ad1",&event_header_t::ad1)
.def_readonly("ad2",&event_header_t::ad2)
.def_readonly("ls_cnt",&event_header_t::ls_cnt)
.def(str(self))
;
class_<local_station_header_t>("local_station_header", boost::python::init<>())
.def_readonly("length", &local_station_header_t::length)
.def_readonly("event_nr", &local_station_header_t::event_nr)
.def_readonly("ls_id", &local_station_header_t::ls_id)
.def_readonly("header_length", &local_station_header_t::header_length)
.def_readonly("GPSseconds", &local_station_header_t::GPSseconds)
.def_readonly("GPSnanoseconds", &local_station_header_t::GPSnanoseconds)
.def_readonly("trigger_flag", &local_station_header_t::trigger_flag)
.def_readonly("trigger_pos", &local_station_header_t::trigger_pos)
.def_readonly("sampling_freq", &local_station_header_t::sampling_freq)
.def_readonly("channel_mask", &local_station_header_t::channel_mask)
.def_readonly("ADC_resolution", &local_station_header_t::ADC_resolution)
.def_readonly("trace_length", &local_station_header_t::trace_length)
.def_readonly("version", &local_station_header_t::version)
.def(str(self))
;
class_<local_station_t>("local_station", boost::python::init<>())
.def_readonly("header", &local_station_t::header)
.def_readonly("header_data", &local_station_t::header_data)
.def_readonly("adc_buffer", &local_station_t::adc_buffer)
.def(str(self))
;
class_<event_t>("event", boost::python::init<>())
.def_readonly("header", &event_t::header)
.def_readonly("local_station_list", &event_t::local_station_list)
.def(str(self))
;
class_<event_file>("event_file", boost::python::init<>())
.def_readonly("header", &event_file::header)
.def_readonly("event_list", &event_file::event_list)
.def(str(self))
;
def("read_event_file", read_event_file);
}