SampleInfo.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Copyright 2020 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 SampleInfo.hpp
  16. *
  17. */
  18. #ifndef _FASTRTPS_SAMPLEINFO_HPP_
  19. #define _FASTRTPS_SAMPLEINFO_HPP_
  20. #include <fastdds/rtps/common/Types.h>
  21. #include <fastdds/rtps/common/Time_t.h>
  22. #include <fastdds/rtps/common/InstanceHandle.h>
  23. #include <fastdds/rtps/common/SampleIdentity.h>
  24. namespace eprosima {
  25. namespace fastdds {
  26. namespace dds {
  27. enum SampleStateKind
  28. {
  29. READ,
  30. NOT_READ
  31. };
  32. enum ViewStateKind
  33. {
  34. NEW,
  35. NOT_NEW
  36. };
  37. enum InstanceStateKind
  38. {
  39. ALIVE,
  40. NOT_ALIVE_DISPOSED,
  41. NOT_ALIVE_NO_WRITERS
  42. };
  43. /*!
  44. * @brief SampleInfo is the information that accompanies each sample that is ‘read’ or ‘taken.’
  45. */
  46. struct SampleInfo
  47. {
  48. //! indicates whether or not the corresponding data sample has already been read
  49. SampleStateKind sample_state;
  50. //! indicates whether the DataReader has already seen samples for the most-current generation of the related instance.
  51. ViewStateKind view_state;
  52. //! indicates whether the instance is currently in existence or, if it has been disposed, the reason why it was disposed.
  53. InstanceStateKind instance_state;
  54. //! number of times the instance had become alive after it was disposed
  55. int32_t disposed_generation_count;
  56. //! number of times the instance had become alive after it was disposed because no writers
  57. int32_t no_writers_generation_count;
  58. //! number of samples related to the same instance that follow in the collection
  59. int32_t sample_rank;
  60. //! the generation difference between the time the sample was received, and the time the most recent sample in the collection was received.
  61. int32_t generation_rank;
  62. //! the generation difference between the time the sample was received, and the time the most recent sample was received.
  63. //! The most recent sample used for the calculation may or may not be in the returned collection
  64. int32_t absoulte_generation_rank;
  65. //! time provided by the DataWriter when the sample was written
  66. fastrtps::rtps::Time_t source_timestamp;
  67. //! identifies locally the corresponding instance
  68. fastrtps::rtps::InstanceHandle_t instance_handle;
  69. //! identifies locally the DataWriter that modified the instance
  70. //!
  71. //! Is the same InstanceHandle_t that is returned by the operation get_matched_publications on the DataReader
  72. fastrtps::rtps::InstanceHandle_t publication_handle;
  73. //! whether the DataSample contains data or is only used to communicate of a change in the instance
  74. bool valid_data;
  75. //!Sample Identity (Extension for RPC)
  76. fastrtps::rtps::SampleIdentity sample_identity;
  77. //!Related Sample Identity (Extension for RPC)
  78. fastrtps::rtps::SampleIdentity related_sample_identity;
  79. };
  80. } /* namespace dds */
  81. } /* namespace fastdds */
  82. } /* namespace eprosima */
  83. #endif /* _FASTRTPS_SAMPLEINFO_HPP_*/