RTI Connext C# API  6.1.2
QosProvider Class Reference

Provides access to XML-defined QoS profiles, data types, and complete DDS systems. More...

Inherits IDisposable.

Public Member Functions

 QosProvider (Profile profilePolicy)
 Create a QosProvider with additional configuration More...
 
 QosProvider (string uri)
 Create a QosProvider fetching the QoS configuration from a URI More...
 
 QosProvider (string uri, string profile)
 Create a QosProvider fetching the QoS configuration from a URI More...
 
void Dispose ()
 Releases the native resources used by this object. A finalizer is also provided. More...
 
DomainParticipant CreateParticipantFromConfig (string configName)
 Creates a DomainParticipant given its configuration name from a description provided in an XML configuration file. More...
 
DomainParticipant CreateParticipantFromConfig (string configName, DomainParticipantConfigParams parameters)
 Creates a DomainParticipant given its configuration name from a description provided in an XML configuration file and a set of parameters that allow changing some properties of such configuration. More...
 
DomainParticipantQos GetDomainParticipantQos ()
 Get the DomainParticipantQos currently associated with the default profile. More...
 
DomainParticipantQos GetDomainParticipantQos (string profile)
 Get the DomainParticipantQos from a profile More...
 
TopicQos GetTopicQos (string profile)
 Get the TopicQos from a profile More...
 
TopicQos GetTopicQos ()
 Get the TopicQos currently associated with the default profile. More...
 
TopicQos GetTopicQosWithTopicName (string profile, string topicName)
 Get the TopicQos from a profile for a given topic. More...
 
TopicQos GetTopicQosWithTopicName (string topicName)
 Get the TopicQos currently associated with the default profile for a given topic. More...
 
PublisherQos GetPublisherQos (string profile)
 Get the PublisherQos from a profile More...
 
PublisherQos GetPublisherQos ()
 Get the PublisherQos currently associated with the default profile. More...
 
SubscriberQos GetSubscriberQos (string profile)
 Get the SubscriberQos from a profile More...
 
SubscriberQos GetSubscriberQos ()
 Get the SubscriberQos currently associated with the default profile. More...
 
DataWriterQos GetDataWriterQos (string profile)
 Get the DataWriterQos from a profile More...
 
DataWriterQos GetDataWriterQos ()
 Get the DataWriterQos currently associated with the default profile. More...
 
DataWriterQos GetDataWriterQosWithTopicName (string profile, string topicName)
 Get the DataWriterQos from a profile and a given topic. More...
 
DataWriterQos GetDataWriterQosWithTopicName (string topicName)
 Get the DataWriterQos for a given topic currently associated with the default profile. More...
 
DataReaderQos GetDataReaderQos (string profile)
 Get the DataReaderQos from a profile. More...
 
DataReaderQos GetDataReaderQos ()
 Get the DataReaderQos currently associated with the default profile. More...
 
DataReaderQos GetDataReaderQosWithTopicName (string profile, string topicName)
 Get the DataReaderQos from a profile for a given topic. More...
 
DataReaderQos GetDataReaderQosWithTopicName (string topicName)
 Get the DataReaderQos for a given topic currently associated with the default profile. More...
 
DynamicType GetType (string typeName)
 Load a type from its XML definition More...
 
IEnumerable< string > GetQosProfileLibraries ()
 Get a list of the QoS profile libraries loaded by this QosProvider More...
 
IEnumerable< string > GetQosProfiles (string libraryName)
 Get a list of the QoS profiles under a library More...
 
IEnumerable< string > GetQosProfiles ()
 Get a list of all the QoS profiles associated with this QosProvider. More...
 
void ReloadProfiles ()
 Reloads the profiles by parsing the XML documents again More...
 
void UnloadProfiles ()
 Unload the profiles More...
 

Static Public Member Functions

static void SetDefaultProviderParams (Profile profile)
 This method can be called before accessing QosProvider.Default to configure which profiles the default provider will load. More...
 

Properties

static QosProvider Default [get]
 Get the default QosProvider, a singleton that gives access to the QoS profiles and data types that are loaded by default. More...
 
Profile ProviderParams [get, set]
 Get or modify this QosProvider's configuration. When the configuration is modified, the profiles are reloaded. More...
 
string DefaultProfile [get, set]
 Get or set the profile used by default (can be null). More...
 
string DefaultLibrary [get, set]
 Get or set the library used by default (can be null) More...
 
bool Disposed [get]
 Indicates whether this object has been disposed More...
 

Detailed Description

Provides access to XML-defined QoS profiles, data types, and complete DDS systems.

A QosProvider is created with a URI that identifies a resource from where to load the definition of:

  • QoS profiles
  • Type definitions
  • Full XML-defined DDS systems

The URI can be:

  • An XML file
  • A string representation of an XML document str://"..."
  • A group of several files and strings (see URL Groups in the User's Manual)

The following example loads a file named "MyProfiles.xml" in the current directory. Then it retrieves the DataReaderQos from a <qos_profile> named "MyProfile" under a <qos_library> named "MyLibrary" to create a DataReader:

var myQosProvider = new QosProvider("MyProfiles.xml");
var myReader = subscriber.CreateDataReader(
myTopic,
myQosProvider.GetDataReaderQos("MyLibrary::MyProfile"));

To load type definitions, see GetType(string).

To create a DomainParticipant and its contained entities, see CreateParticipantFromConfig(string).

Selecting a QoS profile

The profile name argument is optional:

var readerQos = myQosProvider.GetDataReaderQos();

When omitted, the QosProvider looks for a profile as follows (in order of precedence):

  • The profile set with DefaultProfile
  • The profile set in the constructor (an optional argument)
  • The <qos_profile> identified as the default profile with the attribute is_default_qos=true
  • If none of the above methods have been used, a QoS object with the documented default values is returned

A QosProvider can be used in combination with functions such as Rti.Dds.Publication.Publisher.DefaultDataWriterQos or Rti.Dds.Subscription.Subscriber.DefaultDataReaderQos to set the profile that entities are created with by default:

subscriber.DefaultDataReaderQos =
myQosProvider.GetDataReaderQos("MyLibrary::MyProfile");
// reader created with the QoS in the profile "MyLibrary::MyProfile"
var reader = subscriber.CreateDataReader(topic);

More information about QoS Profiles can be found in the QoS Profiles section, in the User's Manual.

The Default QosProvider

A special QosProvider, QosProvider.Default is always available to obtain the QoS profiles from the default locations, such as the file USER_QOS_PROFILES.xml in the current directory. For example, the following code obtains the default DataReaderQos:

var defaultReaderQos = QosProvider.Default.GetDatareaderQos();

This section in the User's Manual explains which profiles are automatically loaded by the default QosProvider.

The profiles that QosProvider.Default loads can be configured with QosProvider.SetDefaultProviderParams(Profile). This method should be called before QosProvider.Default is accessed.

QosProvider.SetDefaultProviderParams(Profile.Default.With(p =>
{
// Load MyProfiles.xml and disable USER_QOS_PROFILES.xml
p.UrlProfile.Add("MyProfiles.xml");
p.IgnoreUserProfile = true;
}));

QosProvider.Default also determines the default values for <participant_factory_qos>, which can be used to configure logging.

Built-in QoS Profiles

Any QosProvider, including the default QosProvider, has access to the built-in profiles. For example, to obtain the DataWriterQos from the "strict reliable" built-in profile:

var strictReliableWriterQos = QosProvider.Default.GetDataWriterQos(
"BuiltinQosLib::Generic.StrictReliable");

Specifying a Topic Filter

XML QoS definitions can specify a topic_filter attribute. Several functions (such as GetDataReaderQosWithTopicName(string) receive a topicName argument. When these functions look for the QoS, they will try to match the topicName against the topic_filters, if they are used. See the Topic Filters section in the User's Manual.

See also
Entity examples

Constructor & Destructor Documentation

◆ QosProvider() [1/3]

QosProvider ( Profile  profilePolicy)

Create a QosProvider with additional configuration

Parameters
profilePolicySpecifies multiple locations where to look for profiles

◆ QosProvider() [2/3]

QosProvider ( string  uri)

Create a QosProvider fetching the QoS configuration from a URI

Parameters
uriA file such as "path/to/my_config.xml", or an inline definition, "str://\"<dds>...</dds>"" (note the quotes after str://)

◆ QosProvider() [3/3]

QosProvider ( string  uri,
string  profile 
)

Create a QosProvider fetching the QoS configuration from a URI

Parameters
uriA file such as "file:///somewhere/on/disk/qos-config.xml", or an inline definition, "str://"<dds;>...</dds;>""
profileThe QoS profile to set as the default, overriding any is_default_qos tag in the loaded XML file.

Member Function Documentation

◆ CreateParticipantFromConfig() [1/2]

DomainParticipant CreateParticipantFromConfig ( string  configName)

Creates a DomainParticipant given its configuration name from a description provided in an XML configuration file.

See XML application examples

.

◆ CreateParticipantFromConfig() [2/2]

DomainParticipant CreateParticipantFromConfig ( string  configName,
DomainParticipantConfigParams  parameters 
)

Creates a DomainParticipant given its configuration name from a description provided in an XML configuration file and a set of parameters that allow changing some properties of such configuration.

The full documentation is available in the C API: DDS_DomainParticipantFactory_create_participant_from_config_w_params

◆ Dispose()

void Dispose ( )

Releases the native resources used by this object. A finalizer is also provided.

◆ GetDataReaderQos() [1/2]

DataReaderQos GetDataReaderQos ( )

Get the DataReaderQos currently associated with the default profile.

◆ GetDataReaderQos() [2/2]

DataReaderQos GetDataReaderQos ( string  profile)

Get the DataReaderQos from a profile.

Parameters
profileThe profile from which to get the DataReaderQos, for example "MyLibrary::MyProfile"

◆ GetDataReaderQosWithTopicName() [1/2]

DataReaderQos GetDataReaderQosWithTopicName ( string  profile,
string  topicName 
)

Get the DataReaderQos from a profile for a given topic.

Parameters
profileThe profile from which to get the DataReaderQos, for example "MyLibrary::MyProfile"
topicNameThe topic name used to select a qos within the profile, if the topic_filter attribute is used.

◆ GetDataReaderQosWithTopicName() [2/2]

DataReaderQos GetDataReaderQosWithTopicName ( string  topicName)

Get the DataReaderQos for a given topic currently associated with the default profile.

Parameters
topicNameThe topic name used to select a qos within the profile, if the topic_filter attribute is used.

◆ GetDataWriterQos() [1/2]

DataWriterQos GetDataWriterQos ( )

Get the DataWriterQos currently associated with the default profile.

◆ GetDataWriterQos() [2/2]

DataWriterQos GetDataWriterQos ( string  profile)

Get the DataWriterQos from a profile

Parameters
profileThe profile from which to get the DataWriterQos, for example "MyLibrary::MyProfile"

◆ GetDataWriterQosWithTopicName() [1/2]

DataWriterQos GetDataWriterQosWithTopicName ( string  profile,
string  topicName 
)

Get the DataWriterQos from a profile and a given topic.

Parameters
profileThe profile from which to get the DataWriterQos, for example "MyLibrary::MyProfile"
topicNameThe topic name used to select a qos within the profile, if the topic_filter attribute is used.

◆ GetDataWriterQosWithTopicName() [2/2]

DataWriterQos GetDataWriterQosWithTopicName ( string  topicName)

Get the DataWriterQos for a given topic currently associated with the default profile.

Parameters
topicNameThe topic name used to select a qos within the profile, if the topic_filter attribute is used.

◆ GetDomainParticipantQos() [1/2]

DomainParticipantQos GetDomainParticipantQos ( )

Get the DomainParticipantQos currently associated with the default profile.

◆ GetDomainParticipantQos() [2/2]

DomainParticipantQos GetDomainParticipantQos ( string  profile)

Get the DomainParticipantQos from a profile

Parameters
profileThe profile from which to get the DomainParticipantQos, for example "MyLibrary::MyProfile"

◆ GetPublisherQos() [1/2]

PublisherQos GetPublisherQos ( )

Get the PublisherQos currently associated with the default profile.

◆ GetPublisherQos() [2/2]

PublisherQos GetPublisherQos ( string  profile)

Get the PublisherQos from a profile

Parameters
profileThe profile from which to get the PublisherQos, for example "MyLibrary::MyProfile"

◆ GetQosProfileLibraries()

IEnumerable<string> GetQosProfileLibraries ( )

Get a list of the QoS profile libraries loaded by this QosProvider

The full documentation is available in the C API: DDS_DomainParticipantFactory_get_qos_profile_libraries

◆ GetQosProfiles() [1/2]

IEnumerable<string> GetQosProfiles ( )

Get a list of all the QoS profiles associated with this QosProvider.

◆ GetQosProfiles() [2/2]

IEnumerable<string> GetQosProfiles ( string  libraryName)

Get a list of the QoS profiles under a library

Parameters
libraryNameThe library containing the profiles

◆ GetSubscriberQos() [1/2]

SubscriberQos GetSubscriberQos ( )

Get the SubscriberQos currently associated with the default profile.

◆ GetSubscriberQos() [2/2]

SubscriberQos GetSubscriberQos ( string  profile)

Get the SubscriberQos from a profile

Parameters
profileThe profile from which to get the SubscriberQos, for example "MyLibrary::MyProfile"

◆ GetTopicQos() [1/2]

TopicQos GetTopicQos ( )

Get the TopicQos currently associated with the default profile.

◆ GetTopicQos() [2/2]

TopicQos GetTopicQos ( string  profile)

Get the TopicQos from a profile

Parameters
profileThe profile from which to get the TopicQos, for example "MyLibrary::MyProfile"

◆ GetTopicQosWithTopicName() [1/2]

TopicQos GetTopicQosWithTopicName ( string  profile,
string  topicName 
)

Get the TopicQos from a profile for a given topic.

Parameters
profileThe profile from which to get the TopicQos, for example "MyLibrary::MyProfile"
topicNameThe topic name used to select a qos within the profile, if the topic_filter attribute is used.

◆ GetTopicQosWithTopicName() [2/2]

TopicQos GetTopicQosWithTopicName ( string  topicName)

Get the TopicQos currently associated with the default profile for a given topic.

Parameters
topicNameThe topic name used to select a qos within the profile, if the topic_filter attribute is used.

◆ GetType()

DynamicType GetType ( string  typeName)

Load a type from its XML definition

Parameters
typeNameThe name of a type defined under the <types> tag.
See also
DynamicData examples.

◆ ReloadProfiles()

void ReloadProfiles ( )

Reloads the profiles by parsing the XML documents again

◆ SetDefaultProviderParams()

static void SetDefaultProviderParams ( Profile  profile)
static

This method can be called before accessing QosProvider.Default to configure which profiles the default provider will load.

Parameters
profileThe configuration for QosProvider.Default

◆ UnloadProfiles()

void UnloadProfiles ( )

Unload the profiles

Property Documentation

◆ Default

QosProvider Default
staticget

Get the default QosProvider, a singleton that gives access to the QoS profiles and data types that are loaded by default.

The default QosProvider automatically loads XML Qos, types and application profiles from several predetermined locations, such as the file USER_QOS_PROFILES.xml in the current working directory.

See The Default QosProvider.

◆ DefaultLibrary

string DefaultLibrary
getset

Get or set the library used by default (can be null)

◆ DefaultProfile

string DefaultProfile
getset

Get or set the profile used by default (can be null).

See also
Selecting a QoS profile

◆ Disposed

bool Disposed
get

Indicates whether this object has been disposed

◆ ProviderParams

Profile ProviderParams
getset

Get or modify this QosProvider's configuration. When the configuration is modified, the profiles are reloaded.