pub struct DomainParticipant { /* private fields */ }Expand description
A DDS domain participant (DDS 1.4, 2.2.2.2.1): the entry point that creates topics, publishers and subscribers in one domain.
It runs a thread for discovery (SPDP and SEDP) and for receiving data. Dropping the participant stops the thread; writers and readers made from it stop working then.
Implementations§
Source§impl DomainParticipant
impl DomainParticipant
Sourcepub fn with_config(config: ParticipantConfig) -> Result<Self>
pub fn with_config(config: ParticipantConfig) -> Result<Self>
Joins a domain.
Sourcepub fn register_type<T: TopicType + DescribeType>(&self) -> Result<()>
pub fn register_type<T: TopicType + DescribeType>(&self) -> Result<()>
Registers the type T with its DDS-XTypes description
(register_type, DDS-XTypes 1.3, 7.6.3.2): the writers and readers
of T created afterwards announce its TypeInformation, and are
matched with remote endpoints by type assignability rather than by
type name (see crate::DataReaderQos::type_consistency).
rustorb-idl writes DescribeType with -Wbxtypes.
Registering a type again does nothing. Fails with
Error::Unsupported for a type that has no TypeObjects (one that
depends on itself).
Sourcepub fn register_dynamic_type(&self, ty: &DynamicType) -> Result<()>
pub fn register_dynamic_type(&self, ty: &DynamicType) -> Result<()>
Registers a type known at run time (register_type with a
DynamicType, DDS-XTypes 1.3, 7.6.3.2), under its name: as
register_type does for a type the program
was built with. Registering the same type again does nothing; a
different type of a name already registered fails with
Error::PreconditionNotMet.
Sourcepub fn create_dynamic_topic(
&self,
name: &str,
ty: &DynamicType,
) -> Result<Topic<DynamicData>>
pub fn create_dynamic_topic( &self, name: &str, ty: &DynamicType, ) -> Result<Topic<DynamicData>>
Creates a topic named name of a type known at run time, whose
samples are DynamicData: its writers and readers are a
DynamicDataWriter and a DynamicDataReader (DDS-XTypes 1.3,
7.5.2.12). The type is registered as by
register_dynamic_type, so that
endpoints match by type assignability.
Sourcepub fn discover_topic_type(
&self,
topic_name: &str,
timeout: Duration,
) -> Result<Option<DynamicType>>
pub fn discover_topic_type( &self, topic_name: &str, timeout: Duration, ) -> Result<Option<DynamicType>>
The type of the topic topic_name as the other participants know
it, for a program that was not built with it: the type of a remote
writer (or else reader) of the topic that announced its
TypeInformation, made from its COMPLETE TypeObjects, which the
participant asks the remote participant for with the TypeLookup
service (DDS-XTypes 1.3, 7.6.3.3). None when no such endpoint
was discovered, or its TypeObjects did not come, within timeout.
Then create_dynamic_topic makes a
topic of it, whose readers read the samples of that writer.
Sourcepub fn learnt_types(&self) -> usize
pub fn learnt_types(&self) -> usize
How many TypeObjects of remote types this participant got from other participants with the TypeLookup service (DDS-XTypes 1.3, 7.6.3.3). It asks for them when an endpoint announces a type whose TypeObject it does not have, to check assignability.
Sourcepub fn create_topic<T: TopicType + 'static>(
&self,
name: &str,
) -> Result<Topic<T>>
pub fn create_topic<T: TopicType + 'static>( &self, name: &str, ) -> Result<Topic<T>>
Creates a topic of type T, named name.
Sourcepub fn create_contentfilteredtopic<T>(
&self,
name: &str,
related: &Topic<T>,
filter_expression: &str,
expression_parameters: &[String],
) -> Result<ContentFilteredTopic<T>>
pub fn create_contentfilteredtopic<T>( &self, name: &str, related: &Topic<T>, filter_expression: &str, expression_parameters: &[String], ) -> Result<ContentFilteredTopic<T>>
Creates a content filtered topic named name (DDS 1.4,
2.2.2.2.1.7): its readers get the samples of related that pass
the filter filter_expression (DDS 1.4, Annex B; see
ContentFilter) with expression_parameters for its %n.
The filter reads the fields of the samples by their names in the
type’s description, so the type must be registered: a dynamic
topic’s is, and a TopicType needs
register_type first, or this fails with
Error::PreconditionNotMet. A filter expression that is not
valid for the type fails with Error::Dynamic.
Sourcepub fn create_publisher(&self) -> Result<Publisher>
pub fn create_publisher(&self) -> Result<Publisher>
Creates a publisher in the default partition.
Sourcepub fn create_publisher_with_qos(&self, qos: PublisherQos) -> Result<Publisher>
pub fn create_publisher_with_qos(&self, qos: PublisherQos) -> Result<Publisher>
Creates a publisher with the given QoS (its partitions).
Sourcepub fn create_subscriber(&self) -> Result<Subscriber>
pub fn create_subscriber(&self) -> Result<Subscriber>
Creates a subscriber in the default partition.
Sourcepub fn create_subscriber_with_qos(
&self,
qos: SubscriberQos,
) -> Result<Subscriber>
pub fn create_subscriber_with_qos( &self, qos: SubscriberQos, ) -> Result<Subscriber>
Creates a subscriber with the given QoS (its partitions).
Sourcepub fn set_listener(
&self,
listener: impl DomainParticipantListener + 'static,
mask: StatusMask,
)
pub fn set_listener( &self, listener: impl DomainParticipantListener + 'static, mask: StatusMask, )
Sets the participant’s listener (set_listener, DDS 1.4,
2.2.2.1.1), replacing any earlier one: it is called for the
statuses in mask of its entities that their own listeners, and
those of their publishers, subscribers or topics, do not take
(2.2.4.3.1). See DomainParticipantListener.
Sourcepub fn clear_listener(&self)
pub fn clear_listener(&self)
Removes the participant’s listener.
Sourcepub fn assert_liveliness(&self) -> Result<()>
pub fn assert_liveliness(&self) -> Result<()>
Asserts the liveliness of the participant’s MANUAL_BY_PARTICIPANT
writers (assert_liveliness, DDS 1.4, 2.2.2.2.1.19). Writing with
any of them does too.
Sourcepub fn discovered_participants(&self) -> Vec<GuidPrefix>
pub fn discovered_participants(&self) -> Vec<GuidPrefix>
The GUID prefixes of the other participants discovered.