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

[19378] Add XML support for ThreadSettings #3922

Merged
merged 29 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0a7adac
Refs #19378: Add threadSettingsTypes to XSD schema
EduPonz Oct 3, 2023
f6321d2
Refs #19378: Add unit test for parsing thread_settings XML elements
EduPonz Oct 4, 2023
f0a5a8a
Refs #19378: Add getXMLThreadSettings to XMLElementParser
EduPonz Oct 4, 2023
1682306
Refs #19378: Add Log test cases to XMLProfileParserBasicTests.thread_…
EduPonz Oct 4, 2023
025aa6f
Refs #19378: Add XML ThreadSettings config to Log
EduPonz Oct 4, 2023
cfd8efb
Refs #19378: Add domainparticipant_factory XML tag tests
EduPonz Oct 6, 2023
0b4e667
Refs #19378: Add domainparticipant_factory XSD
EduPonz Oct 6, 2023
b26692c
Refs #19378: Add XML ThreadSettings config to DomainParticipantFactory
EduPonz Oct 6, 2023
865b42c
Refs #19378: Add getXMLEntityFactoryQos unit test
EduPonz Oct 7, 2023
25f9cf2
Refs #19378: Add domainparticipant XML thread settings tests
EduPonz Oct 7, 2023
b6448a3
Refs #19378: Add XML ThreadSettings config to DomainParticipant
EduPonz Oct 7, 2023
6328d1d
Refs #19378: Uncrustify
EduPonz Oct 7, 2023
7686b45
Refs #19378: Add parseXMLReceptionThreads API & unit test
EduPonz Oct 8, 2023
adec591
Refs #19378: Add transport descriptor XML thread settings tests
EduPonz Oct 8, 2023
79cf877
Refs #19378: Add parseXMLReceptionThreads implementation
EduPonz Oct 10, 2023
e19d994
Refs #19378: Add transport descriptor XML thread settings config
EduPonz Oct 10, 2023
17c1f82
Refs #19378: Add datareader XML thread settings tests
EduPonz Oct 10, 2023
ed75be6
Refs #19378: Add datareader XML thread settings
EduPonz Oct 10, 2023
0407ba2
Refs #19378: Add builtin_transports_reception_threads to domainpartic…
EduPonz Oct 10, 2023
46953ce
Refs #19378: Add builtin_transports_reception_threads to domainpartic…
EduPonz Oct 10, 2023
c83b97e
Refs #19378: Fix Windows warning regarding sscanf
EduPonz Oct 11, 2023
8bbacec
Refs #19378: Fix flow controllers unittests build when using Fast CDR…
EduPonz Oct 11, 2023
59e3e62
Refs #19378: Apply Miguel's suggestions
EduPonz Oct 23, 2023
10a45b0
Refs #19378: Apply some other suggestions
EduPonz Oct 24, 2023
41e113d
Refs #19378. OSx has neither `SCHED_BATCH` nor `SCHED_IDLE`
MiguelCompany Oct 24, 2023
ee3af5d
Refs #19378. Check result on pthread_setschedparam
MiguelCompany Oct 24, 2023
40a86b4
Refs #19378. Add include on `threading_osx.ipp`
MiguelCompany Oct 24, 2023
d2a3213
Refs #19378. Avoid using gettid on `threading_osx.ipp`
MiguelCompany Oct 24, 2023
d4eab38
Refs #19378: Fix mac warning
EduPonz Oct 26, 2023
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
36 changes: 36 additions & 0 deletions include/fastdds/dds/core/policy/QosPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2951,6 +2951,7 @@ class DataSharingQosPolicy : public Parameter_t, public QosPolicy
max_domains_ :
b.domain_ids().size());
domain_ids_ = b.domain_ids();
data_sharing_listener_thread_ = b.data_sharing_listener_thread();

return *this;
}
Expand All @@ -2961,6 +2962,7 @@ class DataSharingQosPolicy : public Parameter_t, public QosPolicy
return kind_ == b.kind_ &&
shm_directory_ == b.shm_directory_ &&
domain_ids_ == b.domain_ids_ &&
data_sharing_listener_thread_ == b.data_sharing_listener_thread_ &&
Parameter_t::operator ==(b) &&
QosPolicy::operator ==(b);
}
Expand Down Expand Up @@ -3137,6 +3139,37 @@ class DataSharingQosPolicy : public Parameter_t, public QosPolicy
}
}

/**
* Getter for DataSharing listener thread ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
rtps::ThreadSettings& data_sharing_listener_thread()
{
return data_sharing_listener_thread_;
}

/**
* Getter for DataSharing listener thread ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
const rtps::ThreadSettings& data_sharing_listener_thread() const
{
return data_sharing_listener_thread_;
}

/**
* Setter for the DataSharing listener thread ThreadSettings
*
* @param value New ThreadSettings to be set
*/
void data_sharing_listener_thread(
const rtps::ThreadSettings& value)
{
data_sharing_listener_thread_ = value;
}

private:

void setup(
Expand Down Expand Up @@ -3165,6 +3198,9 @@ class DataSharingQosPolicy : public Parameter_t, public QosPolicy

//! Only endpoints with matching domain IDs are DataSharing compatible
std::vector<uint64_t> domain_ids_;

//! Thread settings for the DataSharing listener thread
rtps::ThreadSettings data_sharing_listener_thread_;
};


Expand Down
38 changes: 1 addition & 37 deletions include/fastdds/dds/subscriber/qos/DataReaderQos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <fastdds/dds/subscriber/qos/ReaderQos.hpp>
#include <fastdds/dds/subscriber/qos/SubscriberQos.hpp>
#include <fastdds/rtps/attributes/ReaderAttributes.h>
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastrtps/attributes/TopicAttributes.h>
#include <fastrtps/fastrtps_dll.h>

Expand Down Expand Up @@ -208,8 +207,7 @@ class DataReaderQos
(properties_ == b.properties()) &&
(endpoint_ == b.endpoint()) &&
(reader_resource_limits_ == b.reader_resource_limits()) &&
(data_sharing_ == b.data_sharing()) &&
(data_sharing_listener_thread_ == b.data_sharing_listener_thread());
(data_sharing_ == b.data_sharing());
}

RTPS_DllAPI ReaderQos get_readerqos(
Expand Down Expand Up @@ -856,37 +854,6 @@ class DataReaderQos
data_sharing_ = data_sharing;
}

/**
* Getter for data sharing listener ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
RTPS_DllAPI rtps::ThreadSettings& data_sharing_listener_thread()
{
return data_sharing_listener_thread_;
}

/**
* Getter for data sharing listener ThreadSettings
*
* @return rtps::ThreadSettings reference
*/
RTPS_DllAPI const rtps::ThreadSettings& data_sharing_listener_thread() const
{
return data_sharing_listener_thread_;
}

/**
* Setter for data sharing listener ThreadSettings
*
* @param data_sharing_listener_thread new value for the rtps::ThreadSettings
*/
RTPS_DllAPI void data_sharing_listener_thread(
const rtps::ThreadSettings& data_sharing_listener_thread)
{
data_sharing_listener_thread_ = data_sharing_listener_thread;
}

private:

//!Durability Qos, implemented in the library.
Expand Down Expand Up @@ -951,9 +918,6 @@ class DataReaderQos

//!DataSharing configuration (Extension)
DataSharingQosPolicy data_sharing_;

//! Thread settings for the data-sharing listener thread
rtps::ThreadSettings data_sharing_listener_thread_;
};

RTPS_DllAPI extern const DataReaderQos DATAREADER_QOS_DEFAULT;
Expand Down
12 changes: 11 additions & 1 deletion include/fastdds/rtps/attributes/RTPSParticipantAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,14 @@ class RTPSParticipantAttributes
(this->properties == b.properties) &&
(this->prefix == b.prefix) &&
(this->flow_controllers == b.flow_controllers) &&
(this->builtin_controllers_sender_thread == b.builtin_controllers_sender_thread);
(this->builtin_controllers_sender_thread == b.builtin_controllers_sender_thread) &&
(this->timed_events_thread == b.timed_events_thread) &&
#if HAVE_SECURITY
(this->security_log_thread == b.security_log_thread) &&
#endif // if HAVE_SECURITY
(this->discovery_server_thread == b.discovery_server_thread) &&
(this->builtin_transports_reception_threads == b.builtin_transports_reception_threads);

}

/**
Expand Down Expand Up @@ -588,6 +595,9 @@ class RTPSParticipantAttributes
//! Thread settings for the discovery server thread
fastdds::rtps::ThreadSettings discovery_server_thread;

//! Thread settings for the builtin transports reception threads
fastdds::rtps::ThreadSettings builtin_transports_reception_threads;

#if HAVE_SECURITY
//! Thread settings for the security log thread
fastdds::rtps::ThreadSettings security_log_thread;
Expand Down
79 changes: 70 additions & 9 deletions include/fastrtps/xmlparser/XMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,26 @@
#ifndef XML_PARSER_H_
#define XML_PARSER_H_

#include <stdio.h>
#include <fastrtps/transport/TransportDescriptorInterface.h>
#include <cstdint>
#include <cstdio>
#include <map>
#include <memory>
#include <string>

#include <fastdds/dds/core/policy/QosPolicies.hpp>
#include <fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp>
#include <fastdds/rtps/attributes/ThreadSettings.hpp>
#include <fastdds/rtps/transport/PortBasedTransportDescriptor.hpp>
#include <fastdds/rtps/transport/SocketTransportDescriptor.h>
#include <fastrtps/attributes/LibrarySettingsAttributes.h>
#include <fastrtps/attributes/ParticipantAttributes.h>
#include <fastrtps/attributes/PublisherAttributes.h>
#include <fastrtps/attributes/SubscriberAttributes.h>
#include <fastrtps/attributes/RequesterAttributes.hpp>
#include <fastrtps/attributes/ReplierAttributes.hpp>
#include <fastrtps/xmlparser/XMLParserCommon.h>
#include <fastrtps/attributes/RequesterAttributes.hpp>
#include <fastrtps/attributes/SubscriberAttributes.h>
#include <fastrtps/transport/TransportDescriptorInterface.h>
#include <fastrtps/types/DynamicTypeBuilderPtr.h>
#include <fastrtps/attributes/LibrarySettingsAttributes.h>

#include <map>
#include <string>
#include <fastrtps/xmlparser/XMLParserCommon.h>

namespace tinyxml2 {
class XMLElement;
Expand All @@ -52,6 +59,11 @@ typedef std::map<std::string, sp_transport_t> sp_transport_map_t;
typedef types::DynamicTypeBuilder* p_dynamictypebuilder_t;
typedef std::map<std::string, p_dynamictypebuilder_t> p_dynamictype_map_t;

typedef std::unique_ptr<fastdds::dds::DomainParticipantFactoryQos> up_participantfactory_t;
typedef DataNode<fastdds::dds::DomainParticipantFactoryQos> node_participantfactory_t;
typedef node_participantfactory_t* p_node_participantfactory_t;
typedef std::unique_ptr<node_participantfactory_t> up_node_participantfactory_t;

typedef std::unique_ptr<ParticipantAttributes> up_participant_t;
typedef DataNode<ParticipantAttributes> node_participant_t;
typedef node_participant_t* p_node_participant_t;
Expand Down Expand Up @@ -177,6 +189,10 @@ class XMLParser
RTPS_DllAPI static XMLP_ret parseXMLTransportsProf(
tinyxml2::XMLElement* p_root);

RTPS_DllAPI static XMLP_ret parseXMLDomainParticipantFactoryProf(
tinyxml2::XMLElement* p_root,
BaseNode& rootNode);

RTPS_DllAPI static XMLP_ret parseXMLParticipantProf(
tinyxml2::XMLElement* p_root,
BaseNode& rootNode);
Expand Down Expand Up @@ -204,10 +220,21 @@ class XMLParser
RTPS_DllAPI static XMLP_ret parseXMLTransportData(
tinyxml2::XMLElement* p_root);

RTPS_DllAPI static XMLP_ret validateXMLTransportElements(
tinyxml2::XMLElement& p_root);

RTPS_DllAPI static XMLP_ret parseXMLCommonTransportData(
tinyxml2::XMLElement* p_root,
sp_transport_t p_transport);

RTPS_DllAPI static XMLP_ret parseXMLPortBasedTransportData(
tinyxml2::XMLElement* p_root,
std::shared_ptr<fastdds::rtps::PortBasedTransportDescriptor> p_transport);

RTPS_DllAPI static XMLP_ret parseXMLSocketTransportData(
tinyxml2::XMLElement* p_root,
std::shared_ptr<fastdds::rtps::SocketTransportDescriptor> p_transport);

RTPS_DllAPI static XMLP_ret parseXMLCommonTCPTransportData(
tinyxml2::XMLElement* p_root,
sp_transport_t p_transport);
Expand All @@ -220,6 +247,10 @@ class XMLParser
tinyxml2::XMLElement* p_root,
sp_transport_t tcp_transport);

RTPS_DllAPI static XMLP_ret parseXMLReceptionThreads(
tinyxml2::XMLElement& p_root,
fastdds::rtps::PortBasedTransportDescriptor::ReceptionThreadsConfigMap& reception_threads);

/**
* Load a XML consumer node and parses it. Adds the parsed consumer to Log directly.
* @param consumer Node to be loaded.
Expand Down Expand Up @@ -280,6 +311,10 @@ class XMLParser
types::MemberId mId,
const std::string& values);

RTPS_DllAPI static XMLP_ret fillDataNode(
tinyxml2::XMLElement* p_profile,
DataNode<fastdds::dds::DomainParticipantFactoryQos>& factory_node);

RTPS_DllAPI static XMLP_ret fillDataNode(
tinyxml2::XMLElement* p_profile,
DataNode<ParticipantAttributes>& participant_node);
Expand Down Expand Up @@ -549,6 +584,11 @@ class XMLParser
uint16_t* ui16,
uint8_t ident);

RTPS_DllAPI static XMLP_ret getXMLUint(
tinyxml2::XMLElement* elem,
uint64_t* ui64,
uint8_t ident);

RTPS_DllAPI static XMLP_ret getXMLBool(
tinyxml2::XMLElement* elem,
bool* b,
Expand Down Expand Up @@ -599,6 +639,10 @@ class XMLParser
rtps::GuidPrefix_t& prefix,
uint8_t ident);

RTPS_DllAPI static XMLP_ret getXMLDomainParticipantFactoryQos(
tinyxml2::XMLElement& elem,
fastdds::dds::DomainParticipantFactoryQos& qos);

RTPS_DllAPI static XMLP_ret getXMLPublisherAttributes(
tinyxml2::XMLElement* elem,
PublisherAttributes& publisher,
Expand All @@ -608,6 +652,23 @@ class XMLParser
tinyxml2::XMLElement* elem,
SubscriberAttributes& subscriber,
uint8_t ident);

RTPS_DllAPI static XMLP_ret getXMLThreadSettings(
tinyxml2::XMLElement& elem,
fastdds::rtps::ThreadSettings& thread_setting);

/*
Return XMLP_ret::XML_OK when OK, XMLP_ret::XML_NOK when port attribute is not present, and
XMLP_ret::XML_ERROR if error
*/
RTPS_DllAPI static XMLP_ret getXMLThreadSettingsWithPort(
tinyxml2::XMLElement& elem,
fastdds::rtps::ThreadSettings& thread_setting,
uint32_t& port);

RTPS_DllAPI static XMLP_ret getXMLEntityFactoryQos(
tinyxml2::XMLElement& elem,
fastdds::dds::EntityFactoryQosPolicy& entity_factory);
};

} // namespace xmlparser
Expand Down
22 changes: 22 additions & 0 deletions include/fastrtps/xmlparser/XMLParserCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ extern const char* LIBRARY_SETTINGS;
extern const char* TRANSPORT_DESCRIPTORS;
extern const char* PROFILE_NAME;
extern const char* DEFAULT_PROF;
extern const char* DOMAINPARTICIPANT_FACTORY;
extern const char* PARTICIPANT;
extern const char* PUBLISHER;
extern const char* SUBSCRIBER;
Expand Down Expand Up @@ -80,8 +81,17 @@ extern const char* HEALTHY_CHECK_TIMEOUT_MS;
extern const char* DISCARD;
extern const char* FAIL;
extern const char* RTPS_DUMP_FILE;
extern const char* DEFAULT_RECEPTION_THREADS;
extern const char* RECEPTION_THREADS;
extern const char* RECEPTION_THREAD;
extern const char* DUMP_THREAD;
extern const char* ON;
extern const char* AUTO;
extern const char* THREAD_SETTINGS;
extern const char* SCHEDULING_POLICY;
extern const char* PRIORITY;
extern const char* AFFINITY;
extern const char* STACK_SIZE;

// IntraprocessDeliveryType
extern const char* OFF;
Expand All @@ -98,6 +108,12 @@ extern const char* DATA_READER;
/// LibrarySettings attributes
extern const char* INTRAPROCESS_DELIVERY;

/// DomainParticipantFactory Qos
extern const char* ENTITY_FACTORY;
extern const char* AUTOENABLE_CREATED_ENTITIES;
extern const char* SHM_WATCHDOG_THREAD;
extern const char* FILE_WATCH_THREADS;

/// RTPS Participant attributes
extern const char* ALLOCATION;
extern const char* PREFIX;
Expand Down Expand Up @@ -132,6 +148,11 @@ extern const char* DYNAMIC_LC;
extern const char* MAX_PROPERTIES;
extern const char* MAX_USER_DATA;
extern const char* MAX_PARTITIONS;
extern const char* TIMED_EVENTS_THREAD;
extern const char* DISCOVERY_SERVER_THREAD;
extern const char* SECURITY_LOG_THREAD;
extern const char* BUILTIN_TRANSPORTS_RECEPTION_THREADS;
extern const char* BUILTIN_CONTROLLERS_SENDER_THREAD;

/// Publisher-subscriber attributes
extern const char* TOPIC;
Expand All @@ -149,6 +170,7 @@ extern const char* USER_DEF_ID;
extern const char* ENTITY_ID;
extern const char* MATCHED_SUBSCRIBERS_ALLOCATION;
extern const char* MATCHED_PUBLISHERS_ALLOCATION;
extern const char* DATA_SHARING_LISTENER_THREAD;

///
extern const char* IGN_NON_MATCHING_LOCS;
Expand Down
Loading