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>
18#include <rti/routing/adapter/detail/ConnectionForwarder.hpp>
20namespace rti {
namespace routing {
namespace adapter {
namespace detail {
23class AdapterForwarder {
25 static RTI_RoutingServiceAdapterPluginExt * create_plugin(
26 AdapterPlugin *adapter_plugin)
28 RTI_RoutingServiceAdapterPluginExt *native_adapter = NULL;
29 RTIOsapiHeap_allocateStructure(
31 struct RTI_RoutingServiceAdapterPluginExt);
32 rti::core::check_create_entity(
34 "RTI_RoutingServiceAdapterPluginExt");
35 RTI_RoutingServiceAdapterPluginExt_initialize(native_adapter);
38 rti::config::LibraryVersion version = adapter_plugin->get_version();
39 native_adapter->plugin_version.major = version.major_version();
40 native_adapter->plugin_version.minor = version.minor_version();
41 native_adapter->plugin_version.release = version.release_version();
44 native_adapter->adapter_plugin_data =
45 static_cast<void *
>(adapter_plugin);
46 native_adapter->plugin_delete =
47 AdapterForwarder::delete_plugin;
48 native_adapter->create_connection =
49 AdapterForwarder::create_connection;
50 native_adapter->delete_connection =
51 AdapterForwarder::delete_connection;
54 return native_adapter;
57 static void delete_plugin(
58 void *native_adapter_data,
59 RTI_RoutingServiceEnvironment *)
61 RTI_RoutingServiceAdapterPluginExt *native_adapter =
62 static_cast<RTI_RoutingServiceAdapterPluginExt *
>(
64 AdapterPlugin *adapter =
static_cast<AdapterPlugin *
>(
65 native_adapter->adapter_plugin_data);
68 RTIOsapiHeap_freeStructure(native_adapter);
71 static RTI_RoutingServiceConnectionExt* create_connection(
72 void *native_adapter_data,
73 const char *routing_service_name,
74 const char *routing_service_group_name,
75 const RTI_RoutingServiceStreamReaderListenerExt *native_output_stream_listener,
76 const RTI_RoutingServiceStreamReaderListenerExt *native_input_stream_listener,
77 const RTI_RoutingServiceTypeInfo **registered_types,
78 int registered_type_count,
79 const RTI_RoutingServiceProperties *native_properties,
80 RTI_RoutingServiceEnvironment *environment)
82 return ConnectionForwarder::create_native(
83 static_cast<AdapterPlugin *
>(native_adapter_data),
85 routing_service_group_name,
86 native_output_stream_listener,
87 native_input_stream_listener,
89 registered_type_count,
94 static void delete_connection(
95 void *native_adapter_data,
96 RTI_RoutingServiceConnectionExt *native_connection,
97 RTI_RoutingServiceEnvironment *environment)
99 ConnectionForwarder::delete_native(
100 static_cast<AdapterPlugin *
>(native_adapter_data),