RTI Routing Service  Version 6.1.0
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_
The top-level plug-in class.
Definition: AdapterPlugin.hpp:34
virtual rti::config::LibraryVersion get_version() const
Definition: AdapterPlugin.hpp:87
Listener representation used by StreamReader to notify RTI Routing Service when new data is available...
std::map< std::string, std::string > PropertySet
The definition of a pluggable entity’s configuration properties.
Definition: PropertySet.hpp:60
Definition: AdapterPlugin.hpp:25
virtual ~AdapterPlugin()
Virtual destructor.
Definition: AdapterPlugin.hpp:95
virtual void delete_connection(Connection *connection)=0
Deletes a Connection.
virtual Connection * create_connection(StreamReaderListener *input_stream_discovery_listener, StreamReaderListener *output_stream_discovery_listener, const PropertySet &properties)=0
Creates a Connection.
A Connection provides access to a data domain (such as a DDS domain or a JMS network provider)...
Definition: Connection.hpp:35