Adds immediate migration results

This commit is contained in:
torsten committed 2026-08-18 22:12:24 +02:00
1 parent ba4121728b
commit 6a2a0667ab
2395 files changed
+357322 -2524

No files matched your search

@@ -0,0 +1,223 @@
/**
* (c) Copyright, Real-Time Innovations, 2020. All rights reserved.
*
* No duplications, whole or partial, manual or electronic, may be made
* without express written permission. Any such copies, or
* revisions thereof, must display this notice unaltered.
* This code contains trade secrets of Real-Time Innovations, Inc.
*/
#ifndef RTI_CDS_LOGGER_HPP_
#define RTI_CDS_LOGGER_HPP_
#include <dds/core/Reference.hpp>
#include <rti/config/Logger.hpp>
#include "clouddiscoveryservice/clouddiscoveryservice_service.h"
#include "clouddiscoveryservice/clouddiscoveryservice_log.h"
namespace rti { namespace cds {
/** \defgroup RTI_CDS_Logger Logging
*
* @brief Provides control over the logging facilities for @product.
*/
/** \ingroup RTI_CDS_Logger
*
* @brief The singleton type used to configure @product verbosity
*
* For configuring other aspects such as output file, print format or
* RTI Connext specific logging, use rti::config::Logger.
*/
class Logger
{
public:
typedef rti::config::Verbosity Verbosity;
typedef rti::config::LogCategory LogCategory;
typedef rti::config::PrintFormat PrintFormat;
static Logger& instance()
{
static Logger singleton;
return singleton;
}
/**
* @brief Sets the verbosity for the log messages generated at the
* @product level.
*
* @param verbosity
* @rs_st_in The verbosity of the service logs
*/
void service_verbosity(rti::config::Verbosity verbosity)
{
NDDS_Config_Logger_set_verbosity_by_service(
NDDS_Config_Logger_get_instance(),
NDDS_CONFIG_LOG_SERVICE_CLOUD_DISCOVERY,
static_cast<NDDS_Config_LogVerbosity>(verbosity.underlying()));
}
/**
* @brief Getter for the same attribute
*
* @see service_verbosity(rti::config::Verbosity)
*/
rti::config::Verbosity service_verbosity()
{
RTILogBitmap instrumentation_mask =
NDDS_Config_Logger_get_verbosity_by_service(
NDDS_Config_Logger_get_instance(),
NDDS_CONFIG_LOG_SERVICE_CLOUD_DISCOVERY);
return static_cast<rti::config::Verbosity::type>(instrumentation_mask);
}
/**
* @brief Logs a message with EXCEPTION level
*
* The generated log will be part of logging stream of the running service
* if the service verbosity contains EXCEPTION messages. The result log
* message may include additional information according to the
* Connext logging configuration, such as Advlog Context, thread ID,
* line number, etc. Additionally, the result log message will contain a
* newline character at the end, so the format does not need to contain it.
*
* @param [in] msg Message to be logged
*/
void error(const std::string& msg)
{
this->error(msg.c_str());
}
/**
* @brief Overload of error(const std::string& msg)
*/
void error(const char *msg)
{
this->message(rti::config::LogLevel::EXCEPTION, msg);
}
/**
* @brief Logs as message with WARNING level
*
* This operation behaves similar to error() except the log level is
* WARNING.
*
* @param [in] msg Message to be logged
*
* @see rti::cds::Logger::error
*
*/
void warn(const std::string& msg)
{
this->warn(msg.c_str());
}
/**
* @brief Overload of warn(const std::string& msg)
*/
void warn(const char *msg)
{
this->message(rti::config::LogLevel::WARNING, msg);
}
/**
* @brief Logs as message with WARNING level
*
* This operation behaves similar to error() except the log level is
* STATUS_LOCAL.
*
* @param [in] msg Message to be logged
*
* @see rti::cds::Logger::error
*
*/
void local(const std::string& msg)
{
this->local(msg.c_str());
}
/**
* @brief Overload of local(const std::string& msg)
*/
void local(const char *msg)
{
this->message(rti::config::LogLevel::STATUS_LOCAL, msg);
}
/**
* @brief Logs a message with WARNING level
*
* This operation behaves similar to error() except the log level is
* STATUS_REMOTE.
*
* @param [in] msg Message to be logged
*
* @see rti::cds::Logger::error
*
*/
void remote(const std::string& msg)
{
this->remote(msg.c_str());
}
/**
* @brief Overload of remote(const std::string& msg)
*/
void remote(const char *msg)
{
this->message(rti::config::LogLevel::STATUS_REMOTE, msg);
}
/**
* @brief Logs as message with WARNING level
*
* This operation behaves similar to error() except the log level is
* STATUS_DEBUG.
*
* @param [in] msg Message to be logged
*
* @see rti::cds::Logger::error
*
*/
void debug(const std::string& msg)
{
this->debug(msg.c_str());
}
/**
* @brief Overload of debug(const std::string& msg)
*/
void debug(const char *msg)
{
this->message(rti::config::LogLevel::STATUS_ALL, msg);
}
virtual ~Logger()
{
}
private:
void message(const rti::config::LogLevel& level, const char* msg)
{
RTI_CDS_Logger_log(
static_cast<NDDS_Config_LogLevel>(level.underlying()),
"%s",
msg);
}
Logger()
{
}
// Disable copy
Logger(const Logger&);
Logger& operator=(const Logger&);
};
}}
#endif // RTI_CDS_LOGGER_HPP_
@@ -0,0 +1,14 @@
#ifndef RTI_CDS_PROPERTYSET_HPP
#define RTI_CDS_PROPERTYSET_HPP
#include <rti/routing/PropertySet.hpp>
namespace rti { namespace recording {
typedef rti::routing::PropertySet PropertySet;
}}
#endif /* RTI_CDS_PROPERTYSET_HPP */
@@ -0,0 +1,200 @@
/**
* (c) Copyright, Real-Time Innovations, 2020. All rights reserved.
*
* No duplications, whole or partial, manual or electronic, may be made
* without express written permission. Any such copies, or
* revisions thereof, must display this notice unaltered.
* This code contains trade secrets of Real-Time Innovations, Inc.
*/
#ifndef RTI_CDS_CLOUD_DISCOVERY_SERVICE_HPP_
#define RTI_CDS_CLOUD_DISCOVERY_SERVICE_HPP_
#include <dds/core/Reference.hpp>
#include <rti/config/Logger.hpp>
#include <rti/cds/Logger.hpp>
#include <rti/cds/ServiceProperty.hpp>
#include <rti/cds/detail/CloudDiscoveryServiceImpl.hpp>
#include "routingservice/routingservice_service.h"
#include "clouddiscoveryservice/clouddiscoveryservice_log.h"
namespace rti { namespace cds {
/*e \defgroup RTI_CDS_ServiceLibModule Library API
*
* @brief @product can be deployed as a native library linked into your
* application in select architectures.
*
* This API allows you to create, configure and start @product instances from
* your application.
*
* The following code shows the typical use of the API:
*
* \code
*
* int main ()
* {
* rti::cds::Service service(
* rti::cds::ServiceProperty()
* .cfg_file("MyCloudDiscoveryService.xml")
* .service_name("MyCloudDiscoveryService"));
* ...
*
* service.start();
*
* while (keep_running) {
* sleep();
* ...
* }
*
* return 0;
* }
*
* \endcode
*
* Instead of a file, you can use XML strings to configure @product.
* See ServiceProperty for more information.
* <p>
* To build your application you need to link with the @product native library
* in <b> &lt;@ndds home&gt;/bin/&lt;architecture&gt;/ </b>.
*
* An example is provided at <b>https://github.com/rticommunity/rticonnextdds-examples/tree/master/examples/cloud_discovery_service/library_api</b>.
*
* ### Development Requirements
*
* | | Linux Systems | Windows Systems |
* | ----------------------------: | :----------------------------: | :---------------------------: |
* | Link Libraries (Compile Time) | librticlouddiscoveryservice.so | rticlouddiscoveryservice.dll |
* | Shared Libraries (Run Time) | librtiroutingservice.so | rtiroutingservice.dll |
* | ^ | librtidlc.so | rtidlc.dll |
* | ^ | librticonnextmsgc.so | rticonnextmsgc.dll |
* | ^ | libnddsmetp.so | nddsmetp.dll |
* | ^ | librtiapputilsc.so | rtiapputilsc.dll |
* | ^ | librtixml2.so | rtixml2.dll |
* | ^ | libnddscpp2.so | nddscpp2.dll |
* | ^ | libnddsc.so | nddsc.dll |
* | ^ | libnddscore.so | nddscore.dll |
* | Static Libraries | librticlouddiscoveryservicez.a | rticlouddiscoveryservicez.lib |
* | ^ | librtiroutingservicez.a | rtiroutingservicez.lib |
* | ^ | librtidlcz.a | rtidlcz.lib |
* | ^ | librticonnextmsgcz.a | rticonnextmsgcz.lib |
* | ^ | libnddsmetpz.a | nddsmetpz.lib |
* | ^ | librtiapputilscz.a | rtiapputilscz.lib |
* | ^ | librtixml2z.a | rtixml2z.lib |
* | ^ | libnddscpp2z.a | nddscpp2z.lib |
* | ^ | libnddscz.a | nddscz.lib |
* | ^ | libnddscorez.a | nddscorez.lib |
* | Headers | rti/cds/CloudDiscoveryService.hpp | |
*
* <b>NOTE:</b> If you are using debug libraries, remember to add the 'd' suffix
* to the library name. For shared libraries on macOS systems, the library name
* is the same as that for Linux except the extension is '.dylib' instead of '.so'.
*/
/** \ingroup RTI_CDS_ServiceLibModule
*
* @brief The @product.
*
*/
class Service : public dds::core::Reference<CloudDiscoveryServiceImpl> {
public:
typedef dds::core::Reference<CloudDiscoveryServiceImpl> Base;
OMG_DDS_REF_TYPE_NOTYPENAME(
Service,
dds::core::Reference,
CloudDiscoveryServiceImpl);
/**
* @brief Creates a @product instance
*
* @param property
* @rs_st_in The property to configure @product instance.
*
*/
explicit Service(const ServiceProperty& property)
: Base(new CloudDiscoveryServiceImpl(property))
{
this->delegate()->remember_reference(this->delegate());
}
Service(const RTI_CDS_Property& property)
: Base(new CloudDiscoveryServiceImpl(property))
{
this->delegate()->remember_reference(this->delegate());
}
explicit Service(Base::DELEGATE_REF_T reference) : Base(reference)
{
if (this->delegate()) {
this->delegate()->remember_reference(this->delegate());
}
}
/**
* @brief Starts @product.
*
* This is a non-blocking operation. @product will create its own set of
* threads to perform its tasks.
*/
void start()
{
this->delegate()->start();
}
/**
* @brief Stops @product.
*
* This operation will block until the instance is fully stopped.
*/
void stop()
{
this->delegate()->stop();
}
/**
* @brief Returns true if the @product is started.
*
* This operation is useful to inspect if the @product instance is up and running.
*/
bool is_started()
{
return this->delegate()->is_started();
}
/**
* @brief Sets the dds.sec.crypto.rtps_psk_secret_passphrase property
* for the @product instance that is started.
*
* This operation performs an update; if there was no value for the
* dds.sec.crypto.rtps_psk_secret_passphrase property in the XML
* configuration when @product was started, the operation would fail.
*
* @param rtps_psk_secret_passphrase
* The new value for the dds.sec.crypto.rtps_psk_secret_passphrase property
*/
bool update_rtps_psk_secret_passphrase(
const std::string rtps_psk_secret_passphrase)
{
return this->delegate()->update_rtps_psk_secret_passphrase(
rtps_psk_secret_passphrase);
}
/**
* @deprecated Calling this function at the end of the application is no
* longer necessary. It will be removed in future versions.
*/
static void finalize_globals()
{
rti::cds::Logger::instance().warn(
"Calling 'rti::cds::Service::finalize_globals()' is no "
"longer necessary and the function will be removed in future "
"versions");
}
};
} }
#endif // RTI_CDS_CLOUD_DISCOVERY_SERVICE_HPP_
@@ -0,0 +1,678 @@
/**
* (c) Copyright, Real-Time Innovations, 2020. All rights reserved.
*
* No duplications, whole or partial, manual or electronic, may be made
* without express written permission. Any such copies, or
* revisions thereof, must display this notice unaltered.
* This code contains trade secrets of Real-Time Innovations, Inc.
*/
#ifndef RTI_CDS_CLOUD_DISCOVERY_SERVICE_PROPERTY_HPP_
#define RTI_CDS_CLOUD_DISCOVERY_SERVICE_PROPERTY_HPP_
/**
* IMPORTANT: macros.hpp must be the first RTI header included in every header
* file so that symbols are exported correctly on Windows
*/
#include <dds/core/macros.hpp>
#include <rti/core/NativeValueType.hpp>
#include "clouddiscoveryservice/clouddiscoveryservice_infrastructure.h"
#include "clouddiscoveryservice/clouddiscoveryservice_service.h"
namespace rti { namespace cds {
/** \ingroup RTI_CDS_ServiceLibModule
*
* @brief Specifies the list of domain IDs to allow or deny. Overrides XML
* configuration if specified.
*/
class DomainListProperty {
public:
DomainListProperty() : allow_domain_ids_(""), deny_domain_ids_("")
{
}
DomainListProperty(std::string allow_domain_ids, std::string deny_domain_ids)
{
allow_domain_ids_ = allow_domain_ids;
deny_domain_ids_ = deny_domain_ids;
}
/**
* @brief The list of domain IDs where @product processes the incoming
* participant announcements.
*
* @default Empty string. Use value from XML configuration.
*/
void allow_domain_ids(std::string allow_domain_ids)
{
allow_domain_ids_ = allow_domain_ids;
}
/**
* @brief Getter (see setter with the same name)
*/
std::string& allow_domain_ids()
{
return allow_domain_ids_;
}
/**
* @brief The list of domain IDs to deny or ignore. Overrides
* \ref allow_domain_ids.
*
* @default Empty string. Use value from XML configuration.
*/
void deny_domain_ids(std::string deny_domain_ids)
{
deny_domain_ids_ = deny_domain_ids;
}
/**
* @brief Getter (see setter with the same name)
*/
std::string& deny_domain_ids()
{
return deny_domain_ids_;
}
private:
std::string allow_domain_ids_;
std::string deny_domain_ids_;
};
/** \ingroup RTI_CDS_ServiceLibModule
*
* @brief Specifies the alias name of the transport to be used by @product for
* sending or receiving announcements. It also indicates the port where incoming
* participant announcements are received. Overrides XML configuration if specified.
*
* Refer to \ref_url_cloud_discovery_service_users_manual_available_transports to
* check the list of aliases for the preconfigured transports.
*/
class TransportUnicastProperty {
public:
TransportUnicastProperty(std::string alias, int receive_port)
{
alias_ = alias;
receive_port_ = receive_port;
}
/**
* @brief Transport alias name
*/
void alias(std::string alias)
{
alias_ = alias;
}
/**
* @brief Getter (see setter with the same name)
*/
std::string& alias()
{
return alias_;
}
/**
* @brief Receive port
*/
void receive_port(int receive_port)
{
receive_port_ = receive_port;
}
/**
* @brief Getter (see setter with the same name)
*/
int receive_port()
{
return receive_port_;
}
private:
std::string alias_;
int receive_port_;
};
class PropertyAdapter {
public:
typedef RTI_CDS_Property native_type;
static void initialize(native_type& native_value)
{
static const native_type DEFAULT
= RTI_CDS_Property_INITIALIZER;
native_value = DEFAULT;
// Replicating the defaults from the C Library API as specified in service.ifc
native_value.service_verbosity = RTI_LOG_BIT_EXCEPTION;
native_value.dds_verbosity = RTI_LOG_BIT_EXCEPTION;
}
static void finalize(native_type& native_value)
{
if (native_value.cfg_strings != NULL) {
RTIOsapiHeap_freeArray(native_value.cfg_strings);
native_value.cfg_strings = NULL;
}
RTI_CDS_Property_finalize(&native_value);
}
static void copy(native_type& destination, const native_type& source)
{
if (RTI_CDS_Property_copy(&destination, &source) == NULL) {
throw dds::core::Error("Native RTI_CDS_Property_copy");
}
}
static bool equals(const native_type& first, const native_type& second)
{
RTIOsapiUtility_unusedParameter(first);
RTIOsapiUtility_unusedParameter(second);
throw dds::core::UnsupportedError("Unsupported operation: equals");
}
static void add_transports_from_native(
std::vector<TransportUnicastProperty>& transport_selection,
const struct RTI_CDS_TransportSelectionProperty *transport_selection_native)
{
for (int i = 0; i < transport_selection_native->count; i++) {
transport_selection.push_back(TransportUnicastProperty(
transport_selection_native->transports[i].alias,
transport_selection_native->transports[i].receive_port));
}
}
static void add_transports_to_native(
struct RTI_CDS_TransportSelectionProperty *transport_selection_native,
std::vector<TransportUnicastProperty>& transport_selection)
{
transport_selection_native->count = transport_selection.size();
for (unsigned int i = 0; i < transport_selection.size(); i++) {
RTIOsapiUtility_strcpy(
transport_selection_native->transports[i].alias,
RTI_CDS_TRANSPORT_UNICAST_PROPERTY_ALIAS_LENGTH_MAX,
transport_selection[i].alias().c_str());
transport_selection_native->transports[i].receive_port
= transport_selection[i].receive_port();
}
}
static void add_domain_list_from_native(
DomainListProperty& domain_ids,
const struct RTI_CDS_DomainListProperty *domain_ids_native)
{
domain_ids.allow_domain_ids(domain_ids_native->allow_domain_ids);
domain_ids.deny_domain_ids(domain_ids_native->deny_domain_ids);
}
static void add_domain_list_to_native(
struct RTI_CDS_DomainListProperty *domain_ids_native,
DomainListProperty& domain_ids)
{
DDS_String_replace(
&domain_ids_native->allow_domain_ids,
domain_ids.allow_domain_ids().c_str());
DDS_String_replace(
&domain_ids_native->deny_domain_ids,
domain_ids.deny_domain_ids().c_str());
}
static void add_properties_from_native(
std::map<std::string, std::string>& properties,
const RTI_RoutingServiceProperties *native_properties)
{
for (int i = 0; i < native_properties->count; i++) {
properties[native_properties->properties[i].name] =
(const char *) native_properties->properties[i].value;
}
}
static void add_properties_to_native(
RTI_RoutingServiceProperties *native_properties,
const std::map<std::string, std::string>& properties)
{
RTI_RoutingServiceProperties_finalize(native_properties);
if (!RTI_RoutingServiceProperties_initialize(native_properties)) {
throw dds::core::Error("failed to initialize native property");
}
std::map<std::string, std::string>::const_iterator it = properties.begin();
for (; it != properties.end(); ++it) {
if (!RTI_RoutingServiceProperties_add(
native_properties,
it->first.c_str(),
it->second.c_str())) {
throw dds::core::Error("failed to add native property");
}
}
}
};
class ServiceProperty;
}
namespace core {
template<>
struct native_type_traits<rti::cds::ServiceProperty> {
typedef rti::cds::PropertyAdapter adapter_type;
typedef RTI_CDS_Property native_type;
};
}
namespace cds {
/** \ingroup RTI_CDS_ServiceLibModule
*
* @brief Configuration properties for a @product object.
*
*/
class ServiceProperty : public rti::core::NativeValueType<ServiceProperty>
{
public:
RTI_NATIVE_VALUE_TYPE_DEFINE_DEFAULT_MOVE_OPERATIONS(ServiceProperty)
typedef rti::core::NativeValueType<ServiceProperty> Base;
/**
* @brief Creates a property object with default settings.
*/
ServiceProperty(): Base()
{
}
ServiceProperty(const struct RTI_CDS_Property &native_property)
: Base(native_property)
{
}
/**
* @brief Getter (see setter with the same name)
*/
std::string cfg_file() const
{
return native().cfg_file == NULL ? "" : native().cfg_file;
}
/**
* @brief Path to an @product configuration file
*
* @default Empty string.
*/
ServiceProperty& cfg_file(const std::string& filename)
{
DDS_String_replace(
&native().cfg_file,
filename.c_str());
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
const std::vector<std::string>& cfg_strings() const
{
return cfg_strings_;
}
/**
* @brief XML configuration represented as strings
*
* An array of strings that altogether make up an
* XML document to configure @product. This parameter is used
* only if ServiceProperty::cfg_file is empty.
*
* The reason for using an array instead of one single string is to
* get around the limited size of literal strings.
* In general, if you create the XML string dynamically
* the vector needs only one element.
*
* @default Empty.
*/
ServiceProperty& cfg_strings(
const std::vector<std::string>& the_cfg_strings)
{
cfg_strings_ = the_cfg_strings;
if (cfg_strings_.size() > 0) {
if (!RTIOsapiHeap_reallocateArray(
(char ***) &native().cfg_strings,
cfg_strings_.size(),
char *)) {
throw dds::core::OutOfResourcesError("cfg_strings native array");
}
for (uint32_t i = 0; i < cfg_strings_.size(); i++) {
native().cfg_strings[i] = cfg_strings_[i].c_str();
}
}
native().cfg_strings_count = static_cast<int>(cfg_strings_.size());
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
std::string service_name() const
{
return native().service_name == NULL ? "" : native().service_name;
}
/**
* @brief The name of the @product configuration to run.
*
* This is the name used to find the &lt;cloud_discovery_service&gt;
* XML tag in the configuration file; this is the default name that will
* be used to refer to this execution in remote administration and
* monitoring if application_name isn't specified.
*
* @default Empty string.
*/
ServiceProperty& service_name(const std::string& name)
{
DDS_String_replace(&native().service_name, name.c_str());
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
std::string application_name() const
{
return native().application_name == NULL ? "" : native().application_name;
}
/**
* @brief Assigns a name to the execution of the RTI Cloud Discovery Service.
*
* Remote commands and status information will refer to the RTI Cloud Discovery
* Service using this name.
*
* \default service_name if this value is not set.
*/
ServiceProperty& application_name(const std::string& name)
{
DDS_String_replace(&native().application_name, name.c_str());
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
bool enforce_xsd_validation() const
{
return (native().enforce_xsd_validation == DDS_BOOLEAN_TRUE)
? true
: false;
}
/**
* @brief Controls whether the service applies XSD validation to the loaded
* configuration.
*
* @default true
*/
ServiceProperty& enforce_xsd_validation(const bool enforce_xsd_validation)
{
native().enforce_xsd_validation = enforce_xsd_validation;
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
bool skip_default_files() const
{
return (native().skip_default_files == DDS_BOOLEAN_TRUE)
? true
: false;
}
/**
* @brief Set it to true to avoid loading the
* standard files usually loaded by @product.
*
* Only the configuration in ServiceProperty::cfg_file or
* ServiceProperty::cfg_strings will be loaded.
*
* @default false
*/
ServiceProperty& skip_default_files(const bool& skip)
{
native().skip_default_files = skip
? DDS_BOOLEAN_TRUE
: DDS_BOOLEAN_FALSE;
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
std::vector<TransportUnicastProperty> transport_selection()
{
PropertyAdapter::add_transports_from_native(
transport_selection_,
&native().transport_selection);
return transport_selection_;
}
/**
* @brief Specifies the transport and receive ports used to receive and
* send discovery traffic. Specifically, a receive resource is uniquely
* specified by a transport class-receive port pair.
* Overrides XML configuration if specified.
*
* @default Unspecified. Use value from XML configuration.
*/
ServiceProperty& transport_selection(
const std::vector<TransportUnicastProperty>& transport_selection)
{
transport_selection_ = transport_selection;
PropertyAdapter::add_transports_to_native(
&native().transport_selection,
transport_selection_);
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
DomainListProperty domain_list()
{
PropertyAdapter::add_domain_list_from_native(
domain_list_,
&native().domain_list);
return domain_list_;
}
/**
* @brief Specifies the set of domain IDs the service will accept
* announcements from.
*
* @default Unspecified. Use value from XML configuration.
*/
ServiceProperty& domain_list(
const DomainListProperty& domain_list)
{
domain_list_ = domain_list;
PropertyAdapter::add_domain_list_to_native(
&native().domain_list,
domain_list_);
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
bool enable_administration() const
{
return (native().enable_administration == DDS_BOOLEAN_TRUE)
? true
: false;
}
/**
* @brief Set this to true to enable remote administration
* or false to disable it.
*
* @default false
*/
ServiceProperty& enable_administration(const bool enable)
{
native().enable_administration = enable
? DDS_BOOLEAN_TRUE
: DDS_BOOLEAN_FALSE;
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
int administration_domain_id() const
{
return native().administration_domain_id;
}
/**
* @brief If ServiceProperty::enable_administration is true, this is
* the domain ID to use for remote administration.
*
* Takes precedence over the XML configuration.
* If ServiceProperty::enable_administration is false, this value is not
* used even if remote administration is enabled in the XML configuration.
*
* @default 0
*/
ServiceProperty& administration_domain_id(const int domain_id)
{
native().administration_domain_id = domain_id;
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
bool enable_monitoring() const
{
return (native().enable_monitoring == DDS_BOOLEAN_TRUE)
? true
: false;
}
/**
* @brief Set this to true to enable monitoring or false to disable it.
*
* @default false
*/
ServiceProperty& enable_monitoring(const bool enable)
{
native().enable_monitoring = enable
? DDS_BOOLEAN_TRUE
: DDS_BOOLEAN_FALSE;
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
int monitoring_domain_id() const
{
return native().monitoring_domain_id;
}
/**
* @brief If ServiceProperty::enable_monitoring is true, this is
* the domain ID to use for publishing monitoring topics.
*
* Takes precedence over the XML configuration.
* If ServiceProperty::enable_monitoring is false, this value is not
* used even if monitoring is enabled in the XML configuration.
*
* @default 0
*/
ServiceProperty& monitoring_domain_id(const int domain_id)
{
native().monitoring_domain_id = domain_id;
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
std::string license_file_name() const
{
return native().license_file_name == NULL
? ""
: native().license_file_name;
}
/**
* @brief Path to an @product license file.
*
* If not empty, this file is checked for a valid license; otherwise,
* default location will be used. This parameter is only used if your
* installation requires a license file.
*
* @default empty string.
*/
ServiceProperty& license_file_name(const std::string& file_name)
{
DDS_String_replace(
&native().license_file_name,
file_name.c_str());
return *this;
}
/**
* @brief Getter (see setter with the same name)
*/
std::map<std::string, std::string> user_environment() const
{
std::map<std::string, std::string> properties;
PropertyAdapter::add_properties_from_native(
properties,
&native().user_environment);
return properties;
}
/**
* @brief Dictionary of user variables.
*
* The dictionary provides a parallel way to expand XML configuration
* variables in the form $(my_var), when they are not defined in the
* environment.
*
* @default empty
*/
ServiceProperty& user_environment(
const std::map<std::string, std::string>& user_environment)
{
PropertyAdapter::add_properties_to_native(
&native().user_environment,
user_environment);
return *this;
}
private:
std::vector<std::string> cfg_strings_;
std::vector<TransportUnicastProperty> transport_selection_;
DomainListProperty domain_list_;
};
}}
#endif // RTI_CDS_CLOUD_DISCOVERY_SERVICE_PROPERTY_HPP_
@@ -0,0 +1,86 @@
/**
* (c) Copyright, Real-Time Innovations, 2020. All rights reserved.
*
* No duplications, whole or partial, manual or electronic, may be made
* without express written permission. Any such copies, or
* revisions thereof, must display this notice unaltered.
* This code contains trade secrets of Real-Time Innovations, Inc.
*/
#ifndef RTI_CDS_CLOUD_DISCOVERY_SERVICE_IMPL_HPP_
#define RTI_CDS_CLOUD_DISCOVERY_SERVICE_IMPL_HPP_
#include <dds/core/refmacros.hpp>
#include <rti/core/detail/SelfReference.hpp>
#include <rti/core/Exception.hpp>
#include "clouddiscoveryservice/clouddiscoveryservice_service.h"
#include <rti/cds/ServiceProperty.hpp>
namespace rti { namespace cds {
class CloudDiscoveryServiceImpl
: public rti::core::detail::RetainableType<CloudDiscoveryServiceImpl>
{
public:
explicit CloudDiscoveryServiceImpl(const ServiceProperty& property)
{
native_ = RTI_CDS_Service_new(&property.native());
rti::core::check_create_entity(native_, "CloudDiscoveryService");
}
CloudDiscoveryServiceImpl(const RTI_CDS_Property& property) : native_(NULL)
{
native_ = RTI_CDS_Service_new(&property);
rti::core::check_create_entity(native_, "CloudDiscoveryService");
}
CloudDiscoveryServiceImpl(RTI_CDS_Service *native) : native_(native)
{
rti::core::check_create_entity(native_, "CloudDiscoveryService");
}
~CloudDiscoveryServiceImpl()
{
RTI_CDS_Service_delete(native_);
}
void start()
{
if (!RTI_CDS_Service_start(native_)) {
throw dds::core::Error("Error starting CloudDiscoveryService");
}
}
void stop()
{
if (!RTI_CDS_Service_stop(native_)) {
throw dds::core::Error("Error stopping CloudDiscoveryService");
}
}
bool is_started()
{
return RTI_CDS_Service_is_started(native_);
}
bool update_rtps_psk_secret_passphrase(
const std::string rtps_psk_secret_passphrase)
{
return RTI_CDS_Service_update_rtps_psk_secret_passphrase(
native_,
rtps_psk_secret_passphrase.c_str());
}
RTI_CDS_Service* native() const
{
return native_;
}
private:
RTI_CDS_Service *native_;
};
}}
#endif // RTI_CDS_CLOUD_DISCOVERY_SERVICE_IMPL_HPP_