-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only apply content filter to ALIVE changes (#4835)
* Refs #20815: Add regression test Signed-off-by: eduponz <eduardoponz@eprosima.com> * Refs #20815: Only apply filter to ALIVE changes Signed-off-by: eduponz <eduardoponz@eprosima.com> * Refs #20815: Rename change_is_relevant_for_filter argument Signed-off-by: eduponz <eduardoponz@eprosima.com> * Refs #20815: Refactor test Signed-off-by: eduponz <eduardoponz@eprosima.com> * Refs #20815: Cast loop index to uint16_t for assigning it to the key field Signed-off-by: eduponz <eduardoponz@eprosima.com> --------- Signed-off-by: eduponz <eduardoponz@eprosima.com>
- Loading branch information
Showing
11 changed files
with
326 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @file reader_utils.cpp | ||
*/ | ||
|
||
#include "reader_utils.hpp" | ||
|
||
#include <fastdds/rtps/common/ChangeKind_t.hpp> | ||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace rtps { | ||
|
||
bool change_is_relevant_for_filter( | ||
const CacheChange& change, | ||
const GUID& reader_guid, | ||
const IReaderDataFilter* filter) | ||
{ | ||
bool ret = true; | ||
|
||
// Only evaluate filter on ALIVE changes, as UNREGISTERED and DISPOSED are always relevant | ||
if ((nullptr != filter) && (fastrtps::rtps::ALIVE == change.kind) && (!filter->is_relevant(change, reader_guid))) | ||
{ | ||
ret = false; | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
} // namespace rtps | ||
} // namespace fastdds | ||
} // namespace eprosima |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
/** | ||
* @file reader_utils.hpp | ||
*/ | ||
|
||
#ifndef _FASTDDS_RTPS_READER_READERUTILS_H_ | ||
#define _FASTDDS_RTPS_READER_READERUTILS_H_ | ||
|
||
#include <fastdds/rtps/common/CacheChange.h> | ||
#include <fastdds/rtps/common/Guid.h> | ||
#include <fastdds/rtps/interfaces/IReaderDataFilter.hpp> | ||
#include <fastdds/rtps/common/ChangeKind_t.hpp> | ||
|
||
namespace eprosima { | ||
namespace fastdds { | ||
namespace rtps { | ||
|
||
using CacheChange = fastrtps::rtps::CacheChange_t; | ||
using GUID = fastrtps::rtps::GUID_t; | ||
|
||
/** | ||
* @brief Check if a change is relevant for a reader. | ||
* | ||
* @param change The CacheChange_t to be evaluated. | ||
* @param reader_guid Reader's GUID_t. | ||
* @param filter The IReaderDataFilter to be used. | ||
* | ||
* @return true if relevant, false otherwise. | ||
*/ | ||
bool change_is_relevant_for_filter( | ||
const CacheChange& change, | ||
const GUID& reader_guid, | ||
const IReaderDataFilter* filter); | ||
|
||
} // namespace rtps | ||
} // namespace fastdds | ||
} // namespace eprosima | ||
|
||
|
||
#endif // _FASTDDS_RTPS_READER_READERUTILS_H_ |
Oops, something went wrong.