Skip to content

Commit

Permalink
Remove TopicAttributes from public APIs and make it private in `xml…
Browse files Browse the repository at this point in the history
…parser` (#5085)

* Refs #21357: Make TopicAttributes private and move to namespace

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Relay TopicAttributes references to xmlparser namespace

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Remove TopicAttributes references in DDS layer headers

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Remove TopicAttributes from RTPSDomain and weak forward declarations from RTPS headers

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Include PublicationBuiltinTopicData in RTPS and refactor some APIS to snake case

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Include SubscriptionBuiltinTopicData in RTPS and refactor some APIS to snake case

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Move BuiltinTopicKeyValue conversion helpers  to utils (make it accesible to DDS later)

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Add utility method to LocatorList

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Remove TopicAttributes from DataWriterHistory

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Add new get_publication_builtin_topic_data() to DataWriter

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Add new get_subscription_builtin_topic_data() to DataReader

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Refactor Data*Impl

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Add some mock methods and remove RTPS unittest

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Improve discovery server example test resilience

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Linter

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357: Update RTPS example

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>

* Refs #21357. Remove ReaderQos from register_reader.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Remove WriterQos from register_writer.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Refactor get_subscription_builtin_topic_data.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Refactor get_publication_builtin_topic_data.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Fix calculation of persistence_guid.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Builtin key conversion method not inline.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Fix doxygen on DataWriterHistory.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Refactor MonitorService.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Fix default initialization of builtin data structures.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Fix blackbox tests.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Improve `from_builtin_to_proxy`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Add `fill_type_information` to DomainParticipantImpl.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Refactor `register_writer` again.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Refactor `register_reader` again.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Fix blackbox build.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Fix content filter topic name.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Update `versions.md`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #21357. Apply suggestions on `versions.md`.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
Mario-DL and MiguelCompany authored Jul 30, 2024
1 parent 8e38577 commit 955828e
Show file tree
Hide file tree
Showing 89 changed files with 1,190 additions and 887 deletions.
5 changes: 5 additions & 0 deletions examples/cpp/discovery_server/ClientPublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ ClientPublisherApp::ClientPublisherApp(
wqos.durability().kind = VOLATILE_DURABILITY_QOS;
}

// So as not to overwriter the first sample
// if we publish inmediately after the discovery
// and the suscription is not prepared yet
wqos.history().depth = 5;

writer_ = publisher_->create_datawriter(topic_, wqos, this);

if (writer_ == nullptr)
Expand Down
11 changes: 5 additions & 6 deletions examples/cpp/rtps/ReaderApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <fastdds/rtps/attributes/HistoryAttributes.hpp>
#include <fastdds/rtps/attributes/ReaderAttributes.hpp>
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
#include <fastdds/rtps/attributes/TopicAttributes.hpp>
#include <fastdds/rtps/builtin/data/TopicDescription.hpp>
#include <fastdds/rtps/history/ReaderHistory.hpp>
#include <fastdds/rtps/participant/RTPSParticipant.hpp>
#include <fastdds/rtps/reader/RTPSReader.hpp>
Expand Down Expand Up @@ -114,17 +114,16 @@ ReaderApp::ReaderApp(

std::cout << "Registering RTPS Reader" << std::endl;

TopicAttributes topic_att;
topic_att.topicKind = NO_KEY;
topic_att.topicDataType = "HelloWorld";
topic_att.topicName = topic_name;
TopicDescription topic_desc;
topic_desc.topic_name = topic_name;
topic_desc.type_name = "HelloWorld";

eprosima::fastdds::dds::ReaderQos reader_qos;
reader_qos.m_durability.kind = eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS;
reader_qos.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS;

// Register entity
if (!rtps_participant_->registerReader(rtps_reader_, topic_att, reader_qos))
if (!rtps_participant_->register_reader(rtps_reader_, topic_desc, reader_qos))
{
throw std::runtime_error("Entity registration failed");
}
Expand Down
11 changes: 5 additions & 6 deletions examples/cpp/rtps/WriterApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include <fastdds/dds/publisher/qos/WriterQos.hpp>
#include <fastdds/rtps/attributes/HistoryAttributes.hpp>
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.hpp>
#include <fastdds/rtps/attributes/TopicAttributes.hpp>
#include <fastdds/rtps/attributes/WriterAttributes.hpp>
#include <fastdds/rtps/builtin/data/TopicDescription.hpp>
#include <fastdds/rtps/history/WriterHistory.hpp>
#include <fastdds/rtps/participant/RTPSParticipant.hpp>
#include <fastdds/rtps/RTPSDomain.hpp>
Expand Down Expand Up @@ -105,17 +105,16 @@ WriterApp::WriterApp(

std::cout << "Registering RTPS Writer" << std::endl;

TopicAttributes topic_att;
topic_att.topicKind = NO_KEY;
topic_att.topicDataType = "HelloWorld";
topic_att.topicName = topic_name;
TopicDescription topic_desc;
topic_desc.type_name = "HelloWorld";
topic_desc.topic_name = topic_name;

eprosima::fastdds::dds::WriterQos writer_qos;
writer_qos.m_durability.kind = eprosima::fastdds::dds::TRANSIENT_LOCAL_DURABILITY_QOS;
writer_qos.m_reliability.kind = eprosima::fastdds::dds::RELIABLE_RELIABILITY_QOS;

// Register entity
if (!rtps_participant_->registerWriter(rtps_writer_, topic_att, writer_qos))
if (!rtps_participant_->register_writer(rtps_writer_, topic_desc, writer_qos))
{
throw std::runtime_error("Entity registration failed");
}
Expand Down
14 changes: 13 additions & 1 deletion include/fastdds/dds/publisher/DataWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef FASTDDS_DDS_PUBLISHER__DATAWRITER_HPP
#define FASTDDS_DDS_PUBLISHER__DATAWRITER_HPP

#include <fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp>
#include <fastdds/dds/builtin/topic/SubscriptionBuiltinTopicData.hpp>
#include <fastdds/dds/core/Entity.hpp>
#include <fastdds/dds/core/ReturnCode.hpp>
Expand All @@ -28,9 +29,9 @@
#include <fastdds/dds/core/status/PublicationMatchedStatus.hpp>
#include <fastdds/dds/core/status/StatusMask.hpp>
#include <fastdds/dds/publisher/qos/DataWriterQos.hpp>
#include <fastdds/fastdds_dll.hpp>
#include <fastdds/rtps/common/LocatorList.hpp>
#include <fastdds/rtps/common/Time_t.hpp>
#include <fastdds/fastdds_dll.hpp>

namespace eprosima {
namespace fastdds {
Expand Down Expand Up @@ -584,6 +585,17 @@ class DataWriter : public DomainEntity
const InstanceHandle_t& handle,
const fastdds::dds::Duration_t& max_wait);

/**
* Retrieve the publication data discovery information.
*
* @param [out] publication_data The publication data discovery information.
*
* @return NOT_ENABLED if the writer has not been enabled.
* @return OK if the publication data is returned.
*/
FASTDDS_EXPORTED_API ReturnCode_t get_publication_builtin_topic_data(
PublicationBuiltinTopicData& publication_data) const;

protected:

DataWriterImpl* impl_;
Expand Down
3 changes: 0 additions & 3 deletions include/fastdds/dds/publisher/Publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class Publisher;

namespace eprosima {
namespace fastdds {

class TopicAttributes;

namespace rtps {

class IPayloadPool;
Expand Down
12 changes: 12 additions & 0 deletions include/fastdds/dds/subscriber/DataReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <vector>

#include <fastdds/dds/builtin/topic/PublicationBuiltinTopicData.hpp>
#include <fastdds/dds/builtin/topic/SubscriptionBuiltinTopicData.hpp>
#include <fastdds/dds/core/Entity.hpp>
#include <fastdds/dds/core/LoanableCollection.hpp>
#include <fastdds/dds/core/LoanableSequence.hpp>
Expand Down Expand Up @@ -1076,6 +1077,17 @@ class DataReader : public DomainEntity
FASTDDS_EXPORTED_API ReturnCode_t get_listening_locators(
rtps::LocatorList& locators) const;

/**
* Retrieve the subscription data discovery information.
*
* @param [out] subscription_data The subscription data discovery information.
*
* @return NOT_ENABLED if the reader has not been enabled.
* @return OK if the subscription data is returned.
*/
FASTDDS_EXPORTED_API ReturnCode_t get_subscription_builtin_topic_data(
SubscriptionBuiltinTopicData& subscription_data) const;

protected:

DataReaderImpl* impl_;
Expand Down
3 changes: 0 additions & 3 deletions include/fastdds/dds/subscriber/Subscriber.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ class Subscriber;

namespace eprosima {
namespace fastdds {

class TopicAttributes;

namespace rtps {

class IPayloadPool;
Expand Down
3 changes: 0 additions & 3 deletions include/fastdds/dds/subscriber/qos/DataReaderQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@
#include <fastdds/dds/subscriber/qos/ReaderQos.hpp>
#include <fastdds/dds/subscriber/qos/SubscriberQos.hpp>
#include <fastdds/rtps/attributes/ReaderAttributes.hpp>
#include <fastdds/rtps/attributes/TopicAttributes.hpp>
#include <fastdds/fastdds_dll.hpp>

namespace eprosima {
namespace fastdds {
namespace dds {

using TopicAttributesQos = fastdds::TopicAttributes;

//! Qos Policy to configure the DisablePositiveACKsQos and the reader attributes
class RTPSReliableReaderQos
{
Expand Down
1 change: 0 additions & 1 deletion include/fastdds/dds/topic/qos/TopicQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define FASTDDS_DDS_TOPIC_QOS__TOPICQOS_HPP

#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/rtps/attributes/TopicAttributes.hpp>

#include <fastdds/dds/log/Log.hpp>

Expand Down
13 changes: 0 additions & 13 deletions include/fastdds/rtps/RTPSDomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <fastdds/rtps/common/Types.hpp>
#include <fastdds/rtps/history/IPayloadPool.hpp>
#include <fastdds/rtps/history/IChangePool.hpp>
#include <fastdds/rtps/attributes/TopicAttributes.hpp>

namespace eprosima {
namespace fastdds {
Expand Down Expand Up @@ -251,18 +250,6 @@ class RTPSDomain
FASTDDS_EXPORTED_API static bool set_library_settings(
const fastdds::LibrarySettings& library_settings);

/**
* @brief Get the TopicAttributes from XML profile.
*
* @param profile_name Topic profile name.
* @param topic_att TopicAttributes object where the attributes are returned.
* @return bool true if the profile exists.
* false otherwise.
*/
FASTDDS_EXPORTED_API static bool get_topic_attributes_from_profile(
const std::string& profile_name,
TopicAttributes& topic_att);

private:

RTPSDomain() = delete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,16 @@ namespace rtps {
/// Structure PublicationBuiltinTopicData, contains the information on a discovered publication.
struct PublicationBuiltinTopicData
{
PublicationBuiltinTopicData()
{
reliability.kind = dds::RELIABLE_RELIABILITY_QOS;
}

/// Builtin topic Key
BuiltinTopicKey_t key;
BuiltinTopicKey_t key{{0, 0, 0}};

/// Builtin participant topic Key
BuiltinTopicKey_t participant_key;
BuiltinTopicKey_t participant_key{{0, 0, 0}};

/// Topic name
fastcdr::string_255 topic_name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ namespace rtps {
struct SubscriptionBuiltinTopicData
{
/// Builtin topic Key
BuiltinTopicKey_t key;
BuiltinTopicKey_t key{{0, 0, 0}};

/// Builtin participant topic Key
BuiltinTopicKey_t participant_key;
BuiltinTopicKey_t participant_key{{0, 0, 0}};

/// Topic name
fastcdr::string_255 topic_name;
Expand Down
51 changes: 51 additions & 0 deletions include/fastdds/rtps/builtin/data/TopicDescription.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// 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 TopicDescription.hpp
*/

#ifndef FASTDDS_RTPS_BUILTIN_DATA__TOPICDESCRIPTION_HPP
#define FASTDDS_RTPS_BUILTIN_DATA__TOPICDESCRIPTION_HPP

#include <cstdint>
#include <string>

#include <fastcdr/cdr/fixed_size_string.hpp>

#include <fastdds/dds/core/policy/QosPolicies.hpp>

namespace eprosima {
namespace fastdds {
namespace rtps {

/// Structure TopicDescription, used to register an endpoint on a topic.
struct TopicDescription
{
/// Topic name
fastcdr::string_255 topic_name;

/// Type name
fastcdr::string_255 type_name;

/// Type information
dds::xtypes::TypeInformationParameter type_information;

};

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

#endif // FASTDDS_RTPS_BUILTIN_DATA__TOPICDESCRIPTION_HPP
11 changes: 11 additions & 0 deletions include/fastdds/rtps/common/LocatorList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <fastdds/rtps/common/Locator.hpp>
#include <fastdds/rtps/common/LocatorsIterator.hpp>
#include <fastdds/utils/collections/ResourceLimitedVector.hpp>

#include <vector>
#include <cstdint>
Expand Down Expand Up @@ -376,6 +377,16 @@ class LocatorList
return false;
}

// Copy the inner locator list to a ResourceLimitedVector locator list.
FASTDDS_EXPORTED_API void copy_to(
eprosima::fastdds::ResourceLimitedVector<Locator>& locator_list) const
{
for (auto& locator : m_locators)
{
locator_list.emplace_back(locator);
}
}

private:

std::vector<Locator> m_locators;
Expand Down
Loading

0 comments on commit 955828e

Please sign in to comment.