| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
DomainParticipantFactory.hpp
1// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
19
20#ifndef FASTDDS_DDS_DOMAIN__DOMAINPARTICIPANTFACTORY_HPP
21#define FASTDDS_DDS_DOMAIN__DOMAINPARTICIPANTFACTORY_HPP
22
23#include <map>
24#include <memory>
25#include <mutex>
26
27#include <fastdds/dds/core/ReturnCode.hpp>
28#include <fastdds/dds/core/status/StatusMask.hpp>
29#include <fastdds/dds/domain/qos/DomainParticipantExtendedQos.hpp>
30#include <fastdds/dds/domain/qos/DomainParticipantFactoryQos.hpp>
31#include <fastdds/dds/domain/qos/DomainParticipantQos.hpp>
32#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>
33#include <fastdds/dds/xtypes/dynamic_types/DynamicTypeBuilder.hpp>
34#include <fastdds/dds/xtypes/type_representation/ITypeObjectRegistry.hpp>
35#include <fastdds/LibrarySettings.hpp>
36
37 namespace eprosima {
38
39 namespace fastdds {
40 namespace rtps {
41
42 class RTPSDomainImpl;
43
44 namespace detail {
45 class TopicPayloadPoolRegistry;
46} // namespace detail
47} // namespace rtps
48
49 namespace dds {
50
51 class DomainParticipantListener;
52 class DomainParticipant;
53 class DomainParticipantImpl;
54
55 namespace detail {
56 struct LogResources;
57} // namespace detail
58
64 class DomainParticipantFactory
65{
66
67 public:
68
74 FASTDDS_EXPORTED_API static DomainParticipantFactory* get_instance();
75
81 FASTDDS_EXPORTED_API static std::shared_ptr<DomainParticipantFactory> get_shared_instance();
82
92 FASTDDS_EXPORTED_API DomainParticipant* create_participant(
93 DomainId_t domain_id,
94 const DomainParticipantQos& qos,
95 DomainParticipantListener* listener = nullptr,
96 const StatusMask& mask = StatusMask::all());
97
106 FASTDDS_EXPORTED_API DomainParticipant* create_participant(
107 const DomainParticipantExtendedQos& extended_qos,
108 DomainParticipantListener* listener = nullptr,
109 const StatusMask& mask = StatusMask::all());
110
116 FASTDDS_EXPORTED_API DomainParticipant* create_participant_with_default_profile();
117
118
126 FASTDDS_EXPORTED_API DomainParticipant* create_participant_with_default_profile(
127 DomainParticipantListener* listener,
128 const StatusMask& mask);
129
139 FASTDDS_EXPORTED_API DomainParticipant* create_participant_with_profile(
140 DomainId_t domain_id,
141 const std::string& profile_name,
142 DomainParticipantListener* listener = nullptr,
143 const StatusMask& mask = StatusMask::all());
144
153 FASTDDS_EXPORTED_API DomainParticipant* create_participant_with_profile(
154 const std::string& profile_name,
155 DomainParticipantListener* listener = nullptr,
156 const StatusMask& mask = StatusMask::all());
157
167 FASTDDS_EXPORTED_API DomainParticipant* lookup_participant(
168 DomainId_t domain_id) const;
169
176 FASTDDS_EXPORTED_API std::vector<DomainParticipant*> lookup_participants(
177 DomainId_t domain_id) const;
178
189 FASTDDS_EXPORTED_API ReturnCode_t get_default_participant_qos(
190 DomainParticipantQos& qos) const;
191
201 FASTDDS_EXPORTED_API const DomainParticipantQos& get_default_participant_qos() const;
202
218 FASTDDS_EXPORTED_API ReturnCode_t set_default_participant_qos(
219 const DomainParticipantQos& qos);
220
228 FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_profile(
229 const std::string& profile_name,
230 DomainParticipantQos& qos) const;
231
239 FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_xml(
240 const std::string& xml,
241 DomainParticipantQos& qos) const;
242
251 FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_xml(
252 const std::string& xml,
253 DomainParticipantQos& qos,
254 const std::string& profile_name) const;
255
265 FASTDDS_EXPORTED_API ReturnCode_t get_default_participant_qos_from_xml(
266 const std::string& xml,
267 DomainParticipantQos& qos) const;
268
276 FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_profile(
277 const std::string& profile_name,
278 DomainParticipantExtendedQos& extended_qos) const;
279
287 FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_xml(
288 const std::string& xml,
289 DomainParticipantExtendedQos& extended_qos) const;
290
299 FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_xml(
300 const std::string& xml,
301 DomainParticipantExtendedQos& extended_qos,
302 const std::string& profile_name) const;
303
313 FASTDDS_EXPORTED_API ReturnCode_t get_default_participant_extended_qos_from_xml(
314 const std::string& xml,
315 DomainParticipantExtendedQos& extended_qos) const;
316
323 FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_default_profile(
324 DomainParticipantExtendedQos& extended_qos) const;
325
333 FASTDDS_EXPORTED_API ReturnCode_t delete_participant(
334 DomainParticipant* part);
335
341 FASTDDS_EXPORTED_API ReturnCode_t load_profiles();
342
349 FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_file(
350 const std::string& xml_profile_file);
351
359 FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_string(
360 const char* data,
361 size_t length);
362
369 FASTDDS_EXPORTED_API ReturnCode_t check_xml_static_discovery(
370 std::string& xml_file);
371
378 FASTDDS_EXPORTED_API ReturnCode_t get_qos(
379 DomainParticipantFactoryQos& qos) const;
380
394 FASTDDS_EXPORTED_API ReturnCode_t set_qos(
395 const DomainParticipantFactoryQos& qos);
396
403 FASTDDS_EXPORTED_API ReturnCode_t get_library_settings(
404 LibrarySettings& library_settings) const;
405
416 FASTDDS_EXPORTED_API ReturnCode_t set_library_settings(
417 const LibrarySettings& library_settings);
418
429 FASTDDS_EXPORTED_API ReturnCode_t get_dynamic_type_builder_from_xml_by_name(
430 const std::string& type_name,
431 DynamicTypeBuilder::_ref_type& type);
432
438 FASTDDS_EXPORTED_API xtypes::ITypeObjectRegistry& type_object_registry();
439
440 protected:
441
442 friend class DomainParticipant;
443
444 std::map<DomainId_t, std::vector<DomainParticipantImpl*>> participants_;
445
446 DomainParticipantFactory();
447
448 virtual ~DomainParticipantFactory();
449
450 DomainParticipantFactory (
451 const DomainParticipantFactory&) = delete;
452
453 void operator = (
454 const DomainParticipantFactory&) = delete;
455
456 void reset_default_participant_qos();
457
458 static void set_qos(
459 DomainParticipantFactoryQos& to,
460 const DomainParticipantFactoryQos& from,
461 bool first_time);
462
463 static ReturnCode_t check_qos(
464 const DomainParticipantFactoryQos& qos);
465
466 static bool can_qos_be_updated(
467 const DomainParticipantFactoryQos& to,
468 const DomainParticipantFactoryQos& from);
469
470 void participant_has_been_deleted(
471 DomainParticipantImpl* part);
472
473 mutable std::mutex mtx_participants_;
474
475 mutable bool default_xml_profiles_loaded;
476
477 DomainId_t default_domain_id_;
478
479 DomainParticipantFactoryQos factory_qos_;
480
481 DomainParticipantQos default_participant_qos_;
482
483 std::shared_ptr<fastdds::rtps::detail::TopicPayloadPoolRegistry> topic_pool_;
484
485 std::shared_ptr<fastdds::rtps::RTPSDomainImpl> rtps_domain_;
486
487 std::shared_ptr<detail::LogResources> log_resources_;
488
494 mutable std::mutex default_xml_profiles_loaded_mtx_;
495};
496
497} // namespace dds
498} // namespace fastdds
499} // namespace eprosima
500
501#endif // FASTDDS_DDS_DOMAIN__DOMAINPARTICIPANTFACTORY_HPP
eprosima::fastdds::LibrarySettings
Class LibraySettings, used by the user to define the Fast DDS library behaviour.
Definition LibrarySettings.hpp:38
eprosima::fastdds::dds::DomainParticipantExtendedQos
Definition DomainParticipantExtendedQos.hpp:32
eprosima::fastdds::dds::DomainParticipantFactory::set_qos
static void set_qos(DomainParticipantFactoryQos &to, const DomainParticipantFactoryQos &from, bool first_time)
eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_default_profile
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_default_profile(DomainParticipantListener *listener, const StatusMask &mask)
Create a Participant with default domain id and qos.
eprosima::fastdds::dds::DomainParticipantFactory::default_xml_profiles_loaded
bool default_xml_profiles_loaded
Definition DomainParticipantFactory.hpp:475
eprosima::fastdds::dds::DomainParticipantFactory::topic_pool_
std::shared_ptr< fastdds::rtps::detail::TopicPayloadPoolRegistry > topic_pool_
Definition DomainParticipantFactory.hpp:483
eprosima::fastdds::dds::DomainParticipantFactory::DomainParticipant
friend class DomainParticipant
Definition DomainParticipantFactory.hpp:442
eprosima::fastdds::dds::DomainParticipantFactory::DomainParticipantFactory
DomainParticipantFactory(const DomainParticipantFactory &)=delete
eprosima::fastdds::dds::DomainParticipantFactory::set_library_settings
FASTDDS_EXPORTED_API ReturnCode_t set_library_settings(const LibrarySettings &library_settings)
This operation sets the library settings.
eprosima::fastdds::dds::DomainParticipantFactory::set_qos
FASTDDS_EXPORTED_API ReturnCode_t set_qos(const DomainParticipantFactoryQos &qos)
This operation sets the value of the DomainParticipantFactory QoS policies.
eprosima::fastdds::dds::DomainParticipantFactory::~DomainParticipantFactory
virtual ~DomainParticipantFactory()
eprosima::fastdds::dds::DomainParticipantFactory::operator=
void operator=(const DomainParticipantFactory &)=delete
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_extended_qos_from_xml
FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_xml(const std::string &xml, DomainParticipantExtendedQos &extended_qos, const std::string &profile_name) const
Fills the DomainParticipantExtendedQos with the DomainParticipant profile with profile_name to be fou...
eprosima::fastdds::dds::DomainParticipantFactory::get_library_settings
FASTDDS_EXPORTED_API ReturnCode_t get_library_settings(LibrarySettings &library_settings) const
This operation returns the value of the DomainParticipant library settings.
eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_profile
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_profile(const std::string &profile_name, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
eprosima::fastdds::dds::DomainParticipantFactory::default_xml_profiles_loaded_mtx_
std::mutex default_xml_profiles_loaded_mtx_
This mutex guards the access to load the profiles.
Definition DomainParticipantFactory.hpp:494
eprosima::fastdds::dds::DomainParticipantFactory::get_qos
FASTDDS_EXPORTED_API ReturnCode_t get_qos(DomainParticipantFactoryQos &qos) const
This operation returns the value of the DomainParticipantFactory QoS policies.
eprosima::fastdds::dds::DomainParticipantFactory::get_default_participant_qos_from_xml
FASTDDS_EXPORTED_API ReturnCode_t get_default_participant_qos_from_xml(const std::string &xml, DomainParticipantQos &qos) const
Fills the DomainParticipantQos with the default DomainParticipant profile found in the provided XML (...
eprosima::fastdds::dds::DomainParticipantFactory::lookup_participant
FASTDDS_EXPORTED_API DomainParticipant * lookup_participant(DomainId_t domain_id) const
This operation retrieves a previously created DomainParticipant belonging to specified domain_id.
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_qos_from_xml
FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_xml(const std::string &xml, DomainParticipantQos &qos) const
Fills the DomainParticipantQos with the first DomainParticipant profile found in the provided XML.
eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_profile
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_profile(DomainId_t domain_id, const std::string &profile_name, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
eprosima::fastdds::dds::DomainParticipantFactory::load_XML_profiles_file
FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_file(const std::string &xml_profile_file)
Load profiles from XML file.
eprosima::fastdds::dds::DomainParticipantFactory::mtx_participants_
std::mutex mtx_participants_
Definition DomainParticipantFactory.hpp:473
eprosima::fastdds::dds::DomainParticipantFactory::participants_
std::map< DomainId_t, std::vector< DomainParticipantImpl * > > participants_
Definition DomainParticipantFactory.hpp:444
eprosima::fastdds::dds::DomainParticipantFactory::default_participant_qos_
DomainParticipantQos default_participant_qos_
Definition DomainParticipantFactory.hpp:481
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_qos_from_xml
FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_xml(const std::string &xml, DomainParticipantQos &qos, const std::string &profile_name) const
Fills the DomainParticipantQos with the DomainParticipant profile with profile_name to be found in th...
eprosima::fastdds::dds::DomainParticipantFactory::set_default_participant_qos
FASTDDS_EXPORTED_API ReturnCode_t set_default_participant_qos(const DomainParticipantQos &qos)
This operation sets a default value of the DomainParticipant QoS policies which will be used for newl...
eprosima::fastdds::dds::DomainParticipantFactory::create_participant
FASTDDS_EXPORTED_API DomainParticipant * create_participant(DomainId_t domain_id, const DomainParticipantQos &qos, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
eprosima::fastdds::dds::DomainParticipantFactory::DomainParticipantFactory
DomainParticipantFactory()
eprosima::fastdds::dds::DomainParticipantFactory::rtps_domain_
std::shared_ptr< fastdds::rtps::RTPSDomainImpl > rtps_domain_
Definition DomainParticipantFactory.hpp:485
eprosima::fastdds::dds::DomainParticipantFactory::get_default_participant_qos
FASTDDS_EXPORTED_API const DomainParticipantQos & get_default_participant_qos() const
This operation retrieves the default value of the DomainParticipant QoS, that is, the QoS policies wh...
eprosima::fastdds::dds::DomainParticipantFactory::create_participant_with_default_profile
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_default_profile()
Create a Participant with default domain id and qos.
eprosima::fastdds::dds::DomainParticipantFactory::factory_qos_
DomainParticipantFactoryQos factory_qos_
Definition DomainParticipantFactory.hpp:479
eprosima::fastdds::dds::DomainParticipantFactory::get_shared_instance
static FASTDDS_EXPORTED_API std::shared_ptr< DomainParticipantFactory > get_shared_instance()
Returns the DomainParticipantFactory singleton instance.
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_extended_qos_from_default_profile
FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_default_profile(DomainParticipantExtendedQos &extended_qos) const
Fills the DomainParticipantExtendedQos with the values of the default XML profile.
eprosima::fastdds::dds::DomainParticipantFactory::get_dynamic_type_builder_from_xml_by_name
FASTDDS_EXPORTED_API ReturnCode_t get_dynamic_type_builder_from_xml_by_name(const std::string &type_name, DynamicTypeBuilder::_ref_type &type)
Get the DynamicType defined in XML file.
eprosima::fastdds::dds::DomainParticipantFactory::get_instance
static FASTDDS_EXPORTED_API DomainParticipantFactory * get_instance()
Returns the DomainParticipantFactory singleton instance.
eprosima::fastdds::dds::DomainParticipantFactory::get_default_participant_qos
FASTDDS_EXPORTED_API ReturnCode_t get_default_participant_qos(DomainParticipantQos &qos) const
This operation retrieves the default value of the DomainParticipant QoS, that is, the QoS policies wh...
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_qos_from_profile
FASTDDS_EXPORTED_API ReturnCode_t get_participant_qos_from_profile(const std::string &profile_name, DomainParticipantQos &qos) const
Fills the DomainParticipantQos with the values of the XML profile.
eprosima::fastdds::dds::DomainParticipantFactory::participant_has_been_deleted
void participant_has_been_deleted(DomainParticipantImpl *part)
eprosima::fastdds::dds::DomainParticipantFactory::log_resources_
std::shared_ptr< detail::LogResources > log_resources_
Definition DomainParticipantFactory.hpp:487
eprosima::fastdds::dds::DomainParticipantFactory::load_XML_profiles_string
FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_string(const char *data, size_t length)
Load profiles from XML string.
eprosima::fastdds::dds::DomainParticipantFactory::can_qos_be_updated
static bool can_qos_be_updated(const DomainParticipantFactoryQos &to, const DomainParticipantFactoryQos &from)
eprosima::fastdds::dds::DomainParticipantFactory::get_default_participant_extended_qos_from_xml
FASTDDS_EXPORTED_API ReturnCode_t get_default_participant_extended_qos_from_xml(const std::string &xml, DomainParticipantExtendedQos &extended_qos) const
Fills the DomainParticipantExtendedQos with the default DomainParticipant profile found in the provid...
eprosima::fastdds::dds::DomainParticipantFactory::delete_participant
FASTDDS_EXPORTED_API ReturnCode_t delete_participant(DomainParticipant *part)
Remove a Participant and all associated publishers and subscribers.
eprosima::fastdds::dds::DomainParticipantFactory::reset_default_participant_qos
void reset_default_participant_qos()
eprosima::fastdds::dds::DomainParticipantFactory::default_domain_id_
DomainId_t default_domain_id_
Definition DomainParticipantFactory.hpp:477
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_extended_qos_from_xml
FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_xml(const std::string &xml, DomainParticipantExtendedQos &extended_qos) const
Fills the DomainParticipantExtendedQos with the first DomainParticipant profile found in the provided...
eprosima::fastdds::dds::DomainParticipantFactory::create_participant
FASTDDS_EXPORTED_API DomainParticipant * create_participant(const DomainParticipantExtendedQos &extended_qos, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
eprosima::fastdds::dds::DomainParticipantFactory::type_object_registry
FASTDDS_EXPORTED_API xtypes::ITypeObjectRegistry & type_object_registry()
Return the TypeObjectRegistry member to access the public API.
eprosima::fastdds::dds::DomainParticipantFactory::load_profiles
FASTDDS_EXPORTED_API ReturnCode_t load_profiles()
Load profiles from default XML file.
eprosima::fastdds::dds::DomainParticipantFactory::check_xml_static_discovery
FASTDDS_EXPORTED_API ReturnCode_t check_xml_static_discovery(std::string &xml_file)
Check the validity of the provided static discovery XML file.
eprosima::fastdds::dds::DomainParticipantFactory::check_qos
static ReturnCode_t check_qos(const DomainParticipantFactoryQos &qos)
eprosima::fastdds::dds::DomainParticipantFactory::lookup_participants
FASTDDS_EXPORTED_API std::vector< DomainParticipant * > lookup_participants(DomainId_t domain_id) const
Returns all participants that belongs to the specified domain_id.
eprosima::fastdds::dds::DomainParticipantFactory::get_participant_extended_qos_from_profile
FASTDDS_EXPORTED_API ReturnCode_t get_participant_extended_qos_from_profile(const std::string &profile_name, DomainParticipantExtendedQos &extended_qos) const
Fills the DomainParticipantExtendedQos with the values of the XML profile.
eprosima::fastdds::dds::DomainParticipantFactoryQos
Class DomainParticipantFactoryQos, contains all the possible Qos that can be set for a determined par...
Definition DomainParticipantFactoryQos.hpp:37
eprosima::fastdds::dds::DomainParticipantListener
Class DomainParticipantListener, overrides behaviour towards certain events.
Definition DomainParticipantListener.hpp:49
eprosima::fastdds::dds::DomainParticipantQos
Class DomainParticipantQos, contains all the possible Qos that can be set for a determined participan...
Definition DomainParticipantQos.hpp:42
eprosima::fastdds::dds::DynamicTypeBuilder::_ref_type
typename traits< DynamicTypeBuilder >::ref_type _ref_type
Definition DynamicTypeBuilder.hpp:35
eprosima::fastdds::dds::StatusMask
StatusMask is a bitmap or bitset field.
Definition StatusMask.hpp:48
eprosima::fastdds::dds::StatusMask::all
static StatusMask all()
Get all StatusMasks.
Definition StatusMask.hpp:104
eprosima::fastdds::dds::xtypes::ITypeObjectRegistry
Definition ITypeObjectRegistry.hpp:45
dds
Definition DomainParticipant.hpp:46
eprosima::fastdds::dds::DomainId_t
uint32_t DomainId_t
Definition Types.hpp:24
eprosima::fastdds::dds::ReturnCode_t
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eprosima::fastdds::rtps::detail
Definition DomainParticipantFactory.hpp:44
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds
eprosima
eProsima namespace.