diff --git a/.xo-pyreactor/.github/workflows/main.yml b/.xo-pyreactor/.github/workflows/main.yml deleted file mode 100644 index fb304ec2..00000000 --- a/.xo-pyreactor/.github/workflows/main.yml +++ /dev/null @@ -1,310 +0,0 @@ -name: build xo-pyreactor + dependencies - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - name: checkout source - uses: actions/checkout@v3 - - - name: Install catch2 - # install catch2. see [[https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow]] - run: sudo apt-get install -y catch2 - - - name: Install pybind11-dev - run: sudo apt-get install -y pybind11-dev - - # ---------------------------------------------------------------- - - - name: Clone xo-cmake - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-cmake - path: repo/xo-cmake - - - name: Configure xo-cmake - run: cmake -B ${{github.workspace}}/build_xo-cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/xo-cmake - - - name: Build xo-cmake (trivial) - run: cmake --build ${{github.workspace}}/build_xo-cmake --config ${{env.BUILD_TYPE}} - - - name: Install xo-cmake - run: cmake --install ${{github.workspace}}/build_xo-cmake - - # ---------------------------------------------------------------- - - - name: Clone indentlog - uses: actions/checkout@v3 - with: - repository: Rconybea/indentlog - path: repo/indentlog - - - name: Configure indentlog - # configure cmake for indentlog in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_indentlog -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/indentlog - - - name: Build indentlog - run: cmake --build ${{github.workspace}}/build_indentlog --config ${{env.BUILD_TYPE}} - - - name: Install indentlog - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_indentlog - - # ---------------------------------------------------------------- - - - name: Clone subsys - uses: actions/checkout@v3 - with: - repository: Rconybea/subsys - path: repo/subsys - - - name: Configure subsys - # configure cmake for subsys in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_subsys -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/subsys - - - name: Build subsys - run: cmake --build ${{github.workspace}}/build_subsys --config ${{env.BUILD_TYPE}} - - - name: Install subsys - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_subsys - - # ---------------------------------------------------------------- - - - name: Clone refcnt - uses: actions/checkout@v3 - with: - repository: Rconybea/refcnt - path: repo/refcnt - - - name: Configure refcnt - # configure cmake for refcnt in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_refcnt -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/refcnt - - - name: Build refcnt - run: cmake --build ${{github.workspace}}/build_refcnt --config ${{env.BUILD_TYPE}} - - - name: Install refcnt - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_refcnt - - # ---------------------------------------------------------------- - - - name: Clone reflect - uses: actions/checkout@v3 - with: - repository: Rconybea/reflect - path: repo/reflect - - - name: Configure reflect - # configure cmake for reflect in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_reflect -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/reflect - - - name: Build reflect - run: cmake --build ${{github.workspace}}/build_reflect --config ${{env.BUILD_TYPE}} - - - name: Install reflect - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_reflect - - # ---------------------------------------------------------------- - - - name: Clone callback - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-callback - path: repo/callback - - - name: Configure callback - # configure cmake for callback in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_callback -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/callback - - - name: Build callback - run: cmake --build ${{github.workspace}}/build_callback --config ${{env.BUILD_TYPE}} - - - name: Install callback - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_callback - - # ---------------------------------------------------------------- - - - name: Clone webutil - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-webutil - path: repo/webutil - - - name: Configure webutil - # configure cmake for webutil in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_webutil -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/webutil - - - name: Build webutil - run: cmake --build ${{github.workspace}}/build_webutil --config ${{env.BUILD_TYPE}} - - - name: Install webutil - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_webutil - - # ---------------------------------------------------------------- - - - name: Clone printjson - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-printjson - path: repo/printjson - - - name: Configure printjson - # configure cmake for printjson in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_printjson -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/printjson - - - name: Build printjson - run: cmake --build ${{github.workspace}}/build_printjson --config ${{env.BUILD_TYPE}} - - - name: Install printjson - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_printjson - - # ---------------------------------------------------------------- - - - name: Clone randomgen - uses: actions/checkout@v3 - with: - repository: Rconybea/randomgen - path: repo/randomgen - - - name: Configure randomgen - # configure cmake for randomgen in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_randomgen -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/randomgen - - - name: Build randomgen - run: cmake --build ${{github.workspace}}/build_randomgen --config ${{env.BUILD_TYPE}} - - - name: Install randomgen - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_randomgen - - # ---------------------------------------------------------------- - - - name: Clone ordinaltree - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-ordinaltree - path: repo/ordinaltree - - - name: Configure ordinaltree - # configure cmake for ordinaltree in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_ordinaltree -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/ordinaltree - - - name: Build ordinaltree - run: cmake --build ${{github.workspace}}/build_ordinaltree --config ${{env.BUILD_TYPE}} - - - name: Install ordinaltree - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_ordinaltree - - # ---------------------------------------------------------------- - - - name: Clone reactor - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-reactor - path: repo/reactor - - - name: Configure reactor - # configure cmake for reactor in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_reactor -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/reactor - - - name: Build reactor - run: cmake --build ${{github.workspace}}/build_reactor --config ${{env.BUILD_TYPE}} - - - name: Install reactor - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_reactor - - # ---------------------------------------------------------------- - - - name: Clone pyutil - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyutil - path: repo/pyutil - - - name: Configure pyutil - # configure cmake for pyutil in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyutil -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyutil - - - name: Build pyutil - run: cmake --build ${{github.workspace}}/build_pyutil --config ${{env.BUILD_TYPE}} - - - name: Install pyutil - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyutil - - # ---------------------------------------------------------------- - - - name: Clone pyreflect - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyreflect - path: repo/pyreflect - - - name: Configure pyreflect - # configure cmake for pyreflect in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyreflect -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyreflect - - - name: Build pyreflect - run: cmake --build ${{github.workspace}}/build_pyreflect --config ${{env.BUILD_TYPE}} - - - name: Install pyreflect - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyreflect - - # ---------------------------------------------------------------- - - - name: Clone pyprintjson - uses: actions/checkout@v3 - with: - repository: Rconybea/xo-pyprintjson - path: repo/pyprintjson - - - name: Configure pyprintjson - # configure cmake for pyprintjson in dedicated build directory. - run: cmake -B ${{github.workspace}}/build_pyprintjson -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/pyprintjson - - - name: Build pyprintjson - run: cmake --build ${{github.workspace}}/build_pyprintjson --config ${{env.BUILD_TYPE}} - - - name: Install pyprintjson - # install into ${{github.workspace}}/local - run: cmake --install ${{github.workspace}}/build_pyprintjson - - # ---------------------------------------------------------------- - - - name: Configure self (pyreactor) - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build_pyreactor -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build self (pyreactor) - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build_pyreactor --config ${{env.BUILD_TYPE}} - - - name: Test self (pyreactor) - working-directory: ${{github.workspace}}/build_pyreactor - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} diff --git a/.xo-pyreactor/.gitignore b/.xo-pyreactor/.gitignore deleted file mode 100644 index 53a9c92f..00000000 --- a/.xo-pyreactor/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# lsp keeps state here -.cache -# typical build directory -.build* -# lsp: symlink to file in build directory (established manually) -compile_commands.json diff --git a/.xo-pyreactor/CMakeLists.txt b/.xo-pyreactor/CMakeLists.txt deleted file mode 100644 index 6d47faed..00000000 --- a/.xo-pyreactor/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -# xo-pyreactor/CMakeLists.txt - -cmake_minimum_required(VERSION 3.10) - -project(xo_pyreactor VERSION 1.0) - -include(GNUInstallDirs) -include(cmake/xo-bootstrap-macros.cmake) - -xo_cxx_toplevel_options3() - -# ---------------------------------------------------------------- -# c++ settings (usually temporary) - -set(PROJECT_CXX_FLAGS "") -add_definitions(${PROJECT_CXX_FLAGS}) - -# ---------------------------------------------------------------- -# sources - -add_subdirectory(src/pyreactor) -#add_subdirectory(utest) - -# ---------------------------------------------------------------- -# provide find_package() support - -xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) diff --git a/.xo-pyreactor/EXAMPLES b/.xo-pyreactor/EXAMPLES deleted file mode 100644 index 4b67a31a..00000000 --- a/.xo-pyreactor/EXAMPLES +++ /dev/null @@ -1,12 +0,0 @@ -* see ../process_py/README - ->>> import reactor_py ->>> p=reactor_py.make_realization_printer() ->>> p - ->>> - ->>> import inspect ->>> inspect.getmro(reactor_py.SinkToConsole) - ->>> dir(reactor_py) diff --git a/.xo-pyreactor/README.md b/.xo-pyreactor/README.md deleted file mode 100644 index bda29b5f..00000000 --- a/.xo-pyreactor/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# python bindings for c++ reactor library (xo-reactor) - -## Getting Started - -### build + install dependencies - -- [github/Rconybea/xo-reactor](https://github.com/Rconybea/xo-reactor) -- [github/Rconybea/xo-pyutil](https://github.com/Rconybea/xo-pyutil) -- [github/Rconybea/xo-pyreflect](https://github.com/Rconybea/xo-pyreflect) -- [github/Rconybea/xo-pyprintjson](https://github.com/Rconybea/xo-pyprintjson) - -### build + install - -``` -$ cd xo-pyreactor -$ mkdir build -$ cd build -$ INSTALL_PREFIX=/usr/local # or wherever you prefer, e.g. ~/local -$ cmake \ - -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake \ - -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \ - -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} .. -$ make -$ make install -``` -(also see .github/workflows/main.yml) - -## Examples - -Assumes `xo-pyreactor` installed to `~/local2/lib` -``` -PYTHONPATH=~/local2/lib:$PYTHONPATH python ->>> import xo_pyreactor ->>> dir(xo_pyreactor) -['AbstractEventProcessor', 'AbstractEventStore', 'AbstractSink', 'AbstractSource', 'CallbackId', 'Reactor', 'ReactorSource', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'time2str'] ->>> -``` - -## Development - -### build for unit test coverage -``` -$ cd xo-pyreactor -$ mkdir build-ccov -$ cd build-ccov -$ cmake \ - -DCMAKE_MODULE_PATH=${INSTALL_PREFIX}/share/cmake \ - -DCMAKE_PREFIX_PATH=${INSTALL_PREFIX} \ - -DCODE_COVERAGE=ON \ - -DCMAKE_BUILD_TYPE=Debug .. -``` - -### LSP (language server) support - -LSP looks for compile commands in the root of the source tree; -while Cmake creates them in the root of its build directory. - -``` -$ cd xo-pyreactor -$ ln -s build/compile_commands.json # supply compile commands to LSP -``` - -### display cmake variables - -- `-L` list variables -- `-A` include 'advanced' variables -- `-H` include help text - -``` -$ cd xo-pyreactor/build -$ cmake -LAH -``` diff --git a/.xo-pyreactor/cmake/xo-bootstrap-macros.cmake b/.xo-pyreactor/cmake/xo-bootstrap-macros.cmake deleted file mode 100644 index 592272c0..00000000 --- a/.xo-pyreactor/cmake/xo-bootstrap-macros.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# ---------------------------------------------------------------- -# for example: -# $ PREFIX=/usr/local # for example -# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build -# -# will get -# CMAKE_MODULE_PATH -# from xo-cmake-config --cmake-module-path -# -# and expect .cmake macros in -# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake -# ---------------------------------------------------------------- - -find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED) - -if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND") - message(FATAL "could not find xo-cmake-config executable") -endif() - -message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}") - -if (XO_SUBMODULE_BUILD) - if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) - # local version of xo-cmake macros - set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/xo-cmake/cmake") - message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") - endif() -else() - if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) - # default to typical install location for xo-project-macros - execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH) - message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") - endif() -endif() - -# needs to have been installed somewhere on CMAKE_MODULE_PATH, -# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX) -# -include(xo_macros/xo_cxx) - -xo_cxx_bootstrap_message() diff --git a/.xo-pyreactor/cmake/xo_pyreactorConfig.cmake.in b/.xo-pyreactor/cmake/xo_pyreactorConfig.cmake.in deleted file mode 100644 index eb9a3b16..00000000 --- a/.xo-pyreactor/cmake/xo_pyreactorConfig.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Share.cmake") -check_required_components("@PROJECT_NAME@") diff --git a/.xo-pyreactor/include/README.md b/.xo-pyreactor/include/README.md deleted file mode 100644 index 4a0ad1c1..00000000 --- a/.xo-pyreactor/include/README.md +++ /dev/null @@ -1 +0,0 @@ -placeholder for future pyreactor #include files diff --git a/.xo-pyreactor/src/pyreactor/CMakeLists.txt b/.xo-pyreactor/src/pyreactor/CMakeLists.txt deleted file mode 100644 index fa30e71d..00000000 --- a/.xo-pyreactor/src/pyreactor/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# xo_pyreactor/src/pyreactor/CMakeLists.txt - -set(SELF_LIB xo_pyreactor) -set(SELF_SRCS pyreactor.cpp) - -xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS}) -xo_pybind11_dependency(${SELF_LIB} reactor) -xo_pybind11_header_dependency(${SELF_LIB} xo_pyprintjson) diff --git a/.xo-pyreactor/src/pyreactor/pyreactor.cpp b/.xo-pyreactor/src/pyreactor/pyreactor.cpp deleted file mode 100644 index f28e610d..00000000 --- a/.xo-pyreactor/src/pyreactor/pyreactor.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* @file pyreactor.cpp */ - -#include "pyreactor.hpp" -#include "xo/pyprintjson/pyprintjson.hpp" -#include "xo/pyreflect/pyreflect.hpp" - -#include "xo/reactor/Reactor.hpp" -#include "xo/reactor/ReactorSource.hpp" -#include "xo/reactor/EventStore.hpp" -#include "xo/reactor/Sink.hpp" -#include "xo/webutil/StreamEndpointDescr.hpp" -//#include "time/Time.hpp" - -//#include "xo/pyutil/pytime.hpp" -#include "xo/pyutil/pyutil.hpp" - -//#include -//#include -#include - -namespace xo { - using xo::json::PrintJsonSingleton; - using xo::fn::CallbackId; - using xo::ref::Refcount; - using xo::time::utc_nanos; - using xo::tostr; - namespace py = pybind11; - - namespace reactor { - PYBIND11_MODULE(PYREACTOR_MODULE_NAME(), m) { - /* e.g. for TypeDescr */ - PYREFLECT_IMPORT_MODULE(); //py::module_::import("pyreflect"); - PYPRINTJSON_IMPORT_MODULE(); //py::module_::import("pyprintjson"); - - /* module docstring */ - m.doc() = "pybind11 plugin for xo.reactor"; - - m.def("time2str", [](utc_nanos tm) { return tostr(tm); }); - - /* TODO: if we write pycallback/, then CallbackId wrapper belongs there */ - py::class_(m, "CallbackId"); - - py::class_>(m, "AbstractEventProcessor") - .def_property("name", - &AbstractEventProcessor::name, - &AbstractEventProcessor::set_name) - .def("reference_counter", [](AbstractEventProcessor const & x) { return x.reference_counter(); }) - .def("memory_address", [](AbstractEventProcessor const & x) { return (void*)&x; }) - .def("map_network", [](AbstractEventProcessor & x) { return AbstractEventProcessor::map_network(&x); }) - .def("__repr__", &AbstractEventProcessor::display_string); - - py::class_>(m, "AbstractSource") - .def_property_readonly("source_ev_type", &AbstractSource::source_ev_type) - .def_property_readonly("is_volatile", &AbstractSource::is_volatile) - .def_property_readonly("n_out_ev", &AbstractSource::n_out_ev) - .def_property_readonly("n_queued_out_ev", &AbstractSource::n_queued_out_ev) - .def("attach_sink", &AbstractSource::attach_sink) - .def("detach_sink", &AbstractSource::detach_sink) - /* editor bait: websock_endpoint_descr */ - .def("stream_endpoint_descr", &AbstractSource::stream_endpoint_descr) - .def("deliver_one", &AbstractSource::deliver_one) - .def("deliver_n", &AbstractSource::deliver_n, - py::arg("n")); - - py::class_>(m, "AbstractSink") - //.cdef("__repr__", &AbstractSink::display_string) - .def_property_readonly("sink_ev_type", &AbstractSink::sink_ev_type) - .def_property_readonly("n_in_ev", &AbstractSink::n_in_ev) - .def("attach_source", &AbstractSink::attach_source); - - py::class_> - (m, "ReactorSource") - .def_property_readonly("is_empty", &ReactorSource::is_empty) - .def_property_readonly("is_nonempty", &ReactorSource::is_nonempty) - .def_property_readonly("is_exhausted", &ReactorSource::is_exhausted) - .def_property_readonly("sim_current_tm", &ReactorSource::sim_current_tm) - .def_property("debug_sim_flag", - &ReactorSource::debug_sim_flag, - &ReactorSource::set_debug_sim_flag); - - py::class_> - (m, "AbstractEventStore") - .def_property_readonly("empty", &AbstractEventStore::empty) - .def_property_readonly("size", &AbstractEventStore::size) - .def("http_snapshot", - [](AbstractEventStore & self) { - std::stringstream ss; - self.http_snapshot(PrintJsonSingleton::instance(), &ss); - return ss.str(); - }) - .def("http_endpoint_descr", - [](AbstractEventStore & self, std::string const & url_prefix) { - return self.http_endpoint_descr(PrintJsonSingleton::instance(), url_prefix); - }, - py::arg("url_prefix")) - .def("clear", - &AbstractEventStore::clear); - - py::class_> - (m, "Reactor") - .def("add_source", - [](Reactor & self, rp src) { - return self.add_source(src.borrow()); - }) - .def("remove_source", - [](Reactor & self, rp src) { - return self.remove_source(src.borrow()); - }) - .def("run_one", &Reactor::run_one) - .def("run_n", &Reactor::run_n, py::arg("n")); - -#ifdef NOT_IN_USE // trying removed code in ProcessPy.cpp instead for now - /* prints - * std::pair - * pairs - */ - m.def("make_realization_printer", - [] - { - return new SinkToConsole>(); - }); - - py::class_>, - AbstractSink, - xo::rp>>> - (m, "SinkToConsole"); -#endif - } /*pyreactor*/ - } /*namespace reactor*/ -} /*namespace xo*/ - -/* end pyreactor.cpp */ diff --git a/.xo-pyreactor/src/pyreactor/pyreactor.hpp.in b/.xo-pyreactor/src/pyreactor/pyreactor.hpp.in deleted file mode 100644 index 140ded1b..00000000 --- a/.xo-pyreactor/src/pyreactor/pyreactor.hpp.in +++ /dev/null @@ -1,25 +0,0 @@ -/* @file pyreactor.hpp - * - * automatically generated from src/pyreflect/pyreactor.hpp.in - * see src/pyreactor/CMakeLists.txt - */ - -/* python requires module name = library name - * example: - * PYBIND11_MODULE(PYREACTOR_MODULE_NAME(), m) { ... } - */ -#define PYREACTOR_MODULE_NAME() @SELF_LIB@ - -/* example: - * py::module_::import(PYREACTOR_MODULE_NAME_STR) - */ -#define PYREACTOR_MODULE_NAME_STR "@SELF_LIB@" - -/* example: - * PYREACTOR_IMPORT_MODULE() - * replaces - * py::module_::import("pyreactor") - */ -#define PYREACTOR_IMPORT_MODULE() py::module_::import("@SELF_LIB@") - -/* end pyreactor.hpp */