TopicQos.hpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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 TopicQos.hpp
  16. */
  17. #ifndef _FASTDDS_TOPICQOS_HPP
  18. #define _FASTDDS_TOPICQOS_HPP
  19. #include <fastdds/dds/core/policy/QosPolicies.hpp>
  20. #include <fastrtps/attributes/TopicAttributes.h>
  21. #include <fastdds/dds/log/Log.hpp>
  22. namespace eprosima {
  23. namespace fastdds {
  24. namespace dds {
  25. /**
  26. * Class TopicQos, containing all the possible Qos that can be set for a determined Topic.
  27. * Although these values can be set and are transmitted
  28. * during the Endpoint Discovery Protocol, not all of the behaviour associated with them has been implemented in the library.
  29. * Please consult each of them to check for implementation details and default values.
  30. * @ingroup FASTDDS_QOS_MODULE
  31. */
  32. class TopicQos
  33. {
  34. public:
  35. /**
  36. * @brief Constructor
  37. */
  38. RTPS_DllAPI TopicQos();
  39. bool operator ==(
  40. const TopicQos& b) const
  41. {
  42. return (this->topic_data_ == b.topic_data()) &&
  43. (this->durability_ == b.durability()) &&
  44. (this->durability_service_ == b.durability_service()) &&
  45. (this->deadline_ == b.deadline()) &&
  46. (this->latency_budget_ == b.latency_budget()) &&
  47. (this->liveliness_ == b.liveliness()) &&
  48. (this->reliability_ == b.reliability()) &&
  49. (this->destination_order_ == b.destination_order()) &&
  50. (this->history_ == b.history()) &&
  51. (this->resource_limits_ == b.resource_limits()) &&
  52. (this->transport_priority_ == b.transport_priority()) &&
  53. (this->lifespan_ == b.lifespan()) &&
  54. (this->ownership_ == b.ownership());
  55. }
  56. /**
  57. * Getter for TopicDataQosPolicy
  58. * @return TopicDataQos reference
  59. */
  60. const TopicDataQosPolicy& topic_data() const
  61. {
  62. return topic_data_;
  63. }
  64. /**
  65. * Getter for TopicDataQosPolicy
  66. * @return TopicDataQos reference
  67. */
  68. TopicDataQosPolicy& topic_data()
  69. {
  70. return topic_data_;
  71. }
  72. /**
  73. * Setter for TopicDataQosPolicy
  74. * @param value new value for the TopicDataQosPolicy
  75. */
  76. void topic_data(
  77. const TopicDataQosPolicy& value)
  78. {
  79. topic_data_ = value;
  80. }
  81. /**
  82. * Getter for DurabilityQosPolicy
  83. * @return DurabilityQos reference
  84. */
  85. const DurabilityQosPolicy& durability() const
  86. {
  87. return durability_;
  88. }
  89. /**
  90. * Getter for DurabilityQosPolicy
  91. * @return DurabilityQos reference
  92. */
  93. DurabilityQosPolicy& durability()
  94. {
  95. return durability_;
  96. }
  97. /**
  98. * Setter for DurabilityQosPolicy
  99. * @param durability new value for the DurabilityQosPolicy
  100. */
  101. void durability(
  102. const DurabilityQosPolicy& durability)
  103. {
  104. durability_ = durability;
  105. }
  106. /**
  107. * Getter for DurabilityServiceQosPolicy
  108. * @return DurabilityServiceQos reference
  109. */
  110. const DurabilityServiceQosPolicy& durability_service() const
  111. {
  112. return durability_service_;
  113. }
  114. /**
  115. * Getter for DurabilityServiceQosPolicy
  116. * @return DurabilityServiceQos reference
  117. */
  118. DurabilityServiceQosPolicy& durability_service()
  119. {
  120. return durability_service_;
  121. }
  122. /**
  123. * Setter for DurabilityServiceQosPolicy
  124. * @param durability_service new value for the DurabilityServiceQosPolicy
  125. */
  126. void durability_service(
  127. const DurabilityServiceQosPolicy& durability_service)
  128. {
  129. durability_service_ = durability_service;
  130. }
  131. /**
  132. * Getter for DeadlineQosPolicy
  133. * @return DeadlineQos reference
  134. */
  135. const DeadlineQosPolicy& deadline() const
  136. {
  137. return deadline_;
  138. }
  139. /**
  140. * Getter for DeadlineQosPolicy
  141. * @return DeadlineQos reference
  142. */
  143. DeadlineQosPolicy& deadline()
  144. {
  145. return deadline_;
  146. }
  147. /**
  148. * Setter for DeadlineQosPolicy
  149. * @param deadline new value for the DeadlineQosPolicy
  150. */
  151. void deadline(
  152. const DeadlineQosPolicy& deadline)
  153. {
  154. deadline_ = deadline;
  155. }
  156. /**
  157. * Getter for LatencyBudgetQosPolicy
  158. * @return LatencyBudgetQos reference
  159. */
  160. const LatencyBudgetQosPolicy& latency_budget() const
  161. {
  162. return latency_budget_;
  163. }
  164. /**
  165. * Getter for LatencyBudgetQosPolicy
  166. * @return LatencyBudgetQos reference
  167. */
  168. LatencyBudgetQosPolicy& latency_budget()
  169. {
  170. return latency_budget_;
  171. }
  172. /**
  173. * Setter for LatencyBudgetQosPolicy
  174. * @param latency_budget new value for the LatencyBudgetQosPolicy
  175. */
  176. void latency_budget(
  177. const LatencyBudgetQosPolicy& latency_budget)
  178. {
  179. latency_budget_ = latency_budget;
  180. }
  181. /**
  182. * Getter for LivelinessQosPolicy
  183. * @return LivelinessQos reference
  184. */
  185. const LivelinessQosPolicy& liveliness() const
  186. {
  187. return liveliness_;
  188. }
  189. /**
  190. * Getter for LivelinessQosPolicy
  191. * @return LivelinessQos reference
  192. */
  193. LivelinessQosPolicy& liveliness()
  194. {
  195. return liveliness_;
  196. }
  197. /**
  198. * Setter for LivelinessQosPolicy
  199. * @param liveliness new value for the LivelinessQosPolicy
  200. */
  201. void liveliness(
  202. const LivelinessQosPolicy& liveliness)
  203. {
  204. liveliness_ = liveliness;
  205. }
  206. /**
  207. * Getter for ReliabilityQosPolicy
  208. * @return ReliabilityQos reference
  209. */
  210. const ReliabilityQosPolicy& reliability() const
  211. {
  212. return reliability_;
  213. }
  214. /**
  215. * Getter for ReliabilityQosPolicy
  216. * @return ReliabilityQos reference
  217. */
  218. ReliabilityQosPolicy& reliability()
  219. {
  220. return reliability_;
  221. }
  222. /**
  223. * Setter for ReliabilityQosPolicy
  224. * @param reliability new value for the ReliabilityQosPolicy
  225. */
  226. void reliability(
  227. const ReliabilityQosPolicy& reliability)
  228. {
  229. reliability_ = reliability;
  230. }
  231. /**
  232. * Getter for DestinationOrderQosPolicy
  233. * @return DestinationOrderQos reference
  234. */
  235. const DestinationOrderQosPolicy& destination_order() const
  236. {
  237. return destination_order_;
  238. }
  239. /**
  240. * Getter for DestinationOrderQosPolicy
  241. * @return DestinationOrderQos reference
  242. */
  243. DestinationOrderQosPolicy& destination_order()
  244. {
  245. return destination_order_;
  246. }
  247. /**
  248. * Setter for DestinationOrderQosPolicy
  249. * @param destination_order new value for the DestinationOrderQosPolicy
  250. */
  251. void destination_order(
  252. const DestinationOrderQosPolicy& destination_order)
  253. {
  254. destination_order_ = destination_order;
  255. }
  256. /**
  257. * Getter for HistoryQosPolicy
  258. * @return HistoryQos reference
  259. */
  260. const HistoryQosPolicy& history() const
  261. {
  262. return history_;
  263. }
  264. /**
  265. * Getter for HistoryQosPolicy
  266. * @return HistoryQos reference
  267. */
  268. HistoryQosPolicy& history()
  269. {
  270. return history_;
  271. }
  272. /**
  273. * Setter for HistoryQosPolicy
  274. * @param history new value for the HistoryQosPolicy
  275. */
  276. void history(
  277. const HistoryQosPolicy& history)
  278. {
  279. history_ = history;
  280. }
  281. /**
  282. * Getter for ResourceLimitsQosPolicy
  283. * @return ResourceLimitsQos reference
  284. */
  285. const ResourceLimitsQosPolicy& resource_limits() const
  286. {
  287. return resource_limits_;
  288. }
  289. /**
  290. * Getter for ResourceLimitsQosPolicy
  291. * @return ResourceLimitsQos reference
  292. */
  293. ResourceLimitsQosPolicy& resource_limits()
  294. {
  295. return resource_limits_;
  296. }
  297. /**
  298. * Setter for ResourceLimitsQosPolicy
  299. * @param resource_limits new value for the ResourceLimitsQosPolicy
  300. */
  301. void resource_limits(
  302. const ResourceLimitsQosPolicy& resource_limits)
  303. {
  304. resource_limits_ = resource_limits;
  305. }
  306. /**
  307. * Getter for TransportPriorityQosPolicy
  308. * @return TransportPriorityQos reference
  309. */
  310. const TransportPriorityQosPolicy& transport_priority() const
  311. {
  312. return transport_priority_;
  313. }
  314. /**
  315. * Getter for TransportPriorityQosPolicy
  316. * @return TransportPriorityQos reference
  317. */
  318. TransportPriorityQosPolicy& transport_priority()
  319. {
  320. return transport_priority_;
  321. }
  322. /**
  323. * Setter for TransportPriorityQosPolicy
  324. * @param transport_priority new value for the TransportPriorityQosPolicy
  325. */
  326. void transport_priority(
  327. const TransportPriorityQosPolicy& transport_priority)
  328. {
  329. transport_priority_ = transport_priority;
  330. }
  331. /**
  332. * Getter for LifespanQosPolicy
  333. * @return LifespanQos reference
  334. */
  335. const LifespanQosPolicy& lifespan() const
  336. {
  337. return lifespan_;
  338. }
  339. /**
  340. * Getter for LifespanQosPolicy
  341. * @return LifespanQos reference
  342. */
  343. LifespanQosPolicy& lifespan()
  344. {
  345. return lifespan_;
  346. }
  347. /**
  348. * Setter for LifespanQosPolicy
  349. * @param lifespan new value for the LifespanQosPolicy
  350. */
  351. void lifespan(
  352. const LifespanQosPolicy& lifespan)
  353. {
  354. lifespan_ = lifespan;
  355. }
  356. /**
  357. * Getter for OwnershipQosPolicy
  358. * @return OwnershipQos reference
  359. */
  360. const OwnershipQosPolicy& ownership() const
  361. {
  362. return ownership_;
  363. }
  364. /**
  365. * Getter for OwnershipQosPolicy
  366. * @return OwnershipQos reference
  367. */
  368. OwnershipQosPolicy& ownership()
  369. {
  370. return ownership_;
  371. }
  372. /**
  373. * Setter for OwnershipQosPolicy
  374. * @param ownership new value for the OwnershipQosPolicy
  375. */
  376. void ownership(
  377. const OwnershipQosPolicy& ownership)
  378. {
  379. ownership_ = ownership;
  380. }
  381. /**
  382. * Getter for DataRepresentationQosPolicy
  383. * @return DataRepresentationQosPolicy reference
  384. */
  385. const DataRepresentationQosPolicy& representation() const
  386. {
  387. return representation_;
  388. }
  389. /**
  390. * Getter for DataRepresentationQosPolicy
  391. * @return DataRepresentationQosPolicy reference
  392. */
  393. DataRepresentationQosPolicy& representation()
  394. {
  395. return representation_;
  396. }
  397. /**
  398. * Setter for DataRepresentationQosPolicy
  399. * @param representation new value for the DataRepresentationQosPolicy
  400. */
  401. void representation(
  402. const DataRepresentationQosPolicy& representation)
  403. {
  404. representation_ = representation;
  405. }
  406. private:
  407. //!Topic Data Qos, NOT implemented in the library.
  408. TopicDataQosPolicy topic_data_;
  409. //!Durability Qos, implemented in the library.
  410. DurabilityQosPolicy durability_;
  411. //!Durability Service Qos, NOT implemented in the library.
  412. DurabilityServiceQosPolicy durability_service_;
  413. //!Deadline Qos, implemented in the library.
  414. DeadlineQosPolicy deadline_;
  415. //!Latency Budget Qos, NOT implemented in the library.
  416. LatencyBudgetQosPolicy latency_budget_;
  417. //!Liveliness Qos, implemented in the library.
  418. LivelinessQosPolicy liveliness_;
  419. //!Reliability Qos, implemented in the library.
  420. ReliabilityQosPolicy reliability_;
  421. //!Destination Order Qos, NOT implemented in the library.
  422. DestinationOrderQosPolicy destination_order_;
  423. //!History Qos, implemented in the library.
  424. HistoryQosPolicy history_;
  425. //!Resource Limits Qos, implemented in the library.
  426. ResourceLimitsQosPolicy resource_limits_;
  427. //!Transport Priority Qos, NOT implemented in the library.
  428. TransportPriorityQosPolicy transport_priority_;
  429. //!Lifespan Qos, implemented in the library.
  430. LifespanQosPolicy lifespan_;
  431. //!Ownership Qos, NOT implemented in the library.
  432. OwnershipQosPolicy ownership_;
  433. //!Data Representation Qos, (XTypes extension).
  434. DataRepresentationQosPolicy representation_;
  435. };
  436. RTPS_DllAPI extern const TopicQos TOPIC_QOS_DEFAULT;
  437. } // namespace dds
  438. } // namespace fastdds
  439. } // namespace eprosima
  440. #endif // _FASTDDS_TOPICQOS_HPP