Fast DDS  Version 3.6.1.0
Fast DDS
ReaderListener.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 
20 #ifndef FASTDDS_RTPS_READER__READERLISTENER_HPP
21 #define FASTDDS_RTPS_READER__READERLISTENER_HPP
22 
23 #include <fastdds/dds/core/status/LivelinessChangedStatus.hpp>
24 #include <fastdds/dds/core/status/SubscriptionMatchedStatus.hpp>
25 #include <fastdds/dds/core/status/SampleRejectedStatus.hpp>
26 #include <fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp>
27 #include <fastdds/rtps/common/Guid.hpp>
28 #include <fastdds/rtps/common/MatchingInfo.hpp>
29 #include <fastdds/rtps/writer/WriterDiscoveryStatus.hpp>
30 
31 
32 namespace eprosima {
33 namespace fastdds {
34 namespace rtps {
35 
36 class RTPSReader;
37 struct CacheChange_t;
38 
44 class FASTDDS_EXPORTED_API ReaderListener
45 {
46 public:
47 
48  ReaderListener() = default;
49 
50  virtual ~ReaderListener() = default;
51 
57  virtual void on_reader_matched(
58  RTPSReader* reader,
59  const MatchingInfo& info)
60  {
61  static_cast<void>(reader);
62  static_cast<void>(info);
63  }
64 
74  RTPSReader* reader,
75  const CacheChange_t* const change)
76  {
77  static_cast<void>(reader);
78  static_cast<void>(change);
79  }
80 
86  virtual void on_liveliness_changed(
87  RTPSReader* reader,
89  {
90  static_cast<void>(reader);
91  static_cast<void>(status);
92  }
93 
102  RTPSReader* reader,
104  {
105  static_cast<void>(reader);
106  static_cast<void>(qos);
107  }
108 
116  virtual void on_sample_lost(
117  RTPSReader* reader,
118  int32_t sample_lost_since_last_update)
119  {
120  static_cast<void>(reader);
121  static_cast<void>(sample_lost_since_last_update);
122  }
123 
132  virtual void on_writer_discovery(
133  RTPSReader* reader,
134  WriterDiscoveryStatus reason,
135  const GUID_t& writer_guid,
136  const PublicationBuiltinTopicData* writer_info)
137  {
138  static_cast<void>(reader);
139  static_cast<void>(reason);
140  static_cast<void>(writer_guid);
141  static_cast<void>(writer_info);
142  }
143 
152  virtual void on_sample_rejected(
153  RTPSReader* reader,
155  const CacheChange_t* const change)
156  {
157  static_cast<void>(reader);
158  static_cast<void>(reason);
159  static_cast<void>(change);
160  }
161 
174  virtual void on_data_available(
175  RTPSReader* reader,
176  const GUID_t& writer_guid,
177  const SequenceNumber_t& first_sequence,
178  const SequenceNumber_t& last_sequence,
179  bool& should_notify_individual_changes)
180  {
181  static_cast<void>(reader);
182  static_cast<void>(writer_guid);
183  static_cast<void>(first_sequence);
184  static_cast<void>(last_sequence);
185 
186  should_notify_individual_changes = true;
187  }
188 
195  virtual void on_incompatible_type(
196  RTPSReader* reader)
197  {
198  static_cast<void>(reader);
199  }
200 
201 };
202 
203 } // namespace rtps
204 } // namespace fastdds
205 } // namespace eprosima
206 
207 #endif // FASTDDS_RTPS_READER__READERLISTENER_HPP
Class MatchingInfo contains information about the matching between two endpoints.
Definition: MatchingInfo.hpp:48
Class RTPSReader, manages the reception of data from its matched writers.
Definition: RTPSReader.hpp:54
Class ReaderListener, to be used by the user to override some of is virtual method to program actions...
Definition: ReaderListener.hpp:45
virtual void on_liveliness_changed(RTPSReader *reader, const eprosima::fastdds::dds::LivelinessChangedStatus &status)
Method called when the liveliness of a reader changes.
Definition: ReaderListener.hpp:86
virtual void on_reader_matched(RTPSReader *reader, const MatchingInfo &info)
This method is invoked when a new reader matches.
Definition: ReaderListener.hpp:57
virtual void on_new_cache_change_added(RTPSReader *reader, const CacheChange_t *const change)
This method is called when a new CacheChange_t is added to the ReaderHistory.
Definition: ReaderListener.hpp:73
virtual void on_writer_discovery(RTPSReader *reader, WriterDiscoveryStatus reason, const GUID_t &writer_guid, const PublicationBuiltinTopicData *writer_info)
Method called when the discovery information of a writer regarding a reader changes.
Definition: ReaderListener.hpp:132
virtual void on_requested_incompatible_qos(RTPSReader *reader, eprosima::fastdds::dds::PolicyMask qos)
This method is called when a new Writer is discovered, with a Topic that matches that of a local read...
Definition: ReaderListener.hpp:101
virtual void on_incompatible_type(RTPSReader *reader)
This method is called when a new Writer is discovered, with a Topic that matches the name of a local ...
Definition: ReaderListener.hpp:195
virtual void on_sample_lost(RTPSReader *reader, int32_t sample_lost_since_last_update)
This method is called when the reader detects that one or more samples have been lost.
Definition: ReaderListener.hpp:116
virtual void on_data_available(RTPSReader *reader, const GUID_t &writer_guid, const SequenceNumber_t &first_sequence, const SequenceNumber_t &last_sequence, bool &should_notify_individual_changes)
This method is called when new CacheChange_t objects are made available to the user.
Definition: ReaderListener.hpp:174
virtual void on_sample_rejected(RTPSReader *reader, eprosima::fastdds::dds::SampleRejectedStatusKind reason, const CacheChange_t *const change)
This method is called when the reader rejects a samples.
Definition: ReaderListener.hpp:152
SampleRejectedStatusKind
An enum with the possible values for the sample rejected reason.
Definition: SampleRejectedStatus.hpp:32
std::bitset< NEXT_QOS_POLICY_ID > PolicyMask
Definition: QosPolicies.hpp:104
WriterDiscoveryStatus
Enum WriterDiscoveryStatus, four different status for discovered writers.
Definition: WriterDiscoveryStatus.hpp:35
A struct storing the liveliness changed status.
Definition: LivelinessChangedStatus.hpp:30
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