Fast DDS  Version 3.6.1.0
Fast DDS
IContentFilter.hpp
1 // Copyright 2021 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_DDS_TOPIC__ICONTENTFILTER_HPP
20 #define FASTDDS_DDS_TOPIC__ICONTENTFILTER_HPP
21 
22 #include <fastdds/fastdds_dll.hpp>
23 
24 #include <fastdds/rtps/common/Guid.hpp>
25 #include <fastdds/rtps/common/SampleIdentity.hpp>
26 #include <fastdds/rtps/common/SerializedPayload.hpp>
27 #include <fastdds/rtps/common/WriteParams.hpp>
28 
29 namespace eprosima {
30 namespace fastdds {
31 namespace dds {
32 
37 {
38  virtual ~IContentFilter() = default;
39 
42 
48  {
50 
51  FilterSampleInfo() = default;
52 
53  explicit FilterSampleInfo(
54  const rtps::WriteParams& wparams)
55  : sample_identity(wparams.sample_identity())
57  , user_write_data(wparams.user_write_data())
58  {
59  }
60 
66  std::shared_ptr<fastdds::rtps::WriteParams::UserWriteData> user_write_data;
67  };
68 
78  virtual bool evaluate(
79  const SerializedPayload& payload,
80  const FilterSampleInfo& sample_info,
81  const GUID_t& reader_guid) const = 0;
82 };
83 
84 } // namespace dds
85 } // namespace fastdds
86 } // namespace eprosima
87 
88 #endif // FASTDDS_DDS_TOPIC__ICONTENTFILTER_HPP
This class is used to specify a sample.
Definition: SampleIdentity.hpp:34
This class contains additional information of a CacheChange.
Definition: WriteParams.hpp:37
Definition: DomainParticipant.hpp:46
Selected information from the cache change that is passed to the content filter object on payload eva...
Definition: IContentFilter.hpp:48
SampleIdentity sample_identity
Identity of the sample being filtered.
Definition: IContentFilter.hpp:62
FilterSampleInfo(const rtps::WriteParams &wparams)
Definition: IContentFilter.hpp:53
SampleIdentity related_sample_identity
Identity of a sample related to the one being filtered.
Definition: IContentFilter.hpp:64
std::shared_ptr< fastdds::rtps::WriteParams::UserWriteData > user_write_data
Extra write information that can be used by the prefilter.
Definition: IContentFilter.hpp:66
The interface that content filter objects should implement.
Definition: IContentFilter.hpp:37
virtual bool evaluate(const SerializedPayload &payload, const FilterSampleInfo &sample_info, const GUID_t &reader_guid) const =0
Evaluate if a serialized payload should be accepted by certain reader.
Structure GUID_t, entity identifier, unique in DDS-RTPS Domain.
Definition: Guid.hpp:40
Structure SerializedPayload_t.
Definition: SerializedPayload.hpp:59