-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #20815: Only apply filter to ALIVE changes
Signed-off-by: eduponz <eduardoponz@eprosima.com>
- Loading branch information
Showing
8 changed files
with
123 additions
and
15 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& 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, 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 Remote reader 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& guid, | ||
const IReaderDataFilter* filter); | ||
|
||
} // namespace rtps | ||
} // namespace fastdds | ||
} // namespace eprosima | ||
|
||
|
||
#endif // _FASTDDS_RTPS_READER_READERUTILS_H_ |
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