Skip to content

Commit da25f7e

Browse files
committed
[#24061] Added filter functions to 'writers'
Signed-off-by: danipiza <dpizarrogallego@gmail.com>
1 parent 21dd812 commit da25f7e

28 files changed

Lines changed: 345 additions & 18 deletions

File tree

ddspipe_core/include/ddspipe_core/interface/IWriter.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#pragma once
1616

17+
#include <set>
18+
1719
#include <cpp_utils/ReturnCode.hpp>
1820

1921
#include <ddspipe_core/interface/IRoutingData.hpp>
@@ -83,6 +85,16 @@ class IWriter
8385
virtual utils::ReturnCode write(
8486
IRoutingData& data) noexcept = 0;
8587

88+
//! Update method to change the partitions in the content_topicfilter
89+
DDSPIPE_CORE_DllAPI
90+
virtual void update_partitions(
91+
const std::set<std::string>& partitions_set) = 0;
92+
93+
//! Update method to change the expression in the content_topicfilter
94+
DDSPIPE_CORE_DllAPI
95+
virtual void update_content_topic_filter(
96+
const std::string& expression) = 0;
97+
8698
//! Update method to change the topic_partitions
8799
DDSPIPE_CORE_DllAPI
88100
virtual void update_topic_partitions(

ddspipe_participants/include/ddspipe_participants/testing/entities/mock_entities.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,17 @@ class MockWriter : public BaseWriter
136136
utils::ReturnCode write_nts_(
137137
core::IRoutingData& data) noexcept override;
138138

139+
//! Update method to change the partitions in the content_topicfilter
140+
DDSPIPE_PARTICIPANTS_DllAPI
141+
virtual void update_partitions(
142+
const std::set<std::string>& partitions_set) override;
143+
144+
//! Update method to change the expression in the content_topicfilter
145+
DDSPIPE_PARTICIPANTS_DllAPI
146+
virtual void update_content_topic_filter(
147+
const std::string& expression) override;
148+
149+
//! Update method to change the topic_partitions
139150
DDSPIPE_PARTICIPANTS_DllAPI
140151
void update_topic_partitions(
141152
const std::map<std::string, std::string>& partition_name) override;

ddspipe_participants/include/ddspipe_participants/writer/auxiliar/BaseWriter.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ class BaseWriter : public core::IWriter
8989
virtual utils::ReturnCode write(
9090
core::IRoutingData& data) noexcept override;
9191

92+
//! Update method to change the partitions in the content_topicfilter
93+
DDSPIPE_PARTICIPANTS_DllAPI
94+
virtual void update_partitions(
95+
const std::set<std::string>& partitions_set) override;
96+
97+
//! Update method to change the expression in the content_topicfilter
98+
DDSPIPE_PARTICIPANTS_DllAPI
99+
virtual void update_content_topic_filter(
100+
const std::string& expression) override;
101+
92102
//! Update method to change the topic_partitions
93103
DDSPIPE_PARTICIPANTS_DllAPI
94104
void update_topic_partitions(

ddspipe_participants/include/ddspipe_participants/writer/auxiliar/BlankWriter.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ class BlankWriter : public core::IWriter
4343
utils::ReturnCode write(
4444
core::IRoutingData& data) noexcept override;
4545

46+
//! Update method to change the partitions in the content_topicfilter
47+
DDSPIPE_PARTICIPANTS_DllAPI
48+
virtual void update_partitions(
49+
const std::set<std::string>& partitions_set) override;
50+
51+
//! Update method to change the expression in the content_topicfilter
52+
DDSPIPE_PARTICIPANTS_DllAPI
53+
virtual void update_content_topic_filter(
54+
const std::string& expression) override;
55+
4656
//! Update method to change the topic_partitions
4757
DDSPIPE_PARTICIPANTS_DllAPI
4858
void update_topic_partitions(

ddspipe_participants/include/ddspipe_participants/writer/auxiliar/InternalWriter.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ class InternalWriter : public BaseWriter
4040
virtual utils::ReturnCode write_nts_(
4141
core::IRoutingData& data) noexcept override;
4242

43+
//! Update method to change the partitions in the content_topicfilter
44+
DDSPIPE_PARTICIPANTS_DllAPI
45+
virtual void update_partitions(
46+
const std::set<std::string>& partitions_set) override;
47+
48+
//! Update method to change the expression in the content_topicfilter
49+
DDSPIPE_PARTICIPANTS_DllAPI
50+
virtual void update_content_topic_filter(
51+
const std::string& expression) override;
52+
53+
//! Update method to change the topic_partitions
4354
virtual void update_topic_partitions(
4455
const std::map<std::string, std::string>& partition_name) override;
4556

ddspipe_participants/include/ddspipe_participants/writer/auxiliar/RtpsEchoWriter.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ class RtpsEchoWriter : public BlankWriter
5252
virtual utils::ReturnCode write(
5353
core::IRoutingData& data) noexcept override;
5454

55+
//! Update method to change the partitions in the content_topicfilter
56+
virtual void update_partitions(
57+
const std::set<std::string>& partitions_set) override;
58+
59+
//! Update method to change the expression in the content_topicfilter
60+
virtual void update_content_topic_filter(
61+
const std::string& expression) override;
62+
63+
//! Update method to change the topic_partitions
5564
virtual void update_topic_partitions(
5665
const std::map<std::string, std::string>& partition_name) override;
5766

ddspipe_participants/include/ddspipe_participants/writer/dds/CommonWriter.hpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ class CommonWriter : public BaseWriter
7474
* @pre this method can only be called once.
7575
*/
7676
DDSPIPE_PARTICIPANTS_DllAPI
77-
void init();
77+
void init(
78+
const std::set<std::string>& partitions_set,
79+
const std::string& content_topicfilter_expression);
7880

7981
/////////////////////
8082
// STATIC ATTRIBUTES
@@ -164,7 +166,17 @@ class CommonWriter : public BaseWriter
164166
eprosima::fastdds::rtps::WriteParams& to_send_params,
165167
const core::types::RtpsPayloadData& data) const noexcept;
166168

169+
//! Update method to change the partitions in the content_topicfilter
170+
DDSPIPE_PARTICIPANTS_DllAPI
171+
virtual void update_partitions(
172+
const std::set<std::string>& partitions_set) override;
173+
174+
//! Update method to change the expression in the content_topicfilter
175+
DDSPIPE_PARTICIPANTS_DllAPI
176+
virtual void update_content_topic_filter(
177+
const std::string& expression) override;
167178

179+
//! Update method to change the topic_partitions
168180
DDSPIPE_PARTICIPANTS_DllAPI
169181
virtual void update_topic_partitions(
170182
const std::map<std::string, std::string>& partition_name) override;
@@ -184,6 +196,7 @@ class CommonWriter : public BaseWriter
184196
std::shared_ptr<core::PayloadPoolMediator> payload_pool_;
185197

186198
core::types::DdsTopic topic_;
199+
eprosima::fastdds::dds::ContentFilteredTopic* filtered_topic_;
187200

188201
fastdds::dds::Publisher* dds_publisher_;
189202
fastdds::dds::DataWriter* writer_;

ddspipe_participants/include/ddspipe_participants/writer/dds/MultiWriter.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ class MultiWriter : public BaseWriter
8686
virtual utils::ReturnCode write_nts_(
8787
core::IRoutingData& data) noexcept override;
8888

89+
//! Update method to change the partitions in the content_topicfilter
90+
virtual void update_partitions(
91+
const std::set<std::string>& partitions_set) override;
92+
93+
//! Update method to change the expression in the content_topicfilter
94+
virtual void update_content_topic_filter(
95+
const std::string& expression) override;
96+
97+
//! Update method to change the topic_partitions
8998
virtual void update_topic_partitions(
9099
const std::map<std::string, std::string>& partition_name) override;
91100

ddspipe_participants/include/ddspipe_participants/writer/dynamic_types/SchemaWriter.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ class SchemaWriter : public BaseWriter
4545
std::shared_ptr<core::PayloadPool> payload_pool,
4646
std::shared_ptr<ISchemaHandler> schema_handler);
4747

48+
//! Update method to change the partitions in the content_topicfilter
49+
DDSPIPE_PARTICIPANTS_DllAPI
50+
virtual void update_partitions(
51+
const std::set<std::string>& partitions_set) override;
52+
53+
//! Update method to change the expression in the content_topicfilter
54+
DDSPIPE_PARTICIPANTS_DllAPI
55+
virtual void update_content_topic_filter(
56+
const std::string& expression) override;
57+
4858
//! Update method to change the topic_partitions
4959
DDSPIPE_PARTICIPANTS_DllAPI
5060
void update_topic_partitions(

ddspipe_participants/include/ddspipe_participants/writer/dynamic_types/TypeObjectWriter.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ class TypeObjectWriter : public BaseWriter
5454
utils::ReturnCode write_nts_(
5555
core::IRoutingData& data) noexcept override;
5656

57+
//! Update method to change the partitions in the content_topicfilter
58+
DDSPIPE_PARTICIPANTS_DllAPI
59+
virtual void update_partitions(
60+
const std::set<std::string>& partitions_set) override;
61+
62+
//! Update method to change the expression in the content_topicfilter
63+
DDSPIPE_PARTICIPANTS_DllAPI
64+
virtual void update_content_topic_filter(
65+
const std::string& expression) override;
66+
67+
//! Update method to change the topic_partitions
5768
void update_topic_partitions(
5869
const std::map<std::string, std::string>& partition_name) override;
5970

0 commit comments

Comments
 (0)