11 #ifndef RTI_ROUTING_ROUTING_SERVICE_IMPL_HPP_
12 #define RTI_ROUTING_ROUTING_SERVICE_IMPL_HPP_
14 #include <dds/core/refmacros.hpp>
15 #include <rti/core/detail/SelfReference.hpp>
16 #include "routingservice/routingservice_adapter.h"
17 #include "routingservice/routingservice_service.h"
18 #include "routingservice/routingservice_log.h"
20 #include <rti/routing/ServiceProperty.hpp>
21 #include <rti/routing/adapter/detail/AdapterForwarder.hpp>
22 #include <rti/routing/transf/detail/TransformationPluginForwarder.hpp>
23 #include <rti/routing/processor/detail/ProcessorPluginForwarder.hpp>
26 namespace rti {
namespace routing {
28 class RoutingServiceImpl
29 :
public rti::core::detail::RetainableType<RoutingServiceImpl> {
31 explicit RoutingServiceImpl(
const ServiceProperty& property)
33 native_ = RTI_RoutingService_new(&property.native());
34 rti::core::check_create_entity(native_,
"RoutingService");
37 RoutingServiceImpl(
const RTI_RoutingServiceProperty& property)
40 native_ = RTI_RoutingService_new(&property);
41 rti::core::check_create_entity(native_,
"RoutingService");
44 RoutingServiceImpl(RTI_RoutingService *native)
47 rti::core::check_create_entity(native_,
"RoutingService");
52 RTI_RoutingService_delete(native_);
57 if (!RTI_RoutingService_start(native_)) {
58 throw dds::core::Error(
"failed to start RoutingService");
64 if (!RTI_RoutingService_stop(native_)) {
65 throw dds::core::Error(
"failed to stop RoutingService");
69 void attach_adapter_plugin(
71 const std::string& registered_name)
73 RTI_RoutingServiceAdapterPluginExt *native_plugin =
74 adapter::detail::AdapterForwarder::create_plugin(adapter_plugin);
75 if (!RTI_RoutingService_attach_adapter_plugin(
78 registered_name.c_str())) {
79 throw dds::core::Error(
"failed to attach native adapter");
83 void attach_transformation_plugin(
85 const std::string& registered_name)
87 RTI_RoutingServiceTransformationPlugin *native_plugin =
88 transf::detail::TransformationPluginForwarder::create_plugin(
89 transformation_plugin);
90 if (!RTI_RoutingService_attach_transformation_plugin(
93 registered_name.c_str())) {
94 throw dds::core::Error(
"failed to attach native transformation");
98 void attach_processor_plugin(
100 const std::string& registered_name)
102 RTI_RoutingServiceProcessorPlugin *native_plugin =
103 processor::detail::ProcessorPluginForwarder::create_plugin(
105 if (!RTI_RoutingService_attach_processor_plugin(
108 registered_name.c_str())) {
109 throw dds::core::Error(
"failed to attach native processor");
113 RTI_RoutingService* native()
const
118 static void finalize_globals()
120 if (!RTI_RoutingService_finalize_globals()) {
121 throw dds::core::Error(
"failed to finalize global state");
126 RTI_RoutingService *native_;
131 #endif // RTI_ROUTINGv_ROUTING_SERVICE_IMPL_HPP_