Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
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
39namespace eprosima {
40namespace fastdds {
41namespace rtps {
42
43// Forward declarations
44struct CacheChange_t;
45class ReaderListener;
46class RTPSParticipantImpl;
47
53class RTPSReader : public Endpoint
54{
55
56public:
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
149 FASTDDS_EXPORTED_API virtual CacheChange_t* next_unread_cache() = 0;
150
156 FASTDDS_EXPORTED_API virtual CacheChange_t* next_untaken_cache() = 0;
157
165 FASTDDS_EXPORTED_API virtual bool wait_for_unread_cache(
166 const eprosima::fastdds::dds::Duration_t& timeout) = 0;
167
173 FASTDDS_EXPORTED_API virtual uint64_t get_unread_count() const = 0;
174
182 FASTDDS_EXPORTED_API virtual uint64_t get_unread_count(
183 bool mark_as_read) = 0;
184
196 FASTDDS_EXPORTED_API virtual bool is_sample_valid(
197 const void* data,
198 const GUID_t& writer,
199 const SequenceNumber_t& sn) const = 0;
200
201#ifdef FASTDDS_STATISTICS
202
208 FASTDDS_EXPORTED_API virtual bool add_statistics_listener(
209 std::shared_ptr<fastdds::statistics::IListener> listener) = 0;
210
216 FASTDDS_EXPORTED_API virtual bool remove_statistics_listener(
217 std::shared_ptr<fastdds::statistics::IListener> listener) = 0;
218
224 FASTDDS_EXPORTED_API virtual void set_enabled_statistics_writers_mask(
225 uint32_t enabled_writers) = 0;
226
233 FASTDDS_EXPORTED_API virtual bool get_connections(
234 fastdds::statistics::rtps::ConnectionList& connection_list) = 0;
235
236#endif // FASTDDS_STATISTICS
237
238protected:
239
241 RTPSParticipantImpl* pimpl,
242 const GUID_t& guid,
243 const ReaderAttributes& att,
244 ReaderHistory* hist);
245
247
250
251private:
252
253 RTPSReader& operator =(
254 const RTPSReader&) = delete;
255
256};
257
258} // namespace rtps
259} // namespace fastdds
260} // namespace eprosima
261
262#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 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 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 CacheChange_t * next_unread_cache()=0
Read the next unread CacheChange_t from the history.
virtual FASTDDS_EXPORTED_API eprosima::fastdds::rtps::IReaderDataFilter * get_content_filter() const =0
virtual FASTDDS_EXPORTED_API void assert_writer_liveliness(const GUID_t &writer)=0
Assert the liveliness of a matched writer.
virtual FASTDDS_EXPORTED_API ReaderHistory * get_history() const =0
virtual FASTDDS_EXPORTED_API CacheChange_t * next_untaken_cache()=0
Get the next CacheChange_t from the history to take.
ReaderHistory * history_
ReaderHistory.
Definition RTPSReader.hpp:249
virtual FASTDDS_EXPORTED_API ReaderListener * get_listener() const =0
Get the associated listener.
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.
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
eProsima namespace.
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:78
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:39
Structure SequenceNumber_t, different for each change in the same writer.
Definition SequenceNumber.hpp:38