11 #ifndef RTI_ROUTING_PROCESSOR_PLUGIN_DETAIL_PROCESSOR_PLUGIN_FORWARDER_HPP_
12 #define RTI_ROUTING_PROCESSOR_PLUGIN_DETAIL_PROCESSOR_PLUGIN_FORWARDER_HPP_
14 #include <rti/core/Exception.hpp>
17 #include <rti/routing/processor/detail/ProcessorForwarder.hpp>
18 #include <rti/routing/detail/ForwarderUtils.hpp>
20 namespace rti {
namespace routing {
namespace processor {
namespace detail {
23 class ProcessorPluginForwarder {
26 static RTI_RoutingServiceProcessorPlugin * create_plugin(
27 ProcessorPlugin *plugin)
29 RTI_RoutingServiceProcessorPlugin *native_plugin = NULL;
30 RTIOsapiHeap_allocateStructure(
32 struct RTI_RoutingServiceProcessorPlugin);
33 rti::core::check_create_entity(
35 "RTI_RoutingServiceProcessorPlugin");
36 RTI_RoutingServiceProcessorPlugin_initialize(native_plugin);
39 rti::config::LibraryVersion version = plugin->get_version();
40 native_plugin->plugin_version.major = version.major_version();
41 native_plugin->plugin_version.minor = version.minor_version();
42 native_plugin->plugin_version.release = version.release_version();
45 native_plugin->processor_plugin_data =
46 static_cast<void *
>(plugin);
47 native_plugin->plugin_delete =
48 ProcessorPluginForwarder::delete_plugin;
49 native_plugin->create_processor =
50 ProcessorPluginForwarder::forward_create_processor;
51 native_plugin->delete_processor =
52 ProcessorPluginForwarder::forward_delete_processor;
57 static void delete_plugin(
58 RTI_RoutingServiceProcessorPlugin *native_plugin,
59 RTI_RoutingServiceEnvironment *)
61 ProcessorPlugin *plugin =
static_cast<ProcessorPlugin*
>(
62 native_plugin->processor_plugin_data);
65 RTIOsapiHeap_freeStructure(native_plugin);
69 static RTI_RoutingServiceProcessor * forward_create_processor(
70 void *native_plugin_data,
71 RTI_RoutingServiceRoute *native_route,
72 const struct RTI_RoutingServiceProperties *native_properties,
73 RTI_RoutingServiceEnvironment *environment)
75 return ProcessorForwarder::create_native(
76 static_cast<ProcessorPlugin *>(native_plugin_data),
83 static void forward_delete_processor(
84 void *native_plugin_data,
85 struct RTI_RoutingServiceProcessor *native_processor,
86 RTI_RoutingServiceRoute *,
87 RTI_RoutingServiceEnvironment *environment)
90 ProcessorForwarder::delete_native(
91 static_cast<ProcessorPlugin *>(native_plugin_data),
100 #endif // RTI_ROUTING_PROCESSOR_PLUGIN_DETAIL_PROCESSOR_PLUGIN_FORWARDER_HPP_