The RTI Routing Service.
More...
#include <Service.hpp>
Inherits dds::core::Reference< RoutingServiceImpl >.
◆ Service() [1/2]
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:
struct FlagShutdownHook {
public:
FlagShutdownHook(bool& the_flag) : flag(the_flag)
{
flag = false;
}
void operator()() {
the_flag = true;
}
bool& flag;
};
bool my_flag;
FlagShutdownHook my_hook(my_flag)
property,
my_hook);
...
The RTI Routing Service.
Definition: Service.hpp:86
- Parameters
-
[in] | property | The property to configure RTI Routing Service instance. |
[in] | shutdown_hook | Callable 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.
◆ 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()
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:
service.attach_adapter_plugin(myAdapter, "MyAdapter");
service.start();
...
And our configuration would look like this:
<dds>
<!-- No need to register the plugin in
<plugin_library><adapter_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()
◆ attach_transformation_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().