/** * (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 #include #include #include #include #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. *

* To build your application you need to link with the @product native library * in <@ndds home>/bin/<architecture>/ . * * An example is provided at https://github.com/rticommunity/rticonnextdds-examples/tree/master/examples/cloud_discovery_service/library_api. * * ### 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 | | * * NOTE: 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 { public: typedef dds::core::Reference 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_