Skip to content

Commit

Permalink
Migrate BuiltinEndpoints defines to variables (#4851)
Browse files Browse the repository at this point in the history
* Refs #20707: Migrate BuiltinEndpoints defines to namespaced constexpr

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Make private additional constants

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Update versions.md

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Apply Eliana's suggestions

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Rename ParticipantProxyData.h to ParticipantProxyData.hpp

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Uncrustify

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Exclude MockAccessControlPlugin.h from uncrustify

Signed-off-by: eduponz <[email protected]>

* Refs #20707: Fix uncrustify issue in ParticipantDiscoveryInfo.h

Signed-off-by: eduponz <[email protected]>

---------

Signed-off-by: eduponz <[email protected]>
  • Loading branch information
EduPonz committed Jun 3, 2024
1 parent 9902979 commit b002c1d
Show file tree
Hide file tree
Showing 53 changed files with 197 additions and 157 deletions.
58 changes: 34 additions & 24 deletions include/fastdds/rtps/builtin/data/BuiltinEndpoints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,39 @@
#ifndef FASTDDS_RTPS_BUILTIN_DATA__BUILTINENDPOINTS_HPP
#define FASTDDS_RTPS_BUILTIN_DATA__BUILTINENDPOINTS_HPP

#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER (0x00000001 << 0)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR (0x00000001 << 1)
#define DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER (0x00000001 << 2)
#define DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR (0x00000001 << 3)
#define DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER (0x00000001 << 4)
#define DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR (0x00000001 << 5)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_ANNOUNCER (0x00000001 << 6)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_DETECTOR (0x00000001 << 7)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_ANNOUNCER (0x00000001 << 8)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_DETECTOR (0x00000001 << 9)
#define BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER (0x00000001 << 10)
#define BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER (0x00000001 << 11)
#define BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_WRITER (0x00000001 << 12)
#define BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_READER (0x00000001 << 13)
#define BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_WRITER (0x00000001 << 14)
#define BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_READER (0x00000001 << 15)
#define DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_ANNOUNCER (0x00000001 << 16)
#define DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_DETECTOR (0x00000001 << 17)
#define DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_ANNOUNCER (0x00000001 << 18)
#define DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_DETECTOR (0x00000001 << 19)
#define BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_SECURE_DATA_WRITER (0x00000001 << 20)
#define BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_SECURE_DATA_READER (0x00000001 << 21)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_SECURE_ANNOUNCER (0x00000001 << 26)
#define DISC_BUILTIN_ENDPOINT_PARTICIPANT_SECURE_DETECTOR (0x00000001 << 27)
#include <cstdint>

namespace eprosima {
namespace fastdds {
namespace rtps {

constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER = 0x00000001 << 0;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR = 0x00000001 << 1;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER = 0x00000001 << 2;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR = 0x00000001 << 3;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER = 0x00000001 << 4;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR = 0x00000001 << 5;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_ANNOUNCER = 0x00000001 << 6;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_DETECTOR = 0x00000001 << 7;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_ANNOUNCER = 0x00000001 << 8;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_DETECTOR = 0x00000001 << 9;
constexpr uint32_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER = 0x00000001 << 10;
constexpr uint32_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER = 0x00000001 << 11;
constexpr uint32_t BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_WRITER = 0x00000001 << 12;
constexpr uint32_t BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_READER = 0x00000001 << 13;
constexpr uint32_t BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_WRITER = 0x00000001 << 14;
constexpr uint32_t BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_READER = 0x00000001 << 15;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_ANNOUNCER = 0x00000001 << 16;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PUBLICATION_SECURE_DETECTOR = 0x00000001 << 17;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_ANNOUNCER = 0x00000001 << 18;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_SECURE_DETECTOR = 0x00000001 << 19;
constexpr uint32_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_SECURE_DATA_WRITER = 0x00000001 << 20;
constexpr uint32_t BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_SECURE_DATA_READER = 0x00000001 << 21;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_SECURE_ANNOUNCER = 0x00000001 << 26;
constexpr uint32_t DISC_BUILTIN_ENDPOINT_PARTICIPANT_SECURE_DETECTOR = 0x00000001 << 27;

} // namespace rtps
} // namespace fastdds
} // namespace eprosima

#endif // FASTDDS_RTPS_BUILTIN_DATA__BUILTINENDPOINTS_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
// limitations under the License.

/**
* @file ParticipantProxyData.h
* @file ParticipantProxyData.hpp
*
*/

#ifndef _FASTDDS_RTPS_BUILTIN_DATA_PARTICIPANTPROXYDATA_H_
#define _FASTDDS_RTPS_BUILTIN_DATA_PARTICIPANTPROXYDATA_H_
#ifndef _FASTDDS_RTPS_BUILTIN_DATA_PARTICIPANTPROXYDATA_HPP_
#define _FASTDDS_RTPS_BUILTIN_DATA_PARTICIPANTPROXYDATA_HPP_

#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

Expand All @@ -33,9 +33,6 @@
#include <fastdds/rtps/common/Token.h>
#include <fastdds/rtps/common/VendorId_t.hpp>

#define BUILTIN_PARTICIPANT_DATA_MAX_SIZE 100
#define TYPELOOKUP_DATA_MAX_SIZE 5000

namespace eprosima {
namespace fastrtps {
namespace rtps {
Expand Down Expand Up @@ -237,4 +234,4 @@ class ParticipantProxyData

#endif // ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

#endif // _FASTDDS_RTPS_BUILTIN_DATA_PARTICIPANTPROXYDATA_H_
#endif // _FASTDDS_RTPS_BUILTIN_DATA_PARTICIPANTPROXYDATA_HPP_
5 changes: 4 additions & 1 deletion include/fastdds/rtps/participant/ParticipantDiscoveryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define _FASTDDS_RTPS_PARTICIPANT_PARTICIPANTDISCOVERYINFO_H__

#include <fastdds/fastdds_dll.hpp>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>

namespace eprosima {
namespace fastrtps {
Expand All @@ -35,6 +35,8 @@ struct ParticipantDiscoveryInfo
{
//!Enum DISCOVERY_STATUS, four different status for discovered participants.
//!@ingroup RTPS_MODULE
// *INDENT-OFF* eduponz: Does not understand the #if correctly and ends up removing the ;
// at the end of the enum, which does not build.
#if defined(_WIN32)
enum FASTDDS_EXPORTED_API DISCOVERY_STATUS
#else
Expand All @@ -47,6 +49,7 @@ struct ParticipantDiscoveryInfo
DROPPED_PARTICIPANT,
IGNORED_PARTICIPANT
};
// *INDENT-ON*

ParticipantDiscoveryInfo(
const ParticipantProxyData& data)
Expand Down
23 changes: 12 additions & 11 deletions src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
#include <fastdds/rtps/attributes/HistoryAttributes.h>
#include <fastdds/rtps/attributes/ReaderAttributes.h>
#include <fastdds/rtps/attributes/WriterAttributes.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/BuiltinEndpoints.hpp>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/common/CdrSerialization.hpp>
Expand Down Expand Up @@ -159,7 +160,7 @@ bool TypeLookupManager::assign_remote_endpoints(

EPROSIMA_LOG_INFO(TYPELOOKUP_SERVICE, "for RTPSParticipant: " << pdata.m_guid);

auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_WRITER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_WRITER;

if (auxendp != 0 && builtin_request_reader_ != nullptr)
{
Expand All @@ -170,7 +171,7 @@ bool TypeLookupManager::assign_remote_endpoints(
}

auxendp = endp;
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_WRITER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_WRITER;

if (auxendp != 0 && builtin_reply_reader_ != nullptr)
{
Expand All @@ -181,7 +182,7 @@ bool TypeLookupManager::assign_remote_endpoints(
}

auxendp = endp;
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_READER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_READER;

if (auxendp != 0 && builtin_request_writer_ != nullptr)
{
Expand All @@ -191,7 +192,7 @@ bool TypeLookupManager::assign_remote_endpoints(
}

auxendp = endp;
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_READER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_READER;

if (auxendp != 0 && builtin_reply_writer_ != nullptr)
{
Expand All @@ -213,8 +214,8 @@ void TypeLookupManager::remove_remote_endpoints(
uint32_t endp = pdata->m_availableBuiltinEndpoints;
uint32_t partdet = endp;
uint32_t auxendp = endp;
partdet &= DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR; //Habria que quitar esta linea que comprueba si tiene PDP.
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_WRITER;
partdet &= rtps::DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR; //Habria que quitar esta linea que comprueba si tiene PDP.
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_WRITER;

if ((auxendp != 0 || partdet != 0) && builtin_request_reader_ != nullptr)
{
Expand All @@ -224,7 +225,7 @@ void TypeLookupManager::remove_remote_endpoints(
}

auxendp = endp;
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_WRITER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_WRITER;

if ((auxendp != 0 || partdet != 0) && builtin_reply_reader_ != nullptr)
{
Expand All @@ -234,7 +235,7 @@ void TypeLookupManager::remove_remote_endpoints(
}

auxendp = endp;
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_READER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REQUEST_DATA_READER;

if ((auxendp != 0 || partdet != 0) && builtin_request_writer_ != nullptr)
{
Expand All @@ -244,7 +245,7 @@ void TypeLookupManager::remove_remote_endpoints(
}

auxendp = endp;
auxendp &= BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_READER;
auxendp &= rtps::BUILTIN_ENDPOINT_TYPELOOKUP_SERVICE_REPLY_DATA_READER;

if ((auxendp != 0 || partdet != 0) && builtin_reply_writer_ != nullptr)
{
Expand Down Expand Up @@ -497,7 +498,7 @@ bool TypeLookupManager::create_endpoints()
HistoryAttributes hatt;
hatt.initialReservedCaches = 20;
hatt.maximumReservedCaches = 1000;
hatt.payloadMaxSize = TYPELOOKUP_DATA_MAX_SIZE;
hatt.payloadMaxSize = TypeLookupManager::typelookup_data_max_size;

WriterAttributes watt;
watt.endpoint.unicastLocatorList = builtin_protocols_->m_metatrafficUnicastLocatorList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef _FASTDDS_BUILTIN_TYPE_LOOKUP_SERVICE_TYPE_LOOKUP_MANAGER_HPP_
#define _FASTDDS_BUILTIN_TYPE_LOOKUP_SERVICE_TYPE_LOOKUP_MANAGER_HPP_

#include <cstdint>
#include <mutex>
#include <unordered_map>
#include <vector>
Expand Down Expand Up @@ -436,6 +437,9 @@ class TypeLookupManager

//! Collection of all SampleIdentity and the TypeIdentfierWithSize it originated from, hashed by its SampleIdentity.
std::unordered_map<SampleIdentity, xtypes::TypeIdentfierWithSize> async_get_type_requests_;

//! Max size of TypeLookup messages.
static constexpr uint32_t typelookup_data_max_size = 5000;
};

} /* namespace builtin */
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <fastdds/topic/TopicProxy.hpp>
#include <fastdds/topic/TopicProxyFactory.hpp>
#include <fastdds/utils/QosConverters.hpp>
#include <rtps/builtin/liveliness/WLP.h>
#include <rtps/builtin/liveliness/WLP.hpp>
#include <rtps/RTPSDomainImpl.hpp>
#include <utils/SystemInfo.hpp>
#include <xmlparser/attributes/PublisherAttributes.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/fastdds/publisher/DataWriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <fastdds/rtps/RTPSDomain.h>
#include <fastdds/rtps/writer/RTPSWriter.h>

#include <rtps/builtin/liveliness/WLP.h>
#include <rtps/builtin/liveliness/WLP.hpp>
#include <rtps/DataSharing/DataSharingPayloadPool.hpp>
#include <rtps/history/CacheChangePool.h>
#include <rtps/history/TopicPayloadPoolRegistry.hpp>
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/BuiltinProtocols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <algorithm>

#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
#include <fastdds/rtps/common/Locator.h>
#include <fastdds/utils/IPFinder.h>

Expand All @@ -32,7 +32,7 @@
#include <rtps/builtin/discovery/participant/PDPClient.h>
#include <rtps/builtin/discovery/participant/PDPServer.hpp>
#include <rtps/builtin/discovery/participant/PDPSimple.h>
#include <rtps/builtin/liveliness/WLP.h>
#include <rtps/builtin/liveliness/WLP.hpp>
#include <rtps/participant/RTPSParticipantImpl.h>

using namespace eprosima::fastrtps;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/data/ParticipantProxyData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>

#include <chrono>
#include <mutex>
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <fastdds/core/policy/ParameterList.hpp>
#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/attributes/TopicAttributes.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/reader/ReaderListener.h>
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <mutex>

#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
#include <fastdds/rtps/builtin/data/ReaderProxyData.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/history/WriterHistory.h>
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDPServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define _FASTDDS_RTPS_EDPSERVER2_H_
#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC

#include <fastdds/rtps/builtin/data/ParticipantProxyData.h>
#include <fastdds/rtps/builtin/data/ParticipantProxyData.hpp>
#include <fastdds/rtps/common/CacheChange.h>

#include <rtps/builtin/discovery/database/DiscoveryDataBase.hpp>
Expand Down
Loading

0 comments on commit b002c1d

Please sign in to comment.