@@ -0,0 +1,80 | |||||
|
1 | #include <QString> | |||
|
2 | #include <QUuid> | |||
|
3 | #include <QDate> | |||
|
4 | #include <QTime> | |||
|
5 | #include <QVector> | |||
|
6 | #include <string> | |||
|
7 | #include <sstream> | |||
|
8 | #include "pywrappers_common.h" | |||
|
9 | #include <pybind11/pybind11.h> | |||
|
10 | #include <pybind11/operators.h> | |||
|
11 | ||||
|
12 | #include <Catalogue/CatalogueController.h> | |||
|
13 | #include <DBEvent.h> | |||
|
14 | #include <DBEventProduct.h> | |||
|
15 | #include <DBCatalogue.h> | |||
|
16 | ||||
|
17 | ||||
|
18 | namespace py = pybind11; | |||
|
19 | ||||
|
20 | std::ostream &operator <<(std::ostream& os, const DBEvent& e) | |||
|
21 | { | |||
|
22 | os << std::endl; | |||
|
23 | return os; | |||
|
24 | } | |||
|
25 | ||||
|
26 | #define JAVA_LIKE_PROPERTY(name, className) .def_property("##name", &className::get##name, &className::set##name) | |||
|
27 | ||||
|
28 | PYBIND11_MODULE(pysciqlopcatalogs,m){ | |||
|
29 | ||||
|
30 | py::class_<DBEventProduct, std::shared_ptr<DBEventProduct>>(m,"DBEventProduct") | |||
|
31 | JAVA_LIKE_PROPERTY(TStart, DBEventProduct) | |||
|
32 | JAVA_LIKE_PROPERTY(TEnd, DBEventProduct) | |||
|
33 | JAVA_LIKE_PROPERTY(ProductId, DBEventProduct) | |||
|
34 | JAVA_LIKE_PROPERTY(CreationDateTime, DBEventProduct) | |||
|
35 | JAVA_LIKE_PROPERTY(ModificationDateTime, DBEventProduct) | |||
|
36 | JAVA_LIKE_PROPERTY(Event, DBEventProduct) | |||
|
37 | ; | |||
|
38 | ||||
|
39 | py::class_<DBEvent, std::shared_ptr<DBEvent>>(m, "DBEvent") | |||
|
40 | JAVA_LIKE_PROPERTY(Name,DBEvent) | |||
|
41 | JAVA_LIKE_PROPERTY(UniqId,DBEvent) | |||
|
42 | JAVA_LIKE_PROPERTY(Author,DBEvent) | |||
|
43 | JAVA_LIKE_PROPERTY(Repository,DBEvent) | |||
|
44 | JAVA_LIKE_PROPERTY(CreationDateTime,DBEvent) | |||
|
45 | JAVA_LIKE_PROPERTY(ModificationDateTime,DBEvent) | |||
|
46 | JAVA_LIKE_PROPERTY(EventProducts,DBEvent) | |||
|
47 | .def_property_readonly("TStart", &DBEvent::getTStart) | |||
|
48 | .def_property_readonly("TEnd", &DBEvent::getTEnd) | |||
|
49 | .def("__repr__",__repr__<DBEvent>); | |||
|
50 | ||||
|
51 | py::class_<DBCatalogue, std::shared_ptr<DBCatalogue>>(m,"DBEventProduct") | |||
|
52 | JAVA_LIKE_PROPERTY(CatalogueId, DBCatalogue) | |||
|
53 | JAVA_LIKE_PROPERTY(UniqId, DBCatalogue) | |||
|
54 | JAVA_LIKE_PROPERTY(Name, DBCatalogue) | |||
|
55 | JAVA_LIKE_PROPERTY(Author, DBCatalogue) | |||
|
56 | JAVA_LIKE_PROPERTY(Repository, DBCatalogue) | |||
|
57 | JAVA_LIKE_PROPERTY(CreationDateTime, DBCatalogue) | |||
|
58 | JAVA_LIKE_PROPERTY(ModificationDateTime, DBCatalogue) | |||
|
59 | ; | |||
|
60 | ||||
|
61 | py::class_<CatalogueController>(m, "CatalogueController") | |||
|
62 | .def("addDB", &CatalogueController::addDB) | |||
|
63 | .def("saveDB", &CatalogueController::saveDB) | |||
|
64 | .def("addEvent", &CatalogueController::addEvent) | |||
|
65 | .def("updateEvent", &CatalogueController::updateEvent) | |||
|
66 | .def("updateEventProduct", &CatalogueController::updateEventProduct) | |||
|
67 | .def("removeEvent", &CatalogueController::removeEvent) | |||
|
68 | .def("saveEvent", &CatalogueController::saveEvent) | |||
|
69 | .def("discardEvent", &CatalogueController::discardEvent) | |||
|
70 | .def("eventHasChanges", &CatalogueController::eventHasChanges) | |||
|
71 | .def("addCatalogue", &CatalogueController::addCatalogue) | |||
|
72 | .def("updateCatalogue", &CatalogueController::updateCatalogue) | |||
|
73 | .def("removeCatalogue", &CatalogueController::removeCatalogue) | |||
|
74 | .def("saveCatalogue", &CatalogueController::saveCatalogue) | |||
|
75 | .def("discardCatalogue", &CatalogueController::discardCatalogue) | |||
|
76 | .def("saveAll", &CatalogueController::saveAll) | |||
|
77 | .def("hasChanges", &CatalogueController::hasChanges) | |||
|
78 | ; | |||
|
79 | } | |||
|
80 |
@@ -178,6 +178,9 if(PyWrappers) | |||||
178 | pybind11_add_module(pysciqlopcore src/pybind11_wrappers/CoreWrappers.cpp) |
|
178 | pybind11_add_module(pysciqlopcore src/pybind11_wrappers/CoreWrappers.cpp) | |
179 | target_link_libraries(pysciqlopcore PUBLIC sciqlopcore) |
|
179 | target_link_libraries(pysciqlopcore PUBLIC sciqlopcore) | |
180 |
|
180 | |||
|
181 | pybind11_add_module(pysciqlopcatalogs src/pybind11_wrappers/CatalogWrappers.cpp) | |||
|
182 | target_link_libraries(pysciqlopcatalogs PUBLIC sciqlopcore) | |||
|
183 | ||||
181 | add_library(pysciqlop src/pybind11_wrappers/pywrappers_common.h) |
|
184 | add_library(pysciqlop src/pybind11_wrappers/pywrappers_common.h) | |
182 | target_link_libraries(pysciqlop PUBLIC Qt5::Core) |
|
185 | target_link_libraries(pysciqlop PUBLIC Qt5::Core) | |
183 | target_include_directories(pysciqlop PUBLIC |
|
186 | target_include_directories(pysciqlop PUBLIC |
General Comments 0
You need to be logged in to leave comments.
Login now