11 #ifndef RTI_ROUTING_ADAPTER_DETAIL_ADAPTER_FORWARDER_HPP_
12 #define RTI_ROUTING_ADAPTER_DETAIL_ADAPTER_FORWARDER_HPP_
14 #include <rti/core/Exception.hpp>
16 #include <routingservice/routingservice_adapter_new.h>
19 #include <rti/routing/adapter/detail/ConnectionForwarder.hpp>
21 namespace rti {
namespace routing {
namespace adapter {
namespace detail {
24 class AdapterForwarder {
26 static RTI_RoutingServiceAdapterPluginExt * create_plugin(
27 AdapterPlugin *adapter_plugin)
29 RTI_RoutingServiceAdapterPluginExt *native_adapter = NULL;
30 RTIOsapiHeap_allocateStructure(
32 struct RTI_RoutingServiceAdapterPluginExt);
33 rti::core::check_create_entity(
35 "RTI_RoutingServiceAdapterPluginExt");
36 RTI_RoutingServiceAdapterPluginExt_initialize(native_adapter);
39 rti::config::LibraryVersion version = adapter_plugin->get_version();
40 native_adapter->plugin_version.major = version.major_version();
41 native_adapter->plugin_version.minor = version.minor_version();
42 native_adapter->plugin_version.release = version.release_version();
45 native_adapter->adapter_plugin_data =
46 static_cast<void *
>(adapter_plugin);
47 native_adapter->plugin_delete =
48 AdapterForwarder::delete_plugin;
49 native_adapter->create_connection =
50 AdapterForwarder::create_connection;
51 native_adapter->delete_connection =
52 AdapterForwarder::delete_connection;
55 return native_adapter;
58 static void delete_plugin(
59 RTI_RoutingServiceAdapterPluginExt *native_adapter,
60 RTI_RoutingServiceEnvironment *)
62 AdapterPlugin *adapter =
static_cast<AdapterPlugin *
>(
63 native_adapter->adapter_plugin_data);
66 RTIOsapiHeap_freeStructure(native_adapter);
69 static RTI_RoutingServiceConnectionExt* create_connection(
70 void *native_adapter_data,
71 const char *routing_service_name,
72 const char *routing_service_group_name,
73 const RTI_RoutingServiceStreamReaderListenerExt *native_output_stream_listener,
74 const RTI_RoutingServiceStreamReaderListenerExt *native_input_stream_listener,
75 const RTI_RoutingServiceTypeInfo **registered_types,
76 int registered_type_count,
77 const RTI_RoutingServiceProperties *native_properties,
78 RTI_RoutingServiceEnvironment *environment)
80 return ConnectionForwarder::create_native(
81 static_cast<AdapterPlugin *>(native_adapter_data),
83 routing_service_group_name,
84 native_output_stream_listener,
85 native_input_stream_listener,
87 registered_type_count,
92 static void delete_connection(
93 void *native_adapter_data,
94 RTI_RoutingServiceConnectionExt *native_connection,
95 RTI_RoutingServiceEnvironment *environment)
97 ConnectionForwarder::delete_native(
98 static_cast<AdapterPlugin *>(native_adapter_data),
108 #endif // RTI_ROUTING_ADAPTER_DETAIL_ADAPTER_FORWARDER_HPP_