DomainParticipant.hpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. // Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @file DomainParticipant.hpp
  16. *
  17. */
  18. #ifndef _FASTDDS_DOMAIN_PARTICIPANT_HPP_
  19. #define _FASTDDS_DOMAIN_PARTICIPANT_HPP_
  20. #include <fastdds/dds/topic/TypeSupport.hpp>
  21. #include <fastdds/dds/topic/Topic.hpp>
  22. #include <fastrtps/types/TypeIdentifier.h>
  23. #include <fastdds/rtps/common/Guid.h>
  24. #include <fastdds/rtps/common/SampleIdentity.h>
  25. #include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
  26. #include <fastrtps/types/TypesBase.h>
  27. #include <fastdds/dds/core/status/StatusMask.hpp>
  28. #include <fastdds/dds/core/Entity.hpp>
  29. #include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
  30. #include <utility>
  31. using eprosima::fastrtps::types::ReturnCode_t;
  32. namespace dds {
  33. namespace domain {
  34. class DomainParticipant;
  35. }
  36. }
  37. namespace eprosima {
  38. namespace fastrtps {
  39. namespace rtps {
  40. class ResourceEvent;
  41. } // namespace rtps
  42. namespace types {
  43. class TypeInformation;
  44. } // namespace types
  45. class ParticipantAttributes;
  46. class PublisherAttributes;
  47. class SubscriberAttributes;
  48. } //namespace fastrtps
  49. namespace fastdds {
  50. namespace dds {
  51. class DomainParticipantImpl;
  52. class DomainParticipantListener;
  53. class Publisher;
  54. class PublisherQos;
  55. class PublisherListener;
  56. class Subscriber;
  57. class SubscriberQos;
  58. class SubscriberListener;
  59. class TopicQos;
  60. /**
  61. * Class DomainParticipant used to group Publishers and Subscribers into a single working unit.
  62. * @ingroup FASTDDS_MODULE
  63. */
  64. class DomainParticipant : public Entity
  65. {
  66. public:
  67. /**
  68. * This operation returns the value of the DomainParticipant QoS policies
  69. * @param qos DomainParticipantQos reference where the qos is going to be returned
  70. * @return RETCODE_OK
  71. */
  72. RTPS_DllAPI ReturnCode_t get_qos(
  73. DomainParticipantQos& qos) const;
  74. /**
  75. * @brief This operation returns the value of the DomainParticipant QoS policies
  76. * @return A reference to the DomainParticipantQos
  77. */
  78. RTPS_DllAPI const DomainParticipantQos& get_qos() const;
  79. /**
  80. * @brief This operation enables the DomainParticipant
  81. * @return RETCODE_OK
  82. */
  83. RTPS_DllAPI ReturnCode_t enable() override;
  84. /**
  85. * This operation sets the value of the DomainParticipant QoS policies.
  86. * @param qos DomainParticipantQos to be set
  87. * @return RETCODE_IMMUTABLE_POLICY if any of the Qos cannot be changed, RETCODE_INCONSISTENT_POLICY if the Qos is not
  88. * self consistent and RETCODE_OK if the qos is changed correctly.
  89. */
  90. RTPS_DllAPI ReturnCode_t set_qos(
  91. const DomainParticipantQos& qos) const;
  92. /**
  93. * Allows modifying the DomainParticipantListener.
  94. * @param listener
  95. * @return RETCODE_OK
  96. */
  97. RTPS_DllAPI ReturnCode_t set_listener(
  98. DomainParticipantListener* listener);
  99. /**
  100. * Allows accessing the DomainParticipantListener.
  101. * @return DomainParticipantListener pointer
  102. */
  103. RTPS_DllAPI const DomainParticipantListener* get_listener() const;
  104. /**
  105. * Create a Publisher in this Participant.
  106. * @param qos QoS of the Publisher.
  107. * @param listener Pointer to the listener (default: nullptr)
  108. * @param mask StatusMask that holds statuses the listener responds to (default: all)
  109. * @return Pointer to the created Publisher.
  110. */
  111. RTPS_DllAPI Publisher* create_publisher(
  112. const PublisherQos& qos,
  113. PublisherListener* listener = nullptr,
  114. const StatusMask& mask = StatusMask::all());
  115. /**
  116. * Create a Publisher in this Participant.
  117. * @param profile_name Publisher profile name.
  118. * @param listener Pointer to the listener (default: nullptr)
  119. * @param mask StatusMask that holds statuses the listener responds to (default: all)
  120. * @return Pointer to the created Publisher.
  121. */
  122. RTPS_DllAPI Publisher* create_publisher_with_profile(
  123. const std::string& profile_name,
  124. PublisherListener* listener = nullptr,
  125. const StatusMask& mask = StatusMask::all());
  126. /**
  127. * Deletes an existing Publisher.
  128. * @param publisher to be deleted.
  129. * @return RETCODE_PRECONDITION_NOT_MET if the publisher does not belong to this participant or if it has active DataWriters,
  130. * RETCODE_OK if it is correctly deleted and RETCODE_ERROR otherwise.
  131. */
  132. RTPS_DllAPI ReturnCode_t delete_publisher(
  133. Publisher* publisher);
  134. /**
  135. * Create a Subscriber in this Participant.
  136. * @param qos QoS of the Subscriber.
  137. * @param listener Pointer to the listener (default: nullptr)
  138. * @param mask StatusMask that holds statuses the listener responds to (default: all)
  139. * @return Pointer to the created Subscriber.
  140. */
  141. RTPS_DllAPI Subscriber* create_subscriber(
  142. const SubscriberQos& qos,
  143. SubscriberListener* listener = nullptr,
  144. const StatusMask& mask = StatusMask::all());
  145. /**
  146. * Create a Subscriber in this Participant.
  147. * @param profile_name Subscriber profile name.
  148. * @param listener Pointer to the listener (default: nullptr)
  149. * @param mask StatusMask that holds statuses the listener responds to (default: all)
  150. * @return Pointer to the created Subscriber.
  151. */
  152. RTPS_DllAPI Subscriber* create_subscriber_with_profile(
  153. const std::string& profile_name,
  154. SubscriberListener* listener = nullptr,
  155. const StatusMask& mask = StatusMask::all());
  156. /**
  157. * Deletes an existing Subscriber.
  158. * @param subscriber to be deleted.
  159. * @return RETCODE_PRECONDITION_NOT_MET if the subscriber does not belong to this participant or if it has active DataReaders,
  160. * RETCODE_OK if it is correctly deleted and RETCODE_ERROR otherwise.
  161. */
  162. RTPS_DllAPI ReturnCode_t delete_subscriber(
  163. Subscriber* subscriber);
  164. /**
  165. * Register a type in this participant.
  166. * @param type TypeSupport.
  167. * @param type_name The name that will be used to identify the Type.
  168. * @return RETCODE_BAD_PARAMETER if the size of the name is 0, RERCODE_PRECONDITION_NOT_MET if there is another TypeSupport
  169. * with the same name and RETCODE_OK if it is correctly registered.
  170. */
  171. RTPS_DllAPI ReturnCode_t register_type(
  172. TypeSupport type,
  173. const std::string& type_name);
  174. /**
  175. * Register a type in this participant.
  176. * @param type TypeSupport.
  177. * @return RETCODE_BAD_PARAMETER if the size of the name is 0, RERCODE_PRECONDITION_NOT_MET if there is another TypeSupport
  178. * with the same name and RETCODE_OK if it is correctly registered.
  179. */
  180. RTPS_DllAPI ReturnCode_t register_type(
  181. TypeSupport type);
  182. /**
  183. * Unregister a type in this participant.
  184. * @param typeName Name of the type
  185. * @return RETCODE_BAD_PARAMETER if the size of the name is 0, RERCODE_PRECONDITION_NOT_MET if there are entities using that
  186. * TypeSupport and RETCODE_OK if it is correctly unregistered.
  187. */
  188. RTPS_DllAPI ReturnCode_t unregister_type(
  189. const std::string& typeName);
  190. /**
  191. * Create a Topic in this Participant.
  192. * @param topic_name Name of the Topic.
  193. * @param type_name Data type of the Topic.
  194. * @param qos QoS of the Topic.
  195. * @param listener Pointer to the listener (default: nullptr)
  196. * @param mask StatusMask that holds statuses the listener responds to (default: all)
  197. * @return Pointer to the created Topic.
  198. */
  199. RTPS_DllAPI Topic* create_topic(
  200. const std::string& topic_name,
  201. const std::string& type_name,
  202. const TopicQos& qos,
  203. TopicListener* listener = nullptr,
  204. const StatusMask& mask = StatusMask::all());
  205. /**
  206. * Create a Topic in this Participant.
  207. * @param topic_name Name of the Topic.
  208. * @param type_name Data type of the Topic.
  209. * @param profile_name Topic profile name.
  210. * @param listener Pointer to the listener (default: nullptr)
  211. * @param mask StatusMask that holds statuses the listener responds to (default: all)
  212. * @return Pointer to the created Topic.
  213. */
  214. RTPS_DllAPI Topic* create_topic_with_profile(
  215. const std::string& topic_name,
  216. const std::string& type_name,
  217. const std::string& profile_name,
  218. TopicListener* listener = nullptr,
  219. const StatusMask& mask = StatusMask::all());
  220. /**
  221. * Deletes an existing Topic.
  222. * @param topic to be deleted.
  223. * @return RETCODE_BAD_PARAMETER if the topic passed is a nullptr, RETCODE_PRECONDITION_NOT_MET if the topic does not belong to
  224. * this participant or if it is referenced by any entity and ETCODE_OK if the Topic was deleted.
  225. */
  226. RTPS_DllAPI ReturnCode_t delete_topic(
  227. Topic* topic);
  228. /**
  229. * Looks up an existing, locally created @ref TopicDescription, based on its name.
  230. * May be called on a disabled participant.
  231. *
  232. * @param topic_name Name of the @ref TopicDescription to search for.
  233. *
  234. * @return Pointer to the topic description, if it has been created locally. Otherwise, nullptr is returned.
  235. *
  236. * @remark UNSAFE. It is unsafe to lookup a topic description while another thread is creating a topic.
  237. */
  238. RTPS_DllAPI TopicDescription* lookup_topicdescription(
  239. const std::string& topic_name) const;
  240. /* TODO
  241. Subscriber* get_builtin_subscriber();
  242. */
  243. /* TODO
  244. bool ignore_participant(
  245. const fastrtps::rtps::InstanceHandle_t& handle);
  246. */
  247. /* TODO
  248. bool ignore_topic(
  249. const fastrtps::rtps::InstanceHandle_t& handle);
  250. */
  251. /* TODO
  252. bool ignore_publication(
  253. const fastrtps::rtps::InstanceHandle_t& handle);
  254. */
  255. /* TODO
  256. bool ignore_subscription(
  257. const fastrtps::rtps::InstanceHandle_t& handle);
  258. */
  259. /**
  260. * This operation retrieves the domain_id used to create the DomainParticipant.
  261. * The domain_id identifies the DDS domain to which the DomainParticipant belongs.
  262. * @return The Participant's domain_id
  263. */
  264. RTPS_DllAPI DomainId_t get_domain_id() const;
  265. /* TODO
  266. bool delete_contained_entities();
  267. */
  268. /**
  269. * This operation manually asserts the liveliness of the DomainParticipant.
  270. * This is used in combination with the LIVELINESS QoS policy to indicate to the Service that the entity
  271. * remains active.
  272. *
  273. * This operation needs to only be used if the DomainParticipant contains DataWriter entities with
  274. * the LIVELINESS set to MANUAL_BY_PARTICIPANT and it only affects the liveliness of those DataWriter entities.
  275. * Otherwise, it has no effect.
  276. *
  277. * @note Writing data via the write operation on a DataWriter asserts liveliness on the DataWriter itself and its
  278. * DomainParticipant. Consequently the use of assert_liveliness is only needed if the application is not
  279. * writing data regularly.
  280. * @return RETCODE_OK if the liveliness was asserted, RETCODE_ERROR otherwise.
  281. */
  282. RTPS_DllAPI ReturnCode_t assert_liveliness();
  283. /**
  284. * This operation sets a default value of the Publisher QoS policies which will be used for newly created
  285. * Publisher entities in the case where the QoS policies are defaulted in the create_publisher operation.
  286. *
  287. * This operation will check that the resulting policies are self consistent; if they are not,
  288. * the operation will have no effect and return false.
  289. *
  290. * The special value PUBLISHER_QOS_DEFAULT may be passed to this operation to indicate that the default QoS
  291. * should be reset back to the initial values the factory would use, that is the values that would be used
  292. * if the set_default_publisher_qos operation had never been called.
  293. * @param qos PublisherQos to be set
  294. * @return RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.
  295. */
  296. RTPS_DllAPI ReturnCode_t set_default_publisher_qos(
  297. const PublisherQos& qos);
  298. /**
  299. * This operation retrieves the default value of the Publisher QoS, that is, the QoS policies which will be used
  300. * for newly created Publisher entities in the case where the QoS policies are defaulted in the
  301. * create_publisher operation.
  302. *
  303. * The values retrieved get_default_publisher_qos will match the set of values specified on the last successful
  304. * call to set_default_publisher_qos, or else, if the call was never made, the default values.
  305. * @return Current default publisher qos.
  306. */
  307. RTPS_DllAPI const PublisherQos& get_default_publisher_qos() const;
  308. /**
  309. * This operation retrieves the default value of the Publisher QoS, that is, the QoS policies which will be used
  310. * for newly created Publisher entities in the case where the QoS policies are defaulted in the
  311. * create_publisher operation.
  312. *
  313. * The values retrieved get_default_publisher_qos will match the set of values specified on the last successful
  314. * call to set_default_publisher_qos, or else, if the call was never made, the default values.
  315. * @param qos PublisherQos reference where the default_publisher_qos is returned
  316. * @return RETCODE_OK
  317. */
  318. RTPS_DllAPI ReturnCode_t get_default_publisher_qos(
  319. PublisherQos& qos) const;
  320. /**
  321. * This operation sets a default value of the Subscriber QoS policies that will be used for newly created
  322. * Subscriber entities in the case where the QoS policies are defaulted in the create_subscriber operation.
  323. *
  324. * This operation will check that the resulting policies are self consistent; if they are not,
  325. * the operation will have no effect and return false.
  326. *
  327. * The special value SUBSCRIBER_QOS_DEFAULT may be passed to this operation to indicate that the default QoS
  328. * should be reset back to the initial values the factory would use, that is the values that would be used
  329. * if the set_default_subscriber_qos operation had never been called.
  330. * @param qos SubscriberQos to be set
  331. * @return RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.
  332. */
  333. RTPS_DllAPI ReturnCode_t set_default_subscriber_qos(
  334. const SubscriberQos& qos);
  335. /**
  336. * This operation retrieves the default value of the Subscriber QoS, that is, the QoS policies which will be used
  337. * for newly created Subscriber entities in the case where the QoS policies are defaulted in the
  338. * create_subscriber operation.
  339. *
  340. * The values retrieved get_default_subscriber_qos will match the set of values specified on the last successful
  341. * call to set_default_subscriber_qos, or else, if the call was never made, the default values.
  342. * @return Current default subscriber qos.
  343. */
  344. RTPS_DllAPI const SubscriberQos& get_default_subscriber_qos() const;
  345. /**
  346. * This operation retrieves the default value of the Subscriber QoS, that is, the QoS policies which will be used
  347. * for newly created Subscriber entities in the case where the QoS policies are defaulted in the
  348. * create_subscriber operation.
  349. *
  350. * The values retrieved get_default_subscriber_qos will match the set of values specified on the last successful
  351. * call to set_default_subscriber_qos, or else, if the call was never made, the default values.
  352. * @param qos SubscriberQos reference where the default_subscriber_qos is returned
  353. * @return RETCODE_OK
  354. */
  355. RTPS_DllAPI ReturnCode_t get_default_subscriber_qos(
  356. SubscriberQos& qos) const;
  357. /**
  358. * This operation sets a default value of the Topic QoS policies which will be used for newly created
  359. * Topic entities in the case where the QoS policies are defaulted in the create_topic operation.
  360. *
  361. * This operation will check that the resulting policies are self consistent; if they are not, the operation
  362. * will have no effect and return INCONSISTENT_POLICY.
  363. *
  364. * The special value TOPIC_QOS_DEFAULT may be passed to this operation to indicate that the default QoS
  365. * should be reset back to the initial values the factory would use, that is the values that would be used
  366. * if the set_default_topic_qos operation had never been called.
  367. * @param qos TopicQos to be set
  368. * @return RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.
  369. */
  370. RTPS_DllAPI ReturnCode_t set_default_topic_qos(
  371. const TopicQos& qos);
  372. /**
  373. * This operation retrieves the default value of the Topic QoS, that is, the QoS policies that will be used
  374. * for newly created Topic entities in the case where the QoS policies are defaulted in the create_topic
  375. * operation.
  376. *
  377. * The values retrieved get_default_topic_qos will match the set of values specified on the last successful
  378. * call to set_default_topic_qos, or else, TOPIC_QOS_DEFAULT if the call was never made.
  379. * @return Current default topic qos.
  380. */
  381. RTPS_DllAPI const TopicQos& get_default_topic_qos() const;
  382. /**
  383. * This operation retrieves the default value of the Topic QoS, that is, the QoS policies that will be used
  384. * for newly created Topic entities in the case where the QoS policies are defaulted in the create_topic
  385. * operation.
  386. *
  387. * The values retrieved get_default_topic_qos will match the set of values specified on the last successful
  388. * call to set_default_topic_qos, or else, TOPIC_QOS_DEFAULT if the call was never made.
  389. * @param qos TopicQos reference where the default_topic_qos is returned
  390. * @return RETCODE_OK
  391. */
  392. RTPS_DllAPI ReturnCode_t get_default_topic_qos(
  393. TopicQos& qos) const;
  394. /* TODO
  395. bool get_discovered_participants(
  396. std::vector<fastrtps::rtps::InstanceHandle_t>& participant_handles) const;
  397. */
  398. /* TODO
  399. bool get_discovered_participant_data(
  400. ParticipantBuiltinTopicData& participant_data,
  401. const fastrtps::rtps::InstanceHandle_t& participant_handle) const;
  402. */
  403. /* TODO
  404. bool get_discovered_topics(
  405. std::vector<fastrtps::rtps::InstanceHandle_t>& topic_handles) const;
  406. */
  407. /* TODO
  408. bool get_discovered_topic_data(
  409. TopicBuiltinTopicData& topic_data,
  410. const fastrtps::rtps::InstanceHandle_t& topic_handle) const;
  411. */
  412. /**
  413. * This operation checks whether or not the given handle represents an Entity that was created from the
  414. * DomainParticipant.
  415. * @param handle InstanceHandle of the entity to look for.
  416. * @param recursive The containment applies recursively. That is, it applies both to entities
  417. * (TopicDescription, Publisher, or Subscriber) created directly using the DomainParticipant as well as
  418. * entities created using a contained Publisher, or Subscriber as the factory, and so forth. (default: true)
  419. * @return True if entity is contained. False otherwise.
  420. */
  421. RTPS_DllAPI bool contains_entity(
  422. const fastrtps::rtps::InstanceHandle_t& handle,
  423. bool recursive = true) const;
  424. /**
  425. * This operation returns the current value of the time that the service uses to time-stamp data-writes
  426. * and to set the reception-timestamp for the data-updates it receives.
  427. * @param current_time Time_t reference where the current time is returned
  428. * @return RETCODE_OK
  429. */
  430. RTPS_DllAPI ReturnCode_t get_current_time(
  431. fastrtps::Time_t& current_time) const;
  432. /**
  433. * This method gives access to a registered type based on its name.
  434. * @param type_name Name of the type
  435. * @return TypeSupport corresponding to the type_name
  436. */
  437. RTPS_DllAPI TypeSupport find_type(
  438. const std::string& type_name) const;
  439. /**
  440. * Returns the DomainParticipant's handle.
  441. * @return InstanceHandle of this DomainParticipant.
  442. */
  443. RTPS_DllAPI const fastrtps::rtps::InstanceHandle_t& get_instance_handle() const;
  444. // From here legacy RTPS methods.
  445. /**
  446. * @brief Getter for the Participant GUID
  447. * @return A reference to the GUID
  448. */
  449. RTPS_DllAPI const fastrtps::rtps::GUID_t& guid() const;
  450. /**
  451. * @brief Getter for the participant names
  452. * @return Vector with the names
  453. */
  454. RTPS_DllAPI std::vector<std::string> get_participant_names() const;
  455. /**
  456. * This method can be used when using a StaticEndpointDiscovery mechanism different that the one
  457. * included in FastRTPS, for example when communicating with other implementations.
  458. * It indicates the Participant that an Endpoint from the XML has been discovered and
  459. * should be activated.
  460. * @param partguid Participant GUID_t.
  461. * @param userId User defined ID as shown in the XML file.
  462. * @param kind EndpointKind (WRITER or READER)
  463. * @return True if correctly found and activated.
  464. */
  465. RTPS_DllAPI bool new_remote_endpoint_discovered(
  466. const fastrtps::rtps::GUID_t& partguid,
  467. uint16_t userId,
  468. fastrtps::rtps::EndpointKind_t kind);
  469. /**
  470. * @brief Getter for the resource event
  471. * @return A reference to the resource event
  472. */
  473. RTPS_DllAPI fastrtps::rtps::ResourceEvent& get_resource_event() const;
  474. /**
  475. * When a DomainParticipant receives an incomplete list of TypeIdentifiers in a
  476. * PublicationBuiltinTopicData or SubscriptionBuiltinTopicData, it may request the additional type
  477. * dependencies by invoking the getTypeDependencies operation.
  478. * @param in TypeIdentifier sequence
  479. * @return SampleIdentity
  480. */
  481. RTPS_DllAPI fastrtps::rtps::SampleIdentity get_type_dependencies(
  482. const fastrtps::types::TypeIdentifierSeq& in) const;
  483. /**
  484. * A DomainParticipant may invoke the operation getTypes to retrieve the TypeObjects associated with a
  485. * list of TypeIdentifiers.
  486. * @param in TypeIdentifier sequence
  487. * @return SampleIdentity
  488. */
  489. RTPS_DllAPI fastrtps::rtps::SampleIdentity get_types(
  490. const fastrtps::types::TypeIdentifierSeq& in) const;
  491. /**
  492. * Helps the user to solve all dependencies calling internally to the typelookup service
  493. * and registers the resulting dynamic type.
  494. * The registration will be perform asynchronously and the user will be notified through the
  495. * given callback, which receives the type_name as unique argument.
  496. * If the type is already registered, the function will return true, but the callback will not be called.
  497. * If the given type_information is enough to build the type without using the typelookup service,
  498. * it will return true and the callback will be never called.
  499. * @param type_information
  500. * @param type_name
  501. * @param callback
  502. * @return true if type is already available (callback will not be called). false if type isn't available yet
  503. * (the callback will be called if negotiation is success, and ignored in other case).
  504. */
  505. RTPS_DllAPI ReturnCode_t register_remote_type(
  506. const fastrtps::types::TypeInformation& type_information,
  507. const std::string& type_name,
  508. std::function<void(const std::string& name, const fastrtps::types::DynamicType_ptr type)>& callback);
  509. /**
  510. * @brief Destructor
  511. */
  512. RTPS_DllAPI virtual ~DomainParticipant();
  513. /**
  514. * @brief Check if the Participant has any Publisher, Subscriber or Topic
  515. * @return true if any, false otherwise.
  516. */
  517. bool has_active_entities();
  518. private:
  519. RTPS_DllAPI DomainParticipant(
  520. const StatusMask& mask = StatusMask::all());
  521. RTPS_DllAPI DomainParticipant(
  522. DomainId_t domain_id,
  523. const DomainParticipantQos& qos,
  524. DomainParticipantListener* listener,
  525. const StatusMask& mask = StatusMask::all());
  526. DomainParticipantImpl* impl_;
  527. friend class DomainParticipantFactory;
  528. friend class DomainParticipantImpl;
  529. friend class ::dds::domain::DomainParticipant;
  530. };
  531. } // namespace dds
  532. } // namespace fastdds
  533. } /* namespace eprosima */
  534. #endif /* _FASTDDS_DOMAIN_PARTICIPANT_HPP_ */