Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17509] Feature: Ignore empty API #3354

Merged
merged 19 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/fastdds/dds/domain/DomainParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class DomainParticipant : public Entity
/**
* Locally ignore a remote domain participant.
*
* @note This action is not required to be reversible.
* @note This action is not reversible.
*
* @param handle Identifier of the remote participant to ignore
* @return RETURN_OK code if everything correct, error code otherwise
Expand All @@ -437,7 +437,7 @@ class DomainParticipant : public Entity
/**
* Locally ignore a topic.
*
* @note This action is not required to be reversible.
* @note This action is not reversible.
*
* @param handle Identifier of the topic to ignore
* @return RETURN_OK code if everything correct, error code otherwise
Expand All @@ -449,9 +449,9 @@ class DomainParticipant : public Entity
const InstanceHandle_t& handle);

/**
* Locally ignore a datawriter.
* Locally ignore a remote datawriter.
*
* @note This action is not required to be reversible.
* @note This action is not reversible.
*
* @param handle Identifier of the datawriter to ignore
* @return RETURN_OK code if everything correct, error code otherwise
Expand All @@ -463,9 +463,9 @@ class DomainParticipant : public Entity
const InstanceHandle_t& handle);

/**
* Locally ignore a datareader.
* Locally ignore a remote datareader.
*
* @note This action is not required to be reversible.
* @note This action is not reversible.
*
* @param handle Identifier of the datareader to ignore
* @return RETURN_OK code if everything correct, error code otherwise
Expand Down
98 changes: 83 additions & 15 deletions include/fastdds/dds/domain/DomainParticipantListener.hpp
MRicoIE2CS marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,48 @@ class DomainParticipantListener :
* This method is called when a new Participant is discovered, or a previously discovered participant changes
* its QOS or is removed.
*
* @param participant Pointer to the Participant which discovered the remote participant.
* @param info Remote participant information. User can take ownership of the object.
* @param[out] participant Pointer to the Participant which discovered the remote participant.
* @param[out] info Remote participant information. User can take ownership of the object.
*/
virtual void on_participant_discovery(
DomainParticipant* participant,
fastrtps::rtps::ParticipantDiscoveryInfo&& info)
{
(void)participant, (void)info;
static_cast<void>(participant);
static_cast<void>(info);
}

/*!
* This method is called when a new Participant is discovered, or a previously discovered participant changes
* its QOS or is removed.
*
* @param[out] participant Pointer to the Participant which discovered the remote participant.
* @param[out] info Remote participant information. User can take ownership of the object.
* @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant.
*/
virtual void on_participant_discovery(
DomainParticipant* participant,
fastrtps::rtps::ParticipantDiscoveryInfo&& info,
bool& should_be_ignored)
{
static_cast<void>(participant);
static_cast<void>(info);
static_cast<void>(should_be_ignored);
}

#if HAVE_SECURITY
/*!
* This method is called when a new Participant is authenticated.
*
* @param participant Pointer to the authenticated Participant.
* @param info Remote participant authentication information. User can take ownership of the object.
* @param[out] participant Pointer to the authenticated Participant.
* @param[out] info Remote participant authentication information. User can take ownership of the object.
*/
virtual void onParticipantAuthentication(
DomainParticipant* participant,
fastrtps::rtps::ParticipantAuthenticationInfo&& info)
{
(void)participant, (void)info;
static_cast<void>(participant);
static_cast<void>(info);
}

#endif // if HAVE_SECURITY
Expand All @@ -97,28 +117,66 @@ class DomainParticipantListener :
* This method is called when a new Subscriber is discovered, or a previously discovered subscriber changes
* its QOS or is removed.
*
* @param participant Pointer to the Participant which discovered the remote subscriber.
* @param info Remote subscriber information. User can take ownership of the object.
* @param[out] participant Pointer to the Participant which discovered the remote subscriber.
* @param[out] info Remote subscriber information. User can take ownership of the object.
*/
virtual void on_subscriber_discovery(
DomainParticipant* participant,
fastrtps::rtps::ReaderDiscoveryInfo&& info)
{
(void)participant, (void)info;
static_cast<void>(participant);
static_cast<void>(info);
}

/*!
* This method is called when a new Subscriber is discovered, or a previously discovered subscriber changes
* its QOS or is removed.
*
* @param[out] participant Pointer to the Participant which discovered the remote subscriber.
* @param[out] info Remote subscriber information. User can take ownership of the object.
* @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant.
*/
virtual void on_subscriber_discovery(
MRicoIE2CS marked this conversation as resolved.
Show resolved Hide resolved
DomainParticipant* participant,
fastrtps::rtps::ReaderDiscoveryInfo&& info,
bool& should_be_ignored)
{
static_cast<void>(participant);
static_cast<void>(info);
static_cast<void>(should_be_ignored);
}

/*!
* This method is called when a new Publisher is discovered, or a previously discovered publisher changes
* its QOS or is removed.
*
* @param participant Pointer to the Participant which discovered the remote publisher.
* @param info Remote publisher information. User can take ownership of the object.
* @param[out] participant Pointer to the Participant which discovered the remote publisher.
* @param[out] info Remote publisher information. User can take ownership of the object.
*/
virtual void on_publisher_discovery(
DomainParticipant* participant,
fastrtps::rtps::WriterDiscoveryInfo&& info)
{
(void)participant, (void)info;
static_cast<void>(participant);
static_cast<void>(info);
}

/*!
* This method is called when a new Publisher is discovered, or a previously discovered publisher changes
* its QOS or is removed.
*
* @param[out] participant Pointer to the Participant which discovered the remote publisher.
* @param[out] info Remote publisher information. User can take ownership of the object.
* @param[out] should_be_ignored Flag to indicate the library to automatically ignore the discovered Participant.
*/
virtual void on_publisher_discovery(
MRicoIE2CS marked this conversation as resolved.
Show resolved Hide resolved
DomainParticipant* participant,
fastrtps::rtps::WriterDiscoveryInfo&& info,
bool& should_be_ignored)
{
static_cast<void>(participant);
static_cast<void>(info);
static_cast<void>(should_be_ignored);
}

/*!
Expand All @@ -136,7 +194,12 @@ class DomainParticipantListener :
const fastrtps::types::TypeObject* object,
fastrtps::types::DynamicType_ptr dyn_type)
{
(void)participant, (void)request_sample_id, (void)topic, (void)identifier, (void)object, (void)dyn_type;
static_cast<void>(participant);
static_cast<void>(request_sample_id);
static_cast<void>(topic);
static_cast<void>(identifier);
static_cast<void>(object);
static_cast<void>(dyn_type);
}

/*!
Expand All @@ -149,7 +212,9 @@ class DomainParticipantListener :
const fastrtps::rtps::SampleIdentity& request_sample_id,
const fastrtps::types::TypeIdentifierWithSizeSeq& dependencies)
{
(void)participant, (void)request_sample_id, (void)dependencies;
static_cast<void>(participant);
static_cast<void>(request_sample_id);
static_cast<void>(dependencies);
}

/*!
Expand All @@ -161,7 +226,10 @@ class DomainParticipantListener :
const fastrtps::string_255 type_name,
const fastrtps::types::TypeInformation& type_information)
{
(void)participant, (void)topic_name, (void)type_name, (void)type_information;
static_cast<void>(participant);
static_cast<void>(topic_name);
static_cast<void>(type_name);
static_cast<void>(type_information);
}

// TODO: Methods in DomainParticipantListener (p.33 - DDS)
Expand Down
32 changes: 29 additions & 3 deletions include/fastdds/rtps/builtin/discovery/participant/PDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/participant/ParticipantDiscoveryInfo.h>
#include <fastdds/rtps/reader/ReaderDiscoveryInfo.h>
#include <fastdds/rtps/writer/WriterDiscoveryInfo.h>
#include <fastrtps/qos/QosPolicies.h>
#include <fastrtps/utils/ProxyPool.hpp>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>
Expand Down Expand Up @@ -223,20 +225,44 @@ class PDP

/**
* This method removes and deletes a ReaderProxyData object from its corresponding RTPSParticipant.
* @param reader_guid GUID_t of the reader to remove.
*
* @param[in] reader_guid GUID_t of the reader to remove.
* @return true if found and deleted.
*/
bool removeReaderProxyData(
const GUID_t& reader_guid);

/**
* This method removes and deletes a ReaderProxyData object from its corresponding RTPSParticipant.
*
* @param[in] reader_guid GUID_t of the reader to remove.
* @param[in] reason Why the reader is being removed (dropped, removed, or ignored)
* @return true if found and deleted.
*/
bool removeReaderProxyData(
const GUID_t& reader_guid,
ReaderDiscoveryInfo::DISCOVERY_STATUS reason);

/**
* This method removes and deletes a WriterProxyData object from its corresponding RTPSParticipant.
* @param writer_guid GUID_t of the wtiter to remove.
*
* @param[in] writer_guid GUID_t of the wtiter to remove.
* @return true if found and deleted.
*/
bool removeWriterProxyData(
const GUID_t& writer_guid);

/**
* This method removes and deletes a WriterProxyData object from its corresponding RTPSParticipant.
*
* @param[in] writer_guid GUID_t of the wtiter to remove.
* @param[in] reason Why the writer is being removed (dropped, removed, or ignored)
* @return true if found and deleted.
*/
bool removeWriterProxyData(
const GUID_t& writer_guid,
WriterDiscoveryInfo::DISCOVERY_STATUS reason);

/**
* Create the SPDP Writer and Reader
* @return True if correct.
Expand Down Expand Up @@ -276,7 +302,7 @@ class PDP
/**
* This method removes a remote RTPSParticipant and all its writers and readers.
* @param participant_guid GUID_t of the remote RTPSParticipant.
* @param reason Why the participant is being removed (dropped vs removed)
* @param reason Why the participant is being removed (dropped, removed, or ignored)
* @return true if correct.
*/
virtual bool remove_remote_participant(
Expand Down
3 changes: 2 additions & 1 deletion include/fastdds/rtps/participant/ParticipantDiscoveryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ struct ParticipantDiscoveryInfo
DISCOVERED_PARTICIPANT,
CHANGED_QOS_PARTICIPANT,
REMOVED_PARTICIPANT,
DROPPED_PARTICIPANT
DROPPED_PARTICIPANT,
IGNORED_PARTICIPANT
};

ParticipantDiscoveryInfo(
Expand Down
27 changes: 27 additions & 0 deletions include/fastdds/rtps/participant/RTPSParticipant.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,33 @@ class RTPS_DllAPI RTPSParticipant
*/
void enable();

/**
* @brief Ignore all messages coming from the RTPSParticipant
*
* @param[in] participant_guid RTPSParticipant GUID to be ignored
* @return True if correctly included into the ignore collection. False otherwise.
*/
bool ignore_participant(
const GuidPrefix_t& participant_guid);

/**
* @brief Ignore all messages coming from the RTPSWriter
*
* @param[in] writer_guid RTPSWriter GUID to be ignored
* @return True if correctly included into the ignore collection. False otherwise.
*/
bool ignore_writer(
const GUID_t& writer_guid);

/**
* @brief Ignore all messages coming from the RTPSReader
*
* @param[in] reader_guid RTPSReader GUID to be ignored
* @return True if correctly included into the ignore collection. False otherwise.
*/
bool ignore_reader(
const GUID_t& reader_guid);

#if HAVE_SECURITY

/**
Expand Down
Loading