Fast DDS  Version 3.0.1
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
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
37namespace eprosima {
38
39namespace fastdds {
40namespace rtps {
41
42class RTPSDomainImpl;
43
44namespace detail {
45class TopicPayloadPoolRegistry;
46} // namespace detail
47} // namespace rtps
48
49namespace dds {
50
51class DomainParticipantListener;
52class DomainParticipant;
53class DomainParticipantImpl;
54
55namespace detail {
56struct LogResources;
57} // namespace detail
58
65{
66
67public:
68
74 FASTDDS_EXPORTED_API static DomainParticipantFactory* get_instance();
75
81 FASTDDS_EXPORTED_API static std::shared_ptr<DomainParticipantFactory> get_shared_instance();
82
93 DomainId_t domain_id,
94 const DomainParticipantQos& qos,
95 DomainParticipantListener* listener = nullptr,
96 const StatusMask& mask = StatusMask::all());
97
107 const DomainParticipantExtendedQos& extended_qos,
108 DomainParticipantListener* listener = nullptr,
109 const StatusMask& mask = StatusMask::all());
110
117
118
128 const StatusMask& mask);
129
140 DomainId_t domain_id,
141 const std::string& profile_name,
142 DomainParticipantListener* listener = nullptr,
143 const StatusMask& mask = StatusMask::all());
144
154 const std::string& profile_name,
155 DomainParticipantListener* listener = nullptr,
156 const StatusMask& mask = StatusMask::all());
157
168 DomainId_t domain_id) const;
169
176 FASTDDS_EXPORTED_API std::vector<DomainParticipant*> lookup_participants(
177 DomainId_t domain_id) const;
178
190 DomainParticipantQos& qos) const;
191
201 FASTDDS_EXPORTED_API const DomainParticipantQos& get_default_participant_qos() const;
202
219 const DomainParticipantQos& qos);
220
229 const std::string& profile_name,
230 DomainParticipantQos& qos) const;
231
240 const std::string& profile_name,
241 DomainParticipantExtendedQos& extended_qos) const;
242
250 DomainParticipantExtendedQos& extended_qos) const;
251
259 FASTDDS_EXPORTED_API ReturnCode_t delete_participant(
260 DomainParticipant* part);
261
267 FASTDDS_EXPORTED_API ReturnCode_t load_profiles();
268
276 const std::string& xml_profile_file);
277
286 const char* data,
287 size_t length);
288
296 std::string& xml_file);
297
304 FASTDDS_EXPORTED_API ReturnCode_t get_qos(
305 DomainParticipantFactoryQos& qos) const;
306
320 FASTDDS_EXPORTED_API ReturnCode_t set_qos(
321 const DomainParticipantFactoryQos& qos);
322
329 FASTDDS_EXPORTED_API ReturnCode_t get_library_settings(
330 LibrarySettings& library_settings) const;
331
342 FASTDDS_EXPORTED_API ReturnCode_t set_library_settings(
343 const LibrarySettings& library_settings);
344
356 const std::string& type_name,
358
365
366protected:
367
368 friend class DomainParticipant;
369
370 std::map<DomainId_t, std::vector<DomainParticipantImpl*>> participants_;
371
373
375
377 const DomainParticipantFactory&) = delete;
378
380 const DomainParticipantFactory&) = delete;
381
383
384 static void set_qos(
386 const DomainParticipantFactoryQos& from,
387 bool first_time);
388
390 const DomainParticipantFactoryQos& qos);
391
394 const DomainParticipantFactoryQos& from);
395
397 DomainParticipantImpl* part);
398
399 mutable std::mutex mtx_participants_;
400
402
404
406
408
409 std::shared_ptr<fastdds::rtps::detail::TopicPayloadPoolRegistry> topic_pool_;
410
411 std::shared_ptr<fastdds::rtps::RTPSDomainImpl> rtps_domain_;
412
413 std::shared_ptr<detail::LogResources> log_resources_;
414
421};
422
423} // namespace dds
424} // namespace fastdds
425} // namespace eprosima
426
427#endif // FASTDDS_DDS_DOMAIN__DOMAINPARTICIPANTFACTORY_HPP
Class LibraySettings, used by the user to define the Fast DDS library behaviour.
Definition LibrarySettings.hpp:38
Definition DomainParticipantExtendedQos.hpp:32
Class DomainParticipantFactory.
Definition DomainParticipantFactory.hpp:65
static void set_qos(DomainParticipantFactoryQos &to, const DomainParticipantFactoryQos &from, bool first_time)
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_default_profile(DomainParticipantListener *listener, const StatusMask &mask)
Create a Participant with default domain id and qos.
bool default_xml_profiles_loaded
Definition DomainParticipantFactory.hpp:401
std::shared_ptr< fastdds::rtps::detail::TopicPayloadPoolRegistry > topic_pool_
Definition DomainParticipantFactory.hpp:409
DomainParticipantFactory(const DomainParticipantFactory &)=delete
FASTDDS_EXPORTED_API ReturnCode_t set_library_settings(const LibrarySettings &library_settings)
This operation sets the library settings.
FASTDDS_EXPORTED_API ReturnCode_t set_qos(const DomainParticipantFactoryQos &qos)
This operation sets the value of the DomainParticipantFactory QoS policies.
void operator=(const DomainParticipantFactory &)=delete
FASTDDS_EXPORTED_API ReturnCode_t get_library_settings(LibrarySettings &library_settings) const
This operation returns the value of the DomainParticipant library settings.
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_profile(const std::string &profile_name, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
std::mutex default_xml_profiles_loaded_mtx_
This mutex guards the access to load the profiles.
Definition DomainParticipantFactory.hpp:420
FASTDDS_EXPORTED_API ReturnCode_t get_qos(DomainParticipantFactoryQos &qos) const
This operation returns the value of the DomainParticipantFactory QoS policies.
FASTDDS_EXPORTED_API DomainParticipant * lookup_participant(DomainId_t domain_id) const
This operation retrieves a previously created DomainParticipant belonging to specified domain_id.
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.
FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_file(const std::string &xml_profile_file)
Load profiles from XML file.
std::mutex mtx_participants_
Definition DomainParticipantFactory.hpp:399
std::map< DomainId_t, std::vector< DomainParticipantImpl * > > participants_
Definition DomainParticipantFactory.hpp:370
DomainParticipantQos default_participant_qos_
Definition DomainParticipantFactory.hpp:407
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...
FASTDDS_EXPORTED_API DomainParticipant * create_participant(DomainId_t domain_id, const DomainParticipantQos &qos, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
std::shared_ptr< fastdds::rtps::RTPSDomainImpl > rtps_domain_
Definition DomainParticipantFactory.hpp:411
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...
FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_default_profile()
Create a Participant with default domain id and qos.
DomainParticipantFactoryQos factory_qos_
Definition DomainParticipantFactory.hpp:405
static FASTDDS_EXPORTED_API std::shared_ptr< DomainParticipantFactory > get_shared_instance()
Returns the DomainParticipantFactory singleton instance.
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.
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.
static FASTDDS_EXPORTED_API DomainParticipantFactory * get_instance()
Returns the DomainParticipantFactory singleton instance.
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...
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.
void participant_has_been_deleted(DomainParticipantImpl *part)
std::shared_ptr< detail::LogResources > log_resources_
Definition DomainParticipantFactory.hpp:413
FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_string(const char *data, size_t length)
Load profiles from XML string.
static bool can_qos_be_updated(const DomainParticipantFactoryQos &to, const DomainParticipantFactoryQos &from)
FASTDDS_EXPORTED_API ReturnCode_t delete_participant(DomainParticipant *part)
Remove a Participant and all associated publishers and subscribers.
DomainId_t default_domain_id_
Definition DomainParticipantFactory.hpp:403
FASTDDS_EXPORTED_API DomainParticipant * create_participant(const DomainParticipantExtendedQos &extended_qos, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
Create a Participant.
FASTDDS_EXPORTED_API xtypes::ITypeObjectRegistry & type_object_registry()
Return the TypeObjectRegistry member to access the public API.
FASTDDS_EXPORTED_API ReturnCode_t load_profiles()
Load profiles from default XML file.
FASTDDS_EXPORTED_API ReturnCode_t check_xml_static_discovery(std::string &xml_file)
Check the validity of the provided static discovery XML file.
static ReturnCode_t check_qos(const DomainParticipantFactoryQos &qos)
FASTDDS_EXPORTED_API std::vector< DomainParticipant * > lookup_participants(DomainId_t domain_id) const
Returns all participants that belongs to the specified domain_id.
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.
Class DomainParticipantFactoryQos, contains all the possible Qos that can be set for a determined par...
Definition DomainParticipantFactoryQos.hpp:37
Class DomainParticipant used to group Publishers and Subscribers into a single working unit.
Definition DomainParticipant.hpp:78
Class DomainParticipantListener, overrides behaviour towards certain events.
Definition DomainParticipantListener.hpp:49
Class DomainParticipantQos, contains all the possible Qos that can be set for a determined participan...
Definition DomainParticipantQos.hpp:42
typename traits< DynamicTypeBuilder >::ref_type _ref_type
Definition DynamicTypeBuilder.hpp:35
StatusMask is a bitmap or bitset field.
Definition StatusMask.hpp:48
static StatusMask all()
Get all StatusMasks.
Definition StatusMask.hpp:104
Definition ITypeObjectRegistry.hpp:45
Definition DomainParticipant.hpp:45
uint32_t DomainId_t
Definition Types.hpp:24
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eProsima namespace.