diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e26b10d..77088fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,6 +37,7 @@ if (ROOT_FOUND) include(${ROOT_USE_FILE}) add_library(mana-plugin-root-histogram SHARED mana_plugin_root_histogram.cc) target_link_libraries(mana-plugin-root-histogram PRIVATE mana mesytec-mnode rxi-logc ${ROOT_LIBRARIES}) + target_compile_options(mana-plugin-root-histogram PRIVATE -DLOG_USE_COLOR) endif() if (pybind11_FOUND) diff --git a/src/internal/mana_c_api.h b/src/internal/mana_c_api.h index 18ea5b3..e9af781 100644 --- a/src/internal/mana_c_api.h +++ b/src/internal/mana_c_api.h @@ -65,9 +65,9 @@ extern "C" mana_process_system_event_t *process_system_event; } mana_sink_plugin_t; -// plugins need to define this function with the name 'mana_get_sink_plugin' -#define MANA_DEFINE_GET_PLUGIN(name) mana_sink_plugin_t name() - typedef MANA_DEFINE_GET_PLUGIN(mana_get_sink_plugin_t); +// use this to define the entry point into the plugin +// from c++: extern "C" MANA_C_SINK_PLUGIN() { ... return plugin; } +#define MANA_C_SINK_PLUGIN mana_sink_plugin_t mana_get_sink_plugin #ifdef __cplusplus } diff --git a/src/internal/mana_nng.h b/src/internal/mana_nng.h new file mode 100644 index 0000000..cb786ed --- /dev/null +++ b/src/internal/mana_nng.h @@ -0,0 +1,24 @@ +#ifndef CF5E5AFF_F218_4A25_95DF_8097D7C5685B +#define CF5E5AFF_F218_4A25_95DF_8097D7C5685B + +#include "mana_analysis.h" +#include + +namespace mesytec::mnode::mana +{ + +class NngServer: public IManaSink +{ + public: + explicit NngServer(nng_socket socket) + : socket_(socket) + { + } + + private: + nng_socket socket_; +}; + +} // namespace mesytec::mnode::mana + +#endif /* CF5E5AFF_F218_4A25_95DF_8097D7C5685B */ diff --git a/src/mana_plugin_c_test.c b/src/mana_plugin_c_test.c index d3c555f..645fdfd 100644 --- a/src/mana_plugin_c_test.c +++ b/src/mana_plugin_c_test.c @@ -44,7 +44,7 @@ MANA_DEFINE_PLUGIN_SYSTEM_EVENT(process_system_event) log_debug("system_event: ctx=%p, size=%zu", context, size); } -MANA_DEFINE_GET_PLUGIN(mana_get_sink_plugin) +MANA_C_SINK_PLUGIN() { mana_sink_plugin_t plugin; plugin.init = init; diff --git a/src/mana_plugin_python.cc b/src/mana_plugin_python.cc index 7b3530b..d8ebbe2 100644 --- a/src/mana_plugin_python.cc +++ b/src/mana_plugin_python.cc @@ -95,7 +95,7 @@ MANA_DEFINE_PLUGIN_SYSTEM_EVENT(process_system_event) auto ctx = reinterpret_cast(context); } -extern "C" MANA_DEFINE_GET_PLUGIN(mana_get_plugin) +extern "C" MANA_C_SINK_PLUGIN() { mana_sink_plugin_t plugin; plugin.init = init; diff --git a/src/mana_plugin_root_histogram.cc b/src/mana_plugin_root_histogram.cc index f0c8e08..11fdea0 100644 --- a/src/mana_plugin_root_histogram.cc +++ b/src/mana_plugin_root_histogram.cc @@ -219,7 +219,7 @@ MANA_DEFINE_PLUGIN_SYSTEM_EVENT(process_system_event) log_trace("system_event: ctx=%p, size=%zu", context, size); } -extern "C" MANA_DEFINE_GET_PLUGIN(mana_get_sink_plugin) +extern "C" MANA_C_SINK_PLUGIN() { mana_sink_plugin_t plugin; plugin.init = init;