Fast DDS  Version 3.0.1
Fast DDS
Loading...
Searching...
No Matches
DomainParticipantFactory Class Reference

Class DomainParticipantFactory. More...

#include <DomainParticipantFactory.hpp>

Public Member Functions

FASTDDS_EXPORTED_API DomainParticipantcreate_participant (DomainId_t domain_id, const DomainParticipantQos &qos, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
 Create a Participant.
 
FASTDDS_EXPORTED_API DomainParticipantcreate_participant (const DomainParticipantExtendedQos &extended_qos, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
 Create a Participant.
 
FASTDDS_EXPORTED_API DomainParticipantcreate_participant_with_default_profile ()
 Create a Participant with default domain id and qos.
 
FASTDDS_EXPORTED_API DomainParticipantcreate_participant_with_default_profile (DomainParticipantListener *listener, const StatusMask &mask)
 Create a Participant with default domain id and qos.
 
FASTDDS_EXPORTED_API DomainParticipantcreate_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 DomainParticipantcreate_participant_with_profile (const std::string &profile_name, DomainParticipantListener *listener=nullptr, const StatusMask &mask=StatusMask::all())
 Create a Participant.
 
FASTDDS_EXPORTED_API DomainParticipantlookup_participant (DomainId_t domain_id) const
 This operation retrieves a previously created DomainParticipant belonging to specified domain_id.
 
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_default_participant_qos (DomainParticipantQos &qos) const
 This operation retrieves the default value of the DomainParticipant QoS, that is, the QoS policies which will be used for newly created DomainParticipant entities in the case where the QoS policies are defaulted in the create_participant operation.
 
FASTDDS_EXPORTED_API const DomainParticipantQosget_default_participant_qos () const
 This operation retrieves the default value of the DomainParticipant QoS, that is, the QoS policies which will be used for newly created DomainParticipant entities in the case where the QoS policies are defaulted in the create_participant operation.
 
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 newly created DomainParticipant entities in the case where the QoS policies are defaulted in the create_participant operation.
 
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.
 
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.
 
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 delete_participant (DomainParticipant *part)
 Remove a Participant and all associated publishers and subscribers.
 
FASTDDS_EXPORTED_API ReturnCode_t load_profiles ()
 Load profiles from default XML file.
 
FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_file (const std::string &xml_profile_file)
 Load profiles from XML file.
 
FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_string (const char *data, size_t length)
 Load profiles from XML string.
 
FASTDDS_EXPORTED_API ReturnCode_t check_xml_static_discovery (std::string &xml_file)
 Check the validity of the provided static discovery XML file.
 
FASTDDS_EXPORTED_API ReturnCode_t get_qos (DomainParticipantFactoryQos &qos) const
 This operation returns the value of the DomainParticipantFactory QoS policies.
 
FASTDDS_EXPORTED_API ReturnCode_t set_qos (const DomainParticipantFactoryQos &qos)
 This operation sets the value of the DomainParticipantFactory QoS policies.
 
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 ReturnCode_t set_library_settings (const LibrarySettings &library_settings)
 This operation sets the library settings.
 
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.
 
FASTDDS_EXPORTED_API xtypes::ITypeObjectRegistrytype_object_registry ()
 Return the TypeObjectRegistry member to access the public API.
 

Static Public Member Functions

static FASTDDS_EXPORTED_API DomainParticipantFactoryget_instance ()
 Returns the DomainParticipantFactory singleton instance.
 
static FASTDDS_EXPORTED_API std::shared_ptr< DomainParticipantFactoryget_shared_instance ()
 Returns the DomainParticipantFactory singleton instance.
 

Protected Member Functions

 DomainParticipantFactory ()
 
virtual ~DomainParticipantFactory ()
 
 DomainParticipantFactory (const DomainParticipantFactory &)=delete
 
void operator= (const DomainParticipantFactory &)=delete
 
void reset_default_participant_qos ()
 
void participant_has_been_deleted (DomainParticipantImpl *part)
 

Static Protected Member Functions

static void set_qos (DomainParticipantFactoryQos &to, const DomainParticipantFactoryQos &from, bool first_time)
 
static ReturnCode_t check_qos (const DomainParticipantFactoryQos &qos)
 
static bool can_qos_be_updated (const DomainParticipantFactoryQos &to, const DomainParticipantFactoryQos &from)
 

Protected Attributes

std::map< DomainId_t, std::vector< DomainParticipantImpl * > > participants_
 
std::mutex mtx_participants_
 
bool default_xml_profiles_loaded
 
DomainId_t default_domain_id_
 
DomainParticipantFactoryQos factory_qos_
 
DomainParticipantQos default_participant_qos_
 
std::shared_ptr< fastdds::rtps::detail::TopicPayloadPoolRegistry > topic_pool_
 
std::shared_ptr< fastdds::rtps::RTPSDomainImpl > rtps_domain_
 
std::shared_ptr< detail::LogResources > log_resources_
 
std::mutex default_xml_profiles_loaded_mtx_
 This mutex guards the access to load the profiles.
 

Friends

class DomainParticipant
 

Detailed Description

Constructor & Destructor Documentation

◆ DomainParticipantFactory() [1/2]

DomainParticipantFactory ( )
protected

◆ ~DomainParticipantFactory()

virtual ~DomainParticipantFactory ( )
protectedvirtual

◆ DomainParticipantFactory() [2/2]

DomainParticipantFactory ( const DomainParticipantFactory )
protecteddelete

Member Function Documentation

◆ can_qos_be_updated()

static bool can_qos_be_updated ( const DomainParticipantFactoryQos to,
const DomainParticipantFactoryQos from 
)
staticprotected

◆ check_qos()

static ReturnCode_t check_qos ( const DomainParticipantFactoryQos qos)
staticprotected

◆ 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.

Parameters
xml_filexml file path
Returns
RETCODE_OK if the validation is successful, RETCODE_ERROR otherwise.

◆ create_participant() [1/2]

FASTDDS_EXPORTED_API DomainParticipant * create_participant ( const DomainParticipantExtendedQos extended_qos,
DomainParticipantListener listener = nullptr,
const StatusMask mask = StatusMask::all() 
)

Create a Participant.

Parameters
extended_qosDomainParticipantExtendedQos Reference.
listenerDomainParticipantListener Pointer (default: nullptr)
maskStatusMask Reference (default: all)
Returns
DomainParticipant pointer. (nullptr if not created.)

◆ create_participant() [2/2]

FASTDDS_EXPORTED_API DomainParticipant * create_participant ( DomainId_t  domain_id,
const DomainParticipantQos qos,
DomainParticipantListener listener = nullptr,
const StatusMask mask = StatusMask::all() 
)

Create a Participant.

Parameters
domain_idDomain Id.
qosDomainParticipantQos Reference.
listenerDomainParticipantListener Pointer (default: nullptr)
maskStatusMask Reference (default: all)
Returns
DomainParticipant pointer. (nullptr if not created.)

◆ create_participant_with_default_profile() [1/2]

FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_default_profile ( )

Create a Participant with default domain id and qos.

Returns
DomainParticipant pointer. (nullptr if not created.)

◆ create_participant_with_default_profile() [2/2]

FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_default_profile ( DomainParticipantListener listener,
const StatusMask mask 
)

Create a Participant with default domain id and qos.

Returns
DomainParticipant pointer. (nullptr if not created.)
Parameters
listenerDomainParticipantListener Pointer
maskStatusMask Reference

◆ create_participant_with_profile() [1/2]

FASTDDS_EXPORTED_API DomainParticipant * create_participant_with_profile ( const std::string &  profile_name,
DomainParticipantListener listener = nullptr,
const StatusMask mask = StatusMask::all() 
)

Create a Participant.

Parameters
profile_nameParticipant profile name.
listenerDomainParticipantListener Pointer (default: nullptr)
maskStatusMask Reference (default: all)
Returns
DomainParticipant pointer. (nullptr if not created.)

◆ create_participant_with_profile() [2/2]

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.

Parameters
domain_idDomain Id.
profile_nameParticipant profile name.
listenerDomainParticipantListener Pointer (default: nullptr)
maskStatusMask Reference (default: all)
Returns
DomainParticipant pointer. (nullptr if not created.)

◆ delete_participant()

FASTDDS_EXPORTED_API ReturnCode_t delete_participant ( DomainParticipant part)

Remove a Participant and all associated publishers and subscribers.

Parameters
partPointer to the participant.
Returns
RETCODE_PRECONDITION_NOT_MET if the participant has active entities, RETCODE_OK if the participant is correctly deleted and RETCODE_ERROR otherwise.

◆ get_default_participant_qos() [1/2]

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 which will be used for newly created DomainParticipant entities in the case where the QoS policies are defaulted in the create_participant operation.

The values retrieved get_default_participant_qos will match the set of values specified on the last successful call to set_default_participant_qos, or else, if the call was never made, the default values.

Returns
A reference to the default DomainParticipantQos

◆ get_default_participant_qos() [2/2]

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 which will be used for newly created DomainParticipant entities in the case where the QoS policies are defaulted in the create_participant operation.

The values retrieved get_default_participant_qos will match the set of values specified on the last successful call to set_default_participant_qos, or else, if the call was never made, the default values.

Parameters
qosDomainParticipantQos where the qos is returned
Returns
RETCODE_OK

◆ 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.

The XML file shall be previously loaded.

Parameters
type_nameDynamic type name.
typeReference where the Dynamic type builder is returned.
Returns
RETCODE_BAD_PARAMETER if type_name is empty. RETCODE_NO_DATA if type_name is unknown. RETCODE_OK otherwise.

◆ get_instance()

static FASTDDS_EXPORTED_API DomainParticipantFactory * get_instance ( )
static

Returns the DomainParticipantFactory singleton instance.

Returns
A raw pointer to the DomainParticipantFactory singleton instance.

◆ 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.

Parameters
library_settingsLibrarySettings reference where the settings are returned.
Returns
RETCODE_OK

◆ 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.

Parameters
extended_qosDomainParticipantExtendedQos object where the domain and qos are returned.
Returns
RETCODE_OK

◆ 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.

Parameters
profile_nameDomainParticipant profile name.
extended_qosDomainParticipantExtendedQos object where the domain and qos are returned.
Returns
RETCODE_OK if the profile exists. RETCODE_BAD_PARAMETER otherwise.

◆ 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.

Parameters
profile_nameDomainParticipant profile name.
qosDomainParticipantQos object where the qos is returned.
Returns
RETCODE_OK if the profile exists. RETCODE_BAD_PARAMETER otherwise.

◆ get_qos()

FASTDDS_EXPORTED_API ReturnCode_t get_qos ( DomainParticipantFactoryQos qos) const

This operation returns the value of the DomainParticipantFactory QoS policies.

Parameters
qosDomaParticipantFactoryQos reference where the qos is returned
Returns
RETCODE_OK

◆ get_shared_instance()

static FASTDDS_EXPORTED_API std::shared_ptr< DomainParticipantFactory > get_shared_instance ( )
static

Returns the DomainParticipantFactory singleton instance.

Returns
A shared pointer to the DomainParticipantFactory singleton instance.

◆ load_profiles()

FASTDDS_EXPORTED_API ReturnCode_t load_profiles ( )

Load profiles from default XML file.

Returns
RETCODE_OK

◆ load_XML_profiles_file()

FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_file ( const std::string &  xml_profile_file)

Load profiles from XML file.

Parameters
xml_profile_fileXML profile file.
Returns
RETCODE_OK if it is correctly loaded, RETCODE_ERROR otherwise.

◆ load_XML_profiles_string()

FASTDDS_EXPORTED_API ReturnCode_t load_XML_profiles_string ( const char *  data,
size_t  length 
)

Load profiles from XML string.

Parameters
databuffer containing xml data.
lengthlength of data
Returns
RETCODE_OK if it is correctly loaded, RETCODE_ERROR otherwise.

◆ 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.

If no such DomainParticipant exists, the operation will return 'nullptr'. If multiple DomainParticipant entities belonging to that domain_id exist, then the operation will return one of them. It is not specified which one.

Parameters
domain_id
Returns
previously created DomainParticipant within the specified domain

◆ 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.

Parameters
domain_id
Returns
previously created DomainParticipants within the specified domain

◆ operator=()

void operator= ( const DomainParticipantFactory )
protecteddelete

◆ participant_has_been_deleted()

void participant_has_been_deleted ( DomainParticipantImpl *  part)
protected

◆ reset_default_participant_qos()

void reset_default_participant_qos ( )
protected

◆ 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 newly created DomainParticipant entities in the case where the QoS policies are defaulted in the create_participant operation.

This operation will check that the resulting policies are self consistent; if they are not, the operation will have no effect and return INCONSISTENT_POLICY.

The special value PARTICIPANT_QOS_DEFAULT may be passed to this operation to indicate that the default QoS should be reset back to the initial values the factory would use, that is the values that would be used if the set_default_participant_qos operation had never been called.

Parameters
qosDomainParticipantQos to be set
Returns
RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.

◆ set_library_settings()

FASTDDS_EXPORTED_API ReturnCode_t set_library_settings ( const LibrarySettings library_settings)

This operation sets the library settings.

Library settings must be set before enabling the DomainParticipants. Otherwise, failure of the setting operation is expected.

Parameters
library_settingsLibrarySettings to be set.
Returns
RETCODE_PRECONDITION_NOT_MET if any DomainParticipant is already enabled. RETCODE_OK otherwise.

◆ set_qos() [1/2]

FASTDDS_EXPORTED_API ReturnCode_t set_qos ( const DomainParticipantFactoryQos qos)

This operation sets the value of the DomainParticipantFactory QoS policies.

These policies control the behavior of the object a factory for entities.

Note that despite having QoS, the DomainParticipantFactory is not an Entity.

This operation will check that the resulting policies are self consistent; if they are not, the operation will have no effect and return INCONSISTENT_POLICY.

Parameters
qosDomainParticipantFactoryQos to be set.
Returns
RETCODE_IMMUTABLE_POLICY if any of the Qos cannot be changed, RETCODE_INCONSISTENT_POLICY if the Qos is not self consistent and RETCODE_OK if the qos is changed correctly.

◆ set_qos() [2/2]

static void set_qos ( DomainParticipantFactoryQos to,
const DomainParticipantFactoryQos from,
bool  first_time 
)
staticprotected

◆ type_object_registry()

FASTDDS_EXPORTED_API xtypes::ITypeObjectRegistry & type_object_registry ( )

Return the TypeObjectRegistry member to access the public API.

Returns
const xtypes::TypeObjectRegistry reference.

Friends And Related Symbol Documentation

◆ DomainParticipant

friend class DomainParticipant
friend

Member Data Documentation

◆ default_domain_id_

DomainId_t default_domain_id_
protected

◆ default_participant_qos_

DomainParticipantQos default_participant_qos_
protected

◆ default_xml_profiles_loaded

bool default_xml_profiles_loaded
mutableprotected

◆ default_xml_profiles_loaded_mtx_

std::mutex default_xml_profiles_loaded_mtx_
mutableprotected

This mutex guards the access to load the profiles.

Is used to lock every thread that is trying to load the profiles, so only the first one loads it and until it is not finished the rest of them does not leave function load_profiles .

◆ factory_qos_

DomainParticipantFactoryQos factory_qos_
protected

◆ log_resources_

std::shared_ptr<detail::LogResources> log_resources_
protected

◆ mtx_participants_

std::mutex mtx_participants_
mutableprotected

◆ participants_

std::map<DomainId_t, std::vector<DomainParticipantImpl*> > participants_
protected

◆ rtps_domain_

std::shared_ptr<fastdds::rtps::RTPSDomainImpl> rtps_domain_
protected

◆ topic_pool_

std::shared_ptr<fastdds::rtps::detail::TopicPayloadPoolRegistry> topic_pool_
protected

The documentation for this class was generated from the following file: