-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_binding_example.cpp
50 lines (36 loc) · 2.07 KB
/
custom_binding_example.cpp
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
#include "stryke/type.hpp"
#include "stryke/core.hpp"
#include "stryke/dispatch.hpp"
#include "stryke/sequential.hpp"
#include "stryke/options.hpp"
#include "stryke/reader.hpp"
#include "stryke/thread.hpp"
#include "stryke_binding.hpp"
#include <Python.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <array>
#include <iostream>
#include <string>
namespace py = pybind11;
void init_custom(py::module &m) {
using namespace stryke; // for convenience
// We can't declare two time the same cpp type for example the following two line :
// declare_writer_impl<TimestampNumber, Long, Long>(m, "FirstDeclaration");
// declare_writer_impl<TimestampNumber, Long, Long>(m, "SecondDeclarationThatCrash");
// will generate the following error at python import :
// ImportError: generic_type: type "WriterCustom1" is already registered!
declare_writer_impl<TimestampNumber, Long, Long>(m, "Custom1");
declare_writer_dispatch<FolderEncode<TimestampNumber, Long>, Long>(m, "Custom2");
declare_writer_dispatch<FolderEncode<>, TimestampNumber, Long, Long>(m, "Custom3");
declare_writer_sequential<TimestampNumber, FolderEncode<Long>, Long>(m, "Custom4");
declare_writer_sequential<TimestampNumber, FolderEncode<>, Long>(m, "Custom5");
declare_writer_thread<OrcWriterDispatchDuplicate, TimestampNumber, FolderEncode<Long>, Long>(m, "Custom6_1");
declare_writer_thread<OrcWriterDispatchDuplicate, TimestampNumber, FolderEncode<>, Long, Long>(m, "Custom7_1");
declare_writer_thread<OrcWriterSequentialDuplicate, TimestampNumber, FolderEncode<Long>, Long>(m, "Custom6_2");
declare_writer_thread<OrcWriterSequentialDuplicate, TimestampNumber, FolderEncode<>, Long, Long>(m, "Custom7_2");
declare_writer_dispatch_duplicate<TimestampNumber, FolderEncode<Long>, Long>(m, "Custom8");
declare_writer_dispatch_duplicate<TimestampNumber, FolderEncode<>, Long>(m, "Custom9");
declare_writer_sequential_duplicate<TimestampNumber, FolderEncode<Long>, Long>(m, "Custom10");
declare_writer_sequential_duplicate<TimestampNumber, FolderEncode<>, Long>(m, "Custom11");
}