better mana c api entry point definition
This commit is contained in:
parent
bbd52cbde0
commit
c82671490a
6 changed files with 31 additions and 6 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
24
src/internal/mana_nng.h
Normal file
24
src/internal/mana_nng.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef CF5E5AFF_F218_4A25_95DF_8097D7C5685B
|
||||
#define CF5E5AFF_F218_4A25_95DF_8097D7C5685B
|
||||
|
||||
#include "mana_analysis.h"
|
||||
#include <mesytec-mnode/mnode_nng.h>
|
||||
|
||||
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 */
|
|
@ -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;
|
||||
|
|
|
@ -95,7 +95,7 @@ MANA_DEFINE_PLUGIN_SYSTEM_EVENT(process_system_event)
|
|||
auto ctx = reinterpret_cast<Context *>(context);
|
||||
}
|
||||
|
||||
extern "C" MANA_DEFINE_GET_PLUGIN(mana_get_plugin)
|
||||
extern "C" MANA_C_SINK_PLUGIN()
|
||||
{
|
||||
mana_sink_plugin_t plugin;
|
||||
plugin.init = init;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue