Fast DDS  Version 3.6.1.0
Fast DDS
RTPSReader.hpp
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 
19 #ifndef FASTDDS_RTPS_READER__RTPSREADER_HPP
20 #define FASTDDS_RTPS_READER__RTPSREADER_HPP
21 
22 #include <cstdint>
23 #include <memory>
24 
25 #include <fastdds/fastdds_dll.hpp>
26 #include <fastdds/rtps/attributes/ReaderAttributes.hpp>
27 #include <fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp>
28 #include <fastdds/rtps/common/Guid.hpp>
29 #include <fastdds/rtps/common/RemoteLocators.hpp>
30 #include <fastdds/rtps/common/SequenceNumber.hpp>
31 #include <fastdds/rtps/common/Time_t.hpp>
32 #include <fastdds/rtps/Endpoint.hpp>
33 #include <fastdds/rtps/history/ReaderHistory.hpp>
34 #include <fastdds/rtps/interfaces/IReaderDataFilter.hpp>
35 #include <fastdds/statistics/IListeners.hpp>
36 #include <fastdds/statistics/rtps/monitor_service/connections_fwd.hpp>
37 #include <fastdds/statistics/rtps/StatisticsCommon.hpp>
38 
39 namespace eprosima {
40 namespace fastdds {
41 namespace rtps {
42 
43 // Forward declarations
44 struct CacheChange_t;
45 class ReaderListener;
46 class RTPSParticipantImpl;
47 
53 class RTPSReader : public Endpoint
54 {
55 
56 public:
57 
65  FASTDDS_EXPORTED_API virtual bool matched_writer_add(
66  const PublicationBuiltinTopicData& info) = 0;
67 
76  FASTDDS_EXPORTED_API virtual bool matched_writer_remove(
77  const GUID_t& writer_guid,
78  bool removed_by_lease = false) = 0;
79 
87  FASTDDS_EXPORTED_API virtual bool matched_writer_is_matched(
88  const GUID_t& writer_guid) = 0;
89 
95  FASTDDS_EXPORTED_API virtual void assert_writer_liveliness(
96  const GUID_t& writer) = 0;
97 
104  FASTDDS_EXPORTED_API virtual bool is_in_clean_state() = 0;
105 
111  FASTDDS_EXPORTED_API virtual ReaderListener* get_listener() const = 0;
112 
118  FASTDDS_EXPORTED_API virtual void set_listener(
119  ReaderListener* listener) = 0;
120 
124  FASTDDS_EXPORTED_API virtual bool expects_inline_qos() const = 0;
125 
129  FASTDDS_EXPORTED_API virtual ReaderHistory* get_history() const = 0;
130 
134  FASTDDS_EXPORTED_API virtual eprosima::fastdds::rtps::IReaderDataFilter* get_content_filter() const = 0;
135 
141  FASTDDS_EXPORTED_API virtual void set_content_filter(
143 
150  FASTDDS_EXPORTED_API virtual bool matched_writers_guids(
151  std::vector<GUID_t>& guids) const = 0;
152 
158  FASTDDS_EXPORTED_API virtual CacheChange_t* next_unread_cache() = 0;
159 
165  FASTDDS_EXPORTED_API virtual CacheChange_t* next_untaken_cache() = 0;
166 
174  FASTDDS_EXPORTED_API virtual bool wait_for_unread_cache(
175  const eprosima::fastdds::dds::Duration_t& timeout) = 0;
176 
182  FASTDDS_EXPORTED_API virtual uint64_t get_unread_count() const = 0;
183 
191  FASTDDS_EXPORTED_API virtual uint64_t get_unread_count(
192  bool mark_as_read) = 0;
193 
205  FASTDDS_EXPORTED_API virtual bool is_sample_valid(
206  const void* data,
207  const GUID_t& writer,
208  const SequenceNumber_t& sn) const = 0;
209 
210 #ifdef FASTDDS_STATISTICS
211 
217  FASTDDS_EXPORTED_API virtual bool add_statistics_listener(
218  std::shared_ptr<fastdds::statistics::IListener> listener) = 0;
219 
225  FASTDDS_EXPORTED_API virtual bool remove_statistics_listener(
226  std::shared_ptr<fastdds::statistics::IListener> listener) = 0;
227 
233  FASTDDS_EXPORTED_API virtual void set_enabled_statistics_writers_mask(
234  uint32_t enabled_writers) = 0;
235 
242  FASTDDS_EXPORTED_API virtual bool get_connections(
243  fastdds::statistics::rtps::ConnectionList& connection_list) = 0;
244 
245 #endif // FASTDDS_STATISTICS
246 
247 protected:
248 
250  RTPSParticipantImpl* pimpl,
251  const GUID_t& guid,
252  const ReaderAttributes& att,
253  ReaderHistory* hist);
254 
256 
259 
260 private:
261 
262  RTPSReader& operator =(
263  const RTPSReader&) = delete;
264 
265 };
266 
267 } // namespace rtps
268 } // namespace fastdds
269 } // namespace eprosima
270 
271 #endif // FASTDDS_RTPS_READER__RTPSREADER_HPP
Class Endpoint, all entities of the RTPS network derive from this class.
Definition: Endpoint.hpp:46
friend class RTPSParticipantImpl
Definition: Endpoint.hpp:47
Abstract class IReaderDataFilter that acts as virtual interface for data filters in ReaderProxy.
Definition: IReaderDataFilter.hpp:36
Class RTPSReader, manages the reception of data from its matched writers.
Definition: RTPSReader.hpp:54
RTPSReader(RTPSParticipantImpl *pimpl, const GUID_t &guid, const ReaderAttributes &att, ReaderHistory *hist)
virtual FASTDDS_EXPORTED_API bool matched_writer_add(const PublicationBuiltinTopicData &info)=0
Add a matched writer represented by its publication info.
virtual FASTDDS_EXPORTED_API bool matched_writers_guids(std::vector< GUID_t > &guids) const =0
Fills the provided vector with the GUIDs of the matched writers.
virtual FASTDDS_EXPORTED_API void set_content_filter(eprosima::fastdds::rtps::IReaderDataFilter *filter)=0
Set the content filter associated to this reader.
virtual FASTDDS_EXPORTED_API uint64_t get_unread_count() const =0
Get the number of unread CacheChange_t in the history.
virtual FASTDDS_EXPORTED_API uint64_t get_unread_count(bool mark_as_read)=0
Get the number of unread CacheChange_t in the history and optionally mark them as read.
virtual FASTDDS_EXPORTED_API CacheChange_t * next_untaken_cache()=0
Get the next CacheChange_t from the history to take.
virtual FASTDDS_EXPORTED_API CacheChange_t * next_unread_cache()=0
Read the next unread CacheChange_t from the history.
virtual FASTDDS_EXPORTED_API ReaderHistory * get_history() const =0
virtual FASTDDS_EXPORTED_API bool matched_writer_remove(const GUID_t &writer_guid, bool removed_by_lease=false)=0
Remove a writer from the matched writers.
virtual FASTDDS_EXPORTED_API bool is_sample_valid(const void *data, const GUID_t &writer, const SequenceNumber_t &sn) const =0
Checks whether the sample is still valid or is corrupted.
virtual FASTDDS_EXPORTED_API bool expects_inline_qos() const =0
virtual FASTDDS_EXPORTED_API bool is_in_clean_state()=0
Check if this reader is in a clean state with all its matched writers.
virtual FASTDDS_EXPORTED_API void assert_writer_liveliness(const GUID_t &writer)=0
Assert the liveliness of a matched writer.
ReaderHistory * history_
ReaderHistory.
Definition: RTPSReader.hpp:258
virtual FASTDDS_EXPORTED_API bool matched_writer_is_matched(const GUID_t &writer_guid)=0
Check if a specific writer is matched against this reader.
virtual FASTDDS_EXPORTED_API void set_listener(ReaderListener *listener)=0
Change the listener associated to this reader.
virtual FASTDDS_EXPORTED_API bool wait_for_unread_cache(const eprosima::fastdds::dds::Duration_t &timeout)=0
Wait until there is an unread CacheChange_t in the history.
virtual FASTDDS_EXPORTED_API eprosima::fastdds::rtps::IReaderDataFilter * get_content_filter() const =0
virtual FASTDDS_EXPORTED_API ReaderListener * get_listener() const =0
Get the associated listener.
Class ReaderAttributes, to define the attributes of a RTPSReader.
Definition: ReaderAttributes.hpp:59
Class ReaderHistory, container of the different CacheChanges of a reader.
Definition: ReaderHistory.hpp:39
Class ReaderListener, to be used by the user to override some of is virtual method to program actions...
Definition: ReaderListener.hpp:45
std::vector< eprosima::fastdds::statistics::Connection > ConnectionList
Definition: connections_fwd.hpp:31
Structure Time_t, used to describe times at a DDS level.
Definition: Time_t.hpp:36
Structure CacheChange_t, contains information on a specific CacheChange.
Definition: CacheChange.hpp:81
Structure GUID_t, entity identifier, unique in DDS-RTPS Domain.
Definition: Guid.hpp:40
Structure PublicationBuiltinTopicData, contains the information on a discovered publication.
Definition: PublicationBuiltinTopicData.hpp:48
Structure SequenceNumber_t, different for each change in the same writer.
Definition: SequenceNumber.hpp:38