WriteParams.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // Copyright 2016 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 WriteParams.h
  16. */
  17. #ifndef _FASTDDS_RTPS_COMMON_WRITEPARAMS_H_
  18. #define _FASTDDS_RTPS_COMMON_WRITEPARAMS_H_
  19. #include <fastdds/rtps/common/SampleIdentity.h>
  20. #include <chrono>
  21. namespace eprosima
  22. {
  23. namespace fastrtps
  24. {
  25. namespace rtps
  26. {
  27. /*!
  28. * @brief This class contains additional information of a CacheChange.
  29. * @ingroup COMMON_MODULE
  30. */
  31. class RTPS_DllAPI WriteParams
  32. {
  33. public:
  34. /*!
  35. * @brief Default constructor.
  36. */
  37. WriteParams() = default;
  38. /*!
  39. * @brief Copy constructor.
  40. */
  41. WriteParams(const WriteParams &wparam)
  42. : sample_identity_(wparam.sample_identity_)
  43. , related_sample_identity_(wparam.related_sample_identity_)
  44. {
  45. }
  46. /*!
  47. * @brief Move constructor.
  48. */
  49. WriteParams(WriteParams &&wparam)
  50. : sample_identity_(std::move(wparam.sample_identity_))
  51. , related_sample_identity_(std::move(wparam.related_sample_identity_))
  52. {
  53. }
  54. /*!
  55. * @brief Assignment operator
  56. */
  57. WriteParams& operator=(const WriteParams &wparam)
  58. {
  59. sample_identity_ = wparam.sample_identity_;
  60. related_sample_identity_ = wparam.related_sample_identity_;
  61. return *this;
  62. }
  63. /*!
  64. * @brief Assignment operator
  65. */
  66. WriteParams& operator=(WriteParams &&wparam)
  67. {
  68. sample_identity_ = std::move(wparam.sample_identity_);
  69. related_sample_identity_ = std::move(wparam.related_sample_identity_);
  70. return *this;
  71. }
  72. WriteParams& sample_identity(const SampleIdentity &sample_id)
  73. {
  74. sample_identity_ = sample_id;
  75. return *this;
  76. }
  77. WriteParams& sample_identity(SampleIdentity &&sample_id)
  78. {
  79. sample_identity_ = std::move(sample_id);
  80. return *this;
  81. }
  82. const SampleIdentity& sample_identity() const
  83. {
  84. return sample_identity_;
  85. }
  86. SampleIdentity& sample_identity()
  87. {
  88. return sample_identity_;
  89. }
  90. WriteParams& related_sample_identity(const SampleIdentity &sample_id)
  91. {
  92. related_sample_identity_ = sample_id;
  93. return *this;
  94. }
  95. WriteParams& related_sample_identity(SampleIdentity &&sample_id)
  96. {
  97. related_sample_identity_ = std::move(sample_id);
  98. return *this;
  99. }
  100. const SampleIdentity& related_sample_identity() const
  101. {
  102. return related_sample_identity_;
  103. }
  104. SampleIdentity& related_sample_identity()
  105. {
  106. return related_sample_identity_;
  107. }
  108. static WriteParams WRITE_PARAM_DEFAULT;
  109. private:
  110. SampleIdentity sample_identity_;
  111. SampleIdentity related_sample_identity_;
  112. };
  113. } //namespace rtps
  114. } //namespace fastrtps
  115. } //namespace eprosima
  116. #endif //_FASTDDS_RTPS_COMMON_WRITEPARAMS_H_