RTI Cloud Discovery Service Version 7.3.0
Service.hpp
1
10#ifndef RTI_CDS_CLOUD_DISCOVERY_SERVICE_HPP_
11#define RTI_CDS_CLOUD_DISCOVERY_SERVICE_HPP_
12
13#include <dds/core/Reference.hpp>
14#include <rti/config/Logger.hpp>
15
16#include <rti/cds/Logger.hpp>
17#include <rti/cds/ServiceProperty.hpp>
18#include <rti/cds/detail/CloudDiscoveryServiceImpl.hpp>
19
20#include "routingservice/routingservice_service.h"
21#include "clouddiscoveryservice/clouddiscoveryservice_log.h"
22
23namespace rti { namespace cds {
24
25/*e \defgroup RTI_CDS_ServiceLibModule Library API
26 *
27 * @brief @product can be deployed as a native library linked into your
28 * application in select architectures.
29 *
30 * This API allows you to create, configure and start @product instances from
31 * your application.
32 *
33 * The following code shows the typical use of the API:
34 *
35 * \code
36 *
37 * int main ()
38 * {
39 * rti::cds::Service service(
40 * rti::cds::ServiceProperty()
41 * .cfg_file("MyCloudDiscoveryService.xml")
42 * .service_name("MyCloudDiscoveryService"));
43 * ...
44 *
45 * service.start();
46 *
47 * while (keep_running) {
48 * sleep();
49 * ...
50 * }
51 *
52 * return 0;
53 * }
54 *
55 * \endcode
56 *
57 * Instead of a file, you can use XML strings to configure @product.
58 * See ServiceProperty for more information.
59 * <p>
60 * To build your application you need to link with the @product native library
61 * in <b> &lt;@ndds home&gt;/bin/&lt;architecture&gt;/ </b>.
62 *
63 * An example is provided at <b>https://github.com/rticommunity/rticonnextdds-examples/tree/release/\connext_version/examples/cloud_discovery_service/library_api</b>.
64 *
65 * ### Development Requirements
66 *
67 * | | Linux Systems | Windows Systems |
68 * | ----------------------------: | :----------------------------: | :---------------------------: |
69 * | Link Libraries (Compile Time) | librticlouddiscoveryservice.so | rticlouddiscoveryservice.dll |
70 * | Shared Libraries (Run Time) | librtiroutingservice.so | rtiroutingservice.dll |
71 * | ^ | librtidlc.so | rtidlc.dll |
72 * | ^ | librticonnextmsgc.so | rticonnextmsgc.dll |
73 * | ^ | libnddsmetp.so | nddsmetp.dll |
74 * | ^ | librtiapputilsc.so | rtiapputilsc.dll |
75 * | ^ | librtixml2.so | rtixml2.dll |
76 * | ^ | libnddsc2.so | nddsc2.dll |
77 * | ^ | libnddsc.so | nddsc.dll |
78 * | ^ | libnddscore.so | nddscore.dll |
79 * | Static Libraries | librticlouddiscoveryservicez.a | rticlouddiscoveryservicez.lib |
80 * | ^ | librtiroutingservicez.a | rtiroutingservicez.lib |
81 * | ^ | librtidlcz.a | rtidlcz.lib |
82 * | ^ | librticonnextmsgcz.a | rticonnextmsgcz.lib |
83 * | ^ | libnddsmetpz.a | nddsmetpz.lib |
84 * | ^ | librtiapputilscz.a | rtiapputilscz.lib |
85 * | ^ | librtixml2z.a | rtixml2z.lib |
86 * | ^ | libnddsc2z.a | nddsc2z.lib |
87 * | ^ | libnddscz.a | nddscz.lib |
88 * | ^ | libnddscorez.a | nddscorez.lib |
89 * | Headers | rti/cds/CloudDiscoveryService.hpp | |
90 *
91 * <b>NOTE:</b> If you are using debug libraries, remember to add the 'd' suffix
92 * to the library name. For shared libraries on macOS systems, the library name
93 * is the same as that for Linux except the extension is '.dylib' instead of '.so'.
94 */
95
101class Service : public dds::core::Reference<CloudDiscoveryServiceImpl> {
102public:
103 typedef dds::core::Reference<CloudDiscoveryServiceImpl> Base;
104 OMG_DDS_REF_TYPE_NOTYPENAME(
105 Service,
106 dds::core::Reference,
107 CloudDiscoveryServiceImpl);
108
116 explicit Service(const ServiceProperty& property)
117 : Base(new CloudDiscoveryServiceImpl(property))
118 {
119 this->delegate()->remember_reference(this->delegate());
120 }
121
122 Service(const RTI_CDS_Property& property)
123 : Base(new CloudDiscoveryServiceImpl(property))
124 {
125 this->delegate()->remember_reference(this->delegate());
126 }
127
128 explicit Service(Base::DELEGATE_REF_T reference) : Base(reference)
129 {
130 if (this->delegate()) {
131 this->delegate()->remember_reference(this->delegate());
132 }
133 }
134
141 void start()
142 {
143 this->delegate()->start();
144 }
145
151 void stop()
152 {
153 this->delegate()->stop();
154 }
155
162 {
163 return this->delegate()->is_started();
164 }
165
178 const std::string rtps_psk_secret_passphrase)
179 {
180 return this->delegate()->update_rtps_psk_secret_passphrase(
181 rtps_psk_secret_passphrase);
182 }
183
188 static void finalize_globals()
189 {
190 rti::cds::Logger::instance().warn(
191 "Calling 'rti::cds::Service::finalize_globals()' is no "
192 "longer necessary and the function will be removed in future "
193 "versions");
194 }
195
196};
197
198} }
199
200#endif // RTI_CDS_CLOUD_DISCOVERY_SERVICE_HPP_
void warn(const std::string &msg)
Logs as message with WARNING level.
Definition: Logger.hpp:114
Configuration properties for a RTI Cloud Discovery Service object.
Definition: ServiceProperty.hpp:277
The RTI Cloud Discovery Service.
Definition: Service.hpp:101
void start()
Starts RTI Cloud Discovery Service.
Definition: Service.hpp:141
void stop()
Stops RTI Cloud Discovery Service.
Definition: Service.hpp:151
bool update_rtps_psk_secret_passphrase(const std::string rtps_psk_secret_passphrase)
Sets the dds.sec.crypto.rtps_psk_secret_passphrase property for the RTI Cloud Discovery Service insta...
Definition: Service.hpp:177
bool is_started()
Returns true if the RTI Cloud Discovery Service is started.
Definition: Service.hpp:161
static void finalize_globals()
Definition: Service.hpp:188
Service(const ServiceProperty &property)
Creates a RTI Cloud Discovery Service instance.
Definition: Service.hpp:116
Definition: CloudDiscoveryServiceImpl.hpp:20