RTI Routing Service Version 7.1.0
rti::routing::Service Class Reference

The RTI Routing Service. More...

#include <Service.hpp>

Inherits dds::core::Reference< RoutingServiceImpl >.

Public Member Functions

 Service (const ServiceProperty &property)
 Creates a RTI Routing Service instance. More...
 
template<typename HookFunc >
 Service (const ServiceProperty &property, HookFunc &shutdown_hook)
 Creates a RTI Routing Service instance. More...
 
void start ()
 Starts RTI Routing Service. More...
 
void stop ()
 Stops RTI Routing Service. More...
 
void attach_adapter_plugin (rti::routing::adapter::AdapterPlugin *adapter_plugin, const std::string &plugin_name)
 Attaches an Adapter plugin to be used by RTI Routing Service when it is started. More...
 
void attach_processor_plugin (rti::routing::processor::ProcessorPlugin *processor_plugin, const std::string &plugin_name)
 Attaches a Processor plugin to be used by RTI Routing Service when it is started. More...
 
void attach_transformation_plugin (rti::routing::transf::TransformationPlugin *transformation_plugin, const std::string &plugin_name)
 Attaches a Transformation plugin to be used by RTI Routing Service when it is started. More...
 

Static Public Member Functions

static void finalize_globals ()
 

Detailed Description

The RTI Routing Service.

Constructor & Destructor Documentation

◆ Service() [1/2]

rti::routing::Service::Service ( const ServiceProperty property)
inlineexplicit

Creates a RTI Routing Service instance.

Parameters
property<<in>> The property to configure RTI Routing Service instance.
Multi-threading safety:
On non-Linux, non-Windows systems (i.e. VxWorks): UNSAFE for multiple threads to simultaneously make the FIRST call to any of the Service constructors. Subsequent calls are thread safe. On Windows and Linux systems, these calls are thread-safe.

◆ Service() [2/2]

template<typename HookFunc >
rti::routing::Service::Service ( const ServiceProperty property,
HookFunc &  shutdown_hook 
)
inline

Creates a RTI Routing Service instance.

A callable shutdown hook can optionally be provided to handle the shutdown command received through remote administration. Upon reception of this command, RTI Routing Service will notify the installed hook.

The following example shows simple implementation of a shutdown hook that sets a boolean flag to true when invoked:

// Hook implmentation
struct FlagShutdownHook {
public:
FlagShutdownHook(bool& the_flag) : flag(the_flag)
{
flag = false;
}
void operator()() {
the_flag = true;
}
bool& flag;
};
// Instantiate service with hook
bool my_flag;
FlagShutdownHook my_hook(my_flag)
rti::routing::Service routing_service(
property,
my_hook);
...
The RTI Routing Service.
Definition: Service.hpp:86
Parameters
[in]propertyThe property to configure RTI Routing Service instance.
[in]shutdown_hookCallable object to handle the shutdown command. The expected type is a void operator()() (C++11 equivalent is std::function<void()>)
Multi-threading safety:
On non-Linux, non-Windows systems (i.e. VxWorks): UNSAFE for multiple threads to simultaneously make the FIRST call to any of the Service constructors. Subsequent calls are thread safe. On Windows and Linux systems, these calls are thread-safe.

Member Function Documentation

◆ start()

void rti::routing::Service::start ( )
inline

Starts RTI Routing Service.

This is a non-blocking operation. RTI Routing Service will create its own set of threads to perform its tasks.

◆ stop()

void rti::routing::Service::stop ( )
inline

Stops RTI Routing Service.

This operation will bloc the instance is fully stopped.

◆ attach_adapter_plugin()

void rti::routing::Service::attach_adapter_plugin ( rti::routing::adapter::AdapterPlugin adapter_plugin,
const std::string &  plugin_name 
)
inline

Attaches an Adapter plugin to be used by RTI Routing Service when it is started.

By using this function an adapter can be statically compiled, created in your application and have the service load it, instead of registering a shared library and a create function in the configuration.

The name passed in this function is the name that has to be used in the configuration to instantiate connections from the plugin.

Example:

rti::routing::RoutingService service(property);
service.attach_adapter_plugin(myAdapter, "MyAdapter");
service.start();
...

And our configuration would look like this:

<dds>
<!-- No need to register the plugin in
<adapter_library><adpater_plugin>
-->
<routing_service name="example">
<domain_route name="myadapter_to_dds">
<connection name="MyConnection" plugin_name="MyAdapter">
...
</connection>
...
</domain_route>
</routing_service>
</dds>

This function can be called as many times as desired to attach several plugins.

Precondition
Routing Service must not be started
Parameters
adapter_plugin<<in>> The adapter plugin object to be attached. The object shall remain alive during the execution of the service. Once the plugin is attached, the memory is owned by RTI Routing Service and will delete it upon service stop.
plugin_name<<in>> The name used for this plugin in the <connection> tag in the configuration.

◆ attach_processor_plugin()

void rti::routing::Service::attach_processor_plugin ( rti::routing::processor::ProcessorPlugin processor_plugin,
const std::string &  plugin_name 
)
inline

Attaches a Processor plugin to be used by RTI Routing Service when it is started.

See also
attach_adapter_plugin

◆ attach_transformation_plugin()

void rti::routing::Service::attach_transformation_plugin ( rti::routing::transf::TransformationPlugin transformation_plugin,
const std::string &  plugin_name 
)
inline

Attaches a Transformation plugin to be used by RTI Routing Service when it is started.

See also
attach_adapter_plugin

◆ finalize_globals()

static void rti::routing::Service::finalize_globals ( )
inlinestatic

[DEPRECATED] Calling this function at the end of the application is no longer necessary. It will be removed in future versions.

References rti::routing::Logger::warn().