RTI Routing Service  Version 6.0.1
 All Data Structures Files Functions Typedefs Enumerations Enumerator Groups Pages
RoutingService.hpp
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_ROUTING_SERVICE_HPP_
12 #define RTI_ROUTING_ROUTING_SERVICE_HPP_
13 
14 #include <dds/core/Reference.hpp>
15 #include <rti/config/Logger.hpp>
16 
17 #include "routingservice/routingservice_adapter_new.h"
18 
19 #include <rti/routing/ServiceProperty.hpp>
20 #include <rti/routing/detail/RoutingServiceImpl.hpp>
23 
24 namespace rti { namespace routing {
25 
26 /*e \defgroup RTI_RoutingServiceLibModule RTI Routing Service API
27  * \ingroup ROUTER
28  *
29  * @brief @product can be deployed as a native library linked into your
30  * application in select architectures.
31  *
32  * This API allows you to create, configure and start @product instances from
33  * your application.
34  *
35  * The following code shows the typical use of the API:
36  *
37  * \code
38  *
39  * int main ()
40  * {
41  * rti::routing::RoutingService service(
42  * rti::routing::ServiceProperty()
43  * .cfg_file("MyRouter.xml")
44  * .cfg_name("MyRouter"));
45  * ...
46  *
47  * service.start();
48  *
49  * while(keep_running) {
50  * sleep();
51  * ...
52  * }
53  *
54  * return 0;
55  * }
56  *
57  * \endcode
58  *
59  * Instead of a file, you can use XML strings to configure @product.
60  * See ServiceProperty for more information.
61  * <p>
62  * To build your application you need to link with the @product native library
63  * in <b> &lt;@ndds home&gt;/bin/&lt;architecture&gt;/ </b>.
64  *
65  * ### Development Requirements
66  *
67  * | | Unix-based Systems | Windows Systems |
68  * | --------------: | :----------------: | :-------------: |
69  * | Shared Libraries| libnddscpp2.so | nddscpp2.dll |
70  * | ^ | librtirsinfrastructure.so | rtirsinfrastructure.dll |
71  * | ^ | librtidlc.so | rtidlc.dll |
72  * | ^ | libnddsmetp.so | nddsmetp.dll |
73  * | ^ | libnddsc.so | nddsc.dll |
74  * | ^ | librtixml2.so | rtixml2.dll |
75  * | ^ | libnddscore.so | nddscore.dll |
76  * | Headers | rti/routing/RoutingService.hpp ||
77  *
78  */
79 
85 class RoutingService : public dds::core::Reference<RoutingServiceImpl> {
86 public:
87  typedef dds::core::Reference<RoutingServiceImpl> Base;
88  OMG_DDS_REF_TYPE_NOTYPENAME(
90  dds::core::Reference,
91  RoutingServiceImpl);
92 
100  explicit RoutingService(const ServiceProperty& property)
101  : Base(new RoutingServiceImpl(property))
102  {
103  this->delegate()->remember_reference(this->delegate());
104  }
105 
106  RoutingService(const RTI_RoutingServiceProperty& property)
107  : Base(new RoutingServiceImpl(property))
108  {
109  this->delegate()->remember_reference(this->delegate());
110  }
111 
112  explicit RoutingService(Base::DELEGATE_REF_T reference) : Base(reference)
113  {
114  if (this->delegate()) {
115  this->delegate()->remember_reference(this->delegate());
116  }
117  }
118 
125  void start()
126  {
127  this->delegate()->start();
128  }
129 
135  void stop()
136  {
137  this->delegate()->stop();
138  }
139 
203  rti::routing::adapter::AdapterPlugin *adapter_plugin,
204  const std::string& plugin_name)
205  {
206  this->delegate()->attach_adapter_plugin(
207  adapter_plugin,
208  plugin_name);
209  }
210 
219  const std::string& plugin_name)
220  {
221  this->delegate()->attach_processor_plugin(
222  processor_plugin,
223  plugin_name);
224  }
225 
233  rti::routing::transf::TransformationPlugin *transformation_plugin,
234  const std::string& plugin_name)
235  {
236  this->delegate()->attach_transformation_plugin(
237  transformation_plugin,
238  plugin_name);
239  }
240 
241 
258  static void finalize_globals()
259  {
260  RoutingServiceImpl::finalize_globals();
261  }
262 
263 };
264 
272 class Logger
273 {
274 public:
275 
276  typedef rti::config::Verbosity Verbosity;
277  typedef rti::config::LogCategory LogCategory;
278  typedef rti::config::LoggerMode LoggerMode;
279  typedef rti::config::PrintFormat PrintFormat;
280 
281  static Logger& instance()
282  {
283  static Logger singleton;
284  return singleton;
285  }
286 
294  void service_verbosity(rti::config::Verbosity verbosity)
295  {
296  RTILogBitmap submodule_mask = ROUTER_SUBMODULE_MASK_ALL;
297  ROUTERLog_setBitmaps(
298  submodule_mask,
299  static_cast<RTILogBitmap>(verbosity.underlying()));
300  }
301 
307  rti::config::Verbosity service_verbosity()
308  {
309  RTILogBitmap submodule_mask = ROUTER_SUBMODULE_MASK_ALL;
310  RTILogBitmap instrumentation_mask = ROUTER_SUBMODULE_MASK_ALL;
311  ROUTERLog_getBitmaps(&submodule_mask, &instrumentation_mask);
312 
313  return static_cast<rti::config::Verbosity::type>(instrumentation_mask);
314  }
315 
316  virtual ~Logger()
317  {
318  }
319 
320 private:
321 
322  Logger()
323  {
324  }
325  // Disable copy
326  Logger(const Logger&);
327  Logger& operator=(const Logger&);
328 };
329 
330 }}
331 
332 #endif // RTI_ROUTING_ROUTING_SERVICE_HPP_

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