RTI Routing Service  Version 6.0.1
 All Data Structures Files Functions Typedefs Enumerations Enumerator Groups Pages
AdapterPlugin.hpp
Go to the documentation of this file.
1 /*
2  * (c) Copyright, Real-Time Innovations, 2017.
3  * All rights reserved.
4  *
5  * No duplications, whole or partial, manual or electronic, may be made
6  * without express written permission. Any such copies, or
7  * revisions thereof, must display this notice unaltered.
8  * This code contains trade secrets of Real-Time Innovations, Inc.
9  */
10 
11 #ifndef RTI_ROUTING_ADAPTER_ADAPTER_HPP_
12 #define RTI_ROUTING_ADAPTER_ADAPTER_HPP_
13 
14 #include <map>
15 
16 #include "routingservice/routingservice_infrastructure.h"
17 #include <rti/config/Version.hpp>
18 #include <rti/routing/adapter/StreamReaderListener.hpp>
19 #include <rti/routing/adapter/Connection.hpp>
20 
25 namespace rti { namespace routing { namespace adapter {
26 
35 public:
59  virtual Connection * create_connection(
60  StreamReaderListener *input_stream_discovery_listener,
61  StreamReaderListener *output_stream_discovery_listener,
62  const PropertySet& properties) = 0;
63 
76  virtual void delete_connection(Connection *connection) = 0;
77 
87  virtual rti::config::LibraryVersion get_version() const
88  {
89  return rti::config::LibraryVersion();
90  }
91 
95  virtual ~AdapterPlugin() {}
96 };
97 
98 }}}
99 
100 #include <rti/routing/adapter/detail/AdapterForwarder.hpp>
101 
102 
167 #define RTI_ADAPTER_PLUGIN_CREATE_FUNCTION_DECL(ADAPTER_CLASS) \
168 extern "C" RTI_USER_DLL_EXPORT struct RTI_RoutingServiceAdapterPluginExt * \
169  ADAPTER_CLASS ## _create_adapter_plugin(\
170  const struct RTI_RoutingServiceProperties *, \
171  RTI_RoutingServiceEnvironment *); \
172 
173 
178 #define RTI_ADAPTER_PLUGIN_CREATE_FUNCTION_DEF(ADAPTER_CLASS) \
179 struct RTI_RoutingServiceAdapterPluginExt * ADAPTER_CLASS ## _create_adapter_plugin( \
180  const struct RTI_RoutingServiceProperties * native_properties, \
181  RTI_RoutingServiceEnvironment *environment) \
182 { \
183  PropertySet properties; \
184  rti::routing::PropertyAdapter::add_properties_from_native(\
185  properties,\
186  native_properties); \
187  try { \
188  return rti::routing::adapter::detail::AdapterForwarder::create_plugin(new ADAPTER_CLASS(properties)); \
189  } catch (const std::exception& ex) {\
190  RTI_RoutingServiceEnvironment_set_error(\
191  environment,\
192  "%s",\
193  ex.what());\
194  } catch (...) {}\
195  \
196  return NULL; \
197 }
198 
199 
200 
201 
202 #endif // RTI_ROUTING_ADAPTER_ADAPTER_HPP_

RTI Routing Service Version 6.0.1 Copyright © Sun Nov 17 2019 Real-Time Innovations, Inc