Skip to content

Commit cb4adba

Browse files
Adding RTPS API extensions to support additional features (#2552)
* Refs 13966. Move reader_data_filter API to RTPSWriter. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Rename and add specific reader filter interfaces. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added WriterListener::on_reader_discovery. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added ReaderListener::on_writer_discovery. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added ContentFilterProperty header file. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added content_filter field to RTPSParticipantAllocationAttributes. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added content filter information to ReaderProxyData. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Removed ReaderProxyData forward declaration on WriterAttributes. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Fixed ReaderProxyData mock. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. EDP reader registration APIs extended. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Fix some include-what-you-use related to EDP header. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added content_filter accessors on ReaderProxyData. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Isolate brief doxydoc lines. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Remove dll export on child classes. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Remove unused header. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Default value for new arguments. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Include order. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Added CacheChange_t::inline_qos. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Single method on RTPSWriter with original name. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. New namespace for ContentFilterProperty. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Fixing mock classes. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Adding allocation limits for reader filters to WriterResourceLimitsQos. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Update doxydoc. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Linters. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Adding on_sample_lost to ReaderListener. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Doxydoc on ContentFilterProperty. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * Refs 13966. Adding information to versions.md. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
1 parent 0fcc299 commit cb4adba

File tree

35 files changed

+476
-143
lines changed

35 files changed

+476
-143
lines changed

include/fastdds/dds/builtin/typelookup/TypeLookupManager.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#ifndef _FASTDDS_TYPELOOKUP_SERVICE_MANAGER_HPP
2121
#define _FASTDDS_TYPELOOKUP_SERVICE_MANAGER_HPP
2222
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
23+
2324
#include <vector>
25+
#include <mutex>
2426

2527
#include <fastdds/dds/builtin/typelookup/TypeLookupRequestListener.hpp>
2628
#include <fastdds/dds/builtin/typelookup/TypeLookupReplyListener.hpp>

include/fastdds/dds/core/policy/QosPolicies.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2831,11 +2831,14 @@ class WriterResourceLimitsQos
28312831
bool operator ==(
28322832
const WriterResourceLimitsQos& b) const
28332833
{
2834-
return (this->matched_subscriber_allocation == b.matched_subscriber_allocation);
2834+
return (matched_subscriber_allocation == b.matched_subscriber_allocation) &&
2835+
(reader_filters_allocation == b.reader_filters_allocation);
28352836
}
28362837

28372838
//!Matched subscribers allocation limits.
28382839
fastrtps::ResourceLimitedContainerConfig matched_subscriber_allocation;
2840+
//!Reader filters allocation limits.
2841+
fastrtps::ResourceLimitedContainerConfig reader_filters_allocation;
28392842
};
28402843

28412844
/**

include/fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef _FASTDDS_RTPS_RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP_
2020
#define _FASTDDS_RTPS_RTPSPARTICIPANTALLOCATIONATTRIBUTES_HPP_
2121

22+
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
23+
2224
#include <fastrtps/utils/collections/ResourceLimitedContainerConfig.hpp>
2325

2426
namespace eprosima {
@@ -127,6 +129,8 @@ struct RTPSParticipantAllocationAttributes
127129
SendBuffersAllocationAttributes send_buffers;
128130
//! Holds limits for variable-length data
129131
VariableLengthDataLimits data_limits;
132+
//! Defines the allocation behavior of content filter discovery information
133+
fastdds::rtps::ContentFilterProperty::AllocationConfiguration content_filter;
130134

131135
//! @return the allocation config for the total of readers in the system (participants * readers)
132136
ResourceLimitedContainerConfig total_readers() const

include/fastdds/rtps/attributes/WriterAttributes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ namespace eprosima {
3333
namespace fastrtps {
3434
namespace rtps {
3535

36-
class ReaderProxyData;
37-
3836
typedef enum RTPSWriterPublishMode : octet
3937
{
4038
SYNCHRONOUS_WRITER,

include/fastdds/rtps/builtin/BuiltinProtocols.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <list>
2525

2626
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
27+
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
2728
#include <fastdds/rtps/network/NetworkFactory.h>
2829

2930
namespace eprosima {
@@ -132,15 +133,18 @@ class BuiltinProtocols
132133
const fastdds::dds::WriterQos& wqos);
133134
/**
134135
* Add a local Reader to the BuiltinProtocols.
135-
* @param R Pointer to the RTPSReader.
136-
* @param topicAtt Attributes of the associated topic
137-
* @param rqos QoS policies dictated by the subscriber
136+
* @param R Pointer to the RTPSReader.
137+
* @param topicAtt Attributes of the associated topic
138+
* @param rqos QoS policies dictated by the subscriber
139+
* @param content_filter Optional content filtering information.
138140
* @return True if correct.
139141
*/
140142
bool addLocalReader(
141143
RTPSReader* R,
142144
const TopicAttributes& topicAtt,
143-
const fastdds::dds::ReaderQos& rqos);
145+
const fastdds::dds::ReaderQos& rqos,
146+
const fastdds::rtps::ContentFilterProperty* content_filter = nullptr);
147+
144148
/**
145149
* Update a local Writer QOS
146150
* @param W Writer to update
@@ -154,15 +158,17 @@ class BuiltinProtocols
154158
const fastdds::dds::WriterQos& wqos);
155159
/**
156160
* Update a local Reader QOS
157-
* @param R Reader to update
158-
* @param topicAtt Attributes of the associated topic
159-
* @param qos New Reader QoS
161+
* @param R Reader to update
162+
* @param topicAtt Attributes of the associated topic
163+
* @param qos New Reader QoS
164+
* @param content_filter Optional content filtering information.
160165
* @return
161166
*/
162167
bool updateLocalReader(
163168
RTPSReader* R,
164169
const TopicAttributes& topicAtt,
165-
const fastdds::dds::ReaderQos& qos);
170+
const fastdds::dds::ReaderQos& qos,
171+
const fastdds::rtps::ContentFilterProperty* content_filter = nullptr);
166172
/**
167173
* Remove a local Writer from the builtinProtocols.
168174
* @param W Pointer to the writer.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Copyright 2022 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+
/**
16+
* @file ContentFilterProperty.hpp
17+
*/
18+
19+
#ifndef FASTDDS_RTPS_BUILTIN_DATA_CONTENTFILTERPROPERTY_HPP_
20+
#define FASTDDS_RTPS_BUILTIN_DATA_CONTENTFILTERPROPERTY_HPP_
21+
22+
#include <string>
23+
24+
#include <fastrtps/utils/fixed_size_string.hpp>
25+
#include <fastrtps/utils/collections/ResourceLimitedContainerConfig.hpp>
26+
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>
27+
28+
namespace eprosima {
29+
namespace fastdds {
30+
namespace rtps {
31+
32+
/**
33+
* Information about the content filter being applied by a reader.
34+
* @ingroup BUILTIN_MODULE
35+
*/
36+
class ContentFilterProperty
37+
{
38+
public:
39+
40+
/**
41+
* Allocation configuration for a ContentFilterProperty.
42+
* @ingroup BUILTIN_MODULE
43+
*/
44+
struct AllocationConfiguration
45+
{
46+
/// Preallocated size of the filter expression
47+
size_t expression_initial_size = 0;
48+
/// Allocation configuration for the list of expression parameters
49+
fastrtps::ResourceLimitedContainerConfig expression_parameters{ 0, 100, 1 };
50+
};
51+
52+
/**
53+
* Construct a ContentFilterProperty.
54+
*
55+
* @param config Allocation configuration for the new object.
56+
*/
57+
explicit ContentFilterProperty(
58+
const AllocationConfiguration& config)
59+
: expression_parameters(config.expression_parameters)
60+
{
61+
filter_expression.reserve(config.expression_initial_size);
62+
}
63+
64+
/// Name of the content filtered topic on which the reader was created
65+
fastrtps::string_255 content_filtered_topic_name;
66+
/// Name of the related topic being filtered
67+
fastrtps::string_255 related_topic_name;
68+
/// Class name of the filter being used
69+
fastrtps::string_255 filter_class_name;
70+
/// Filter expression indicating which content the reader wants to receive
71+
std::string filter_expression;
72+
/// List of values for the parameters present on the filter expression
73+
fastrtps::ResourceLimitedVector<fastrtps::string_255, std::true_type> expression_parameters;
74+
};
75+
76+
} // namespace rtps
77+
} // namespace fastdds
78+
} // namespace eprosima
79+
80+
#endif // FASTDDS_RTPS_BUILTIN_DATA_CONTENTFILTERPROPERTY_HPP_

include/fastdds/rtps/builtin/data/ReaderProxyData.h

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626

2727
#include <fastdds/rtps/attributes/WriterAttributes.h>
2828
#include <fastdds/rtps/attributes/RTPSParticipantAllocationAttributes.hpp>
29+
#include <fastdds/rtps/common/RemoteLocators.hpp>
30+
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
2931

3032
#if HAVE_SECURITY
3133
#include <fastdds/rtps/security/accesscontrol/EndpointSecurityAttributes.h>
3234
#endif // if HAVE_SECURITY
3335

34-
#include <fastdds/rtps/common/RemoteLocators.hpp>
3536

3637
namespace eprosima {
3738
namespace fastrtps {
@@ -51,12 +52,14 @@ class ReaderProxyData
5152

5253
RTPS_DllAPI ReaderProxyData(
5354
const size_t max_unicast_locators,
54-
const size_t max_multicast_locators);
55+
const size_t max_multicast_locators,
56+
const fastdds::rtps::ContentFilterProperty::AllocationConfiguration& content_filter_limits = {});
5557

5658
RTPS_DllAPI ReaderProxyData(
5759
const size_t max_unicast_locators,
5860
const size_t max_multicast_locators,
59-
const VariableLengthDataLimits& data_limits);
61+
const VariableLengthDataLimits& data_limits,
62+
const fastdds::rtps::ContentFilterProperty::AllocationConfiguration& content_filter_limits = {});
6063

6164
RTPS_DllAPI virtual ~ReaderProxyData();
6265

@@ -227,6 +230,28 @@ class ReaderProxyData
227230
return m_userDefinedId;
228231
}
229232

233+
RTPS_DllAPI void content_filter(
234+
const fastdds::rtps::ContentFilterProperty& filter)
235+
{
236+
content_filter_ = filter;
237+
}
238+
239+
RTPS_DllAPI void content_filter(
240+
fastdds::rtps::ContentFilterProperty&& filter)
241+
{
242+
content_filter_ = std::move(filter);
243+
}
244+
245+
RTPS_DllAPI const fastdds::rtps::ContentFilterProperty& content_filter() const
246+
{
247+
return content_filter_;
248+
}
249+
250+
RTPS_DllAPI fastdds::rtps::ContentFilterProperty& content_filter()
251+
{
252+
return content_filter_;
253+
}
254+
230255
RTPS_DllAPI void isAlive(
231256
bool isAlive)
232257
{
@@ -458,6 +483,8 @@ class ReaderProxyData
458483
xtypes::TypeInformation* m_type_information;
459484
//!
460485
ParameterPropertyList_t m_properties;
486+
//!Information on the content filter applied by the reader.
487+
fastdds::rtps::ContentFilterProperty content_filter_;
461488
};
462489

463490
} // namespace rtps

include/fastdds/rtps/builtin/discovery/endpoint/EDP.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC
2323

2424
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
25+
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
2526
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
2627
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
2728
#include <fastdds/rtps/common/Guid.h>
@@ -158,15 +159,17 @@ class EDP
158159

159160
/**
160161
* Create a new ReaderPD for a local Reader.
161-
* @param R Pointer to the RTPSReader.
162-
* @param att Attributes of the associated topic
163-
* @param qos QoS policies dictated by the subscriber
162+
* @param R Pointer to the RTPSReader.
163+
* @param att Attributes of the associated topic
164+
* @param qos QoS policies dictated by the subscriber
165+
* @param content_filter Optional content filtering information.
164166
* @return True if correct.
165167
*/
166168
bool newLocalReaderProxyData(
167169
RTPSReader* R,
168170
const TopicAttributes& att,
169-
const ReaderQos& qos);
171+
const ReaderQos& qos,
172+
const fastdds::rtps::ContentFilterProperty* content_filter = nullptr);
170173
/**
171174
* Create a new ReaderPD for a local Writer.
172175
* @param W Pointer to the RTPSWriter.
@@ -180,15 +183,17 @@ class EDP
180183
const WriterQos& qos);
181184
/**
182185
* A previously created Reader has been updated
183-
* @param R Pointer to the reader;
184-
* @param att Attributes of the associated topic
185-
* @param qos QoS policies dictated by the subscriber
186+
* @param R Pointer to the reader
187+
* @param att Attributes of the associated topic
188+
* @param qos QoS policies dictated by the subscriber
189+
* @param content_filter Optional content filtering information.
186190
* @return True if correctly updated
187191
*/
188192
bool updatedLocalReader(
189193
RTPSReader* R,
190194
const TopicAttributes& att,
191-
const ReaderQos& qos);
195+
const ReaderQos& qos,
196+
const fastdds::rtps::ContentFilterProperty* content_filter = nullptr);
192197
/**
193198
* A previously created Writer has been updated
194199
* @param W Pointer to the Writer

include/fastdds/rtps/common/CacheChange.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ struct RTPS_DllAPI CacheChange_t
7979
SequenceNumber_t sequenceNumber{};
8080
//!Serialized Payload associated with the change.
8181
SerializedPayload_t serializedPayload{};
82+
//!CDR serialization of inlined QoS for this change.
83+
SerializedPayload_t inline_qos{};
8284
//!Indicates if the cache has been read (only used in READERS)
8385
bool isRead = false;
8486
//!Source TimeStamp

include/fastdds/rtps/participant/RTPSParticipant.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121

2222
#include <cstdlib>
2323
#include <memory>
24+
2425
#include <fastrtps/fastrtps_dll.h>
2526
#include <fastdds/rtps/common/Guid.h>
2627
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
28+
#include <fastdds/rtps/builtin/data/ContentFilterProperty.hpp>
29+
#include <fastdds/statistics/IListeners.hpp>
2730
#include <fastrtps/qos/ReaderQos.h>
2831
#include <fastrtps/qos/WriterQos.h>
29-
#include <fastdds/statistics/IListeners.hpp>
3032

3133
namespace eprosima {
3234

@@ -139,15 +141,17 @@ class RTPS_DllAPI RTPSParticipant
139141

140142
/**
141143
* Register a RTPSReader in the builtin Protocols.
142-
* @param Reader Pointer to the RTPSReader.
143-
* @param topicAtt Topic Attributes where you want to register it.
144-
* @param rqos ReaderQos.
144+
* @param Reader Pointer to the RTPSReader.
145+
* @param topicAtt Topic Attributes where you want to register it.
146+
* @param rqos ReaderQos.
147+
* @param content_filter Optional content filtering information.
145148
* @return True if correctly registered.
146149
*/
147150
bool registerReader(
148151
RTPSReader* Reader,
149152
const TopicAttributes& topicAtt,
150-
const ReaderQos& rqos);
153+
const ReaderQos& rqos,
154+
const fastdds::rtps::ContentFilterProperty* content_filter = nullptr);
151155

152156
/**
153157
* Update participant attributes.
@@ -170,15 +174,17 @@ class RTPS_DllAPI RTPSParticipant
170174

171175
/**
172176
* Update reader QOS
173-
* @param Reader to update
174-
* @param topicAtt Topic Attributes where you want to register it.
175-
* @param rqos New reader QoS
177+
* @param Reader Pointer to the RTPSReader to update
178+
* @param topicAtt Topic Attributes where you want to register it.
179+
* @param rqos New reader QoS
180+
* @param content_filter Optional content filtering information.
176181
* @return true on success
177182
*/
178183
bool updateReader(
179184
RTPSReader* Reader,
180185
const TopicAttributes& topicAtt,
181-
const ReaderQos& rqos);
186+
const ReaderQos& rqos,
187+
const fastdds::rtps::ContentFilterProperty* content_filter = nullptr);
182188

183189
/**
184190
* Returns a list with the participant names.

0 commit comments

Comments
 (0)