Class astutedds::dcps::DomainParticipant
ClassList > astutedds > dcps > DomainParticipant
Entry point for DDS communication in a domain. More...
#include <dcps.hpp>
Classes
| Type | Name |
|---|---|
| struct | DiscoveredPublication Aggregate view of a single discovered remote DataWriter combined with identity fields from its owning participant. One record per remote endpoint. Copies (rather than pointers) so the caller does not need to worry about lifetime relative to the underlying discovery caches. |
| struct | DiscoveredSubscription |
Public Types
| Type | Name |
|---|---|
| typedef std::function< DataReader *(Topic *, Subscriber *)> | DataReaderFactory |
| typedef std::function< void(const std::string &topic, const ReceivedSample &)> | DataReceivedCallback Set callback for received data. |
| typedef std::function< DataWriter *(Topic *, Publisher *)> | DataWriterFactory Factory function types for creating typed DataWriter/DataReader subclasses. |
| typedef std::function< void(const std::string &topic_name, const std::vector< uint8_t > &data)> | SendDataCallback Set callback for sending data (used by transport layer) |
| typedef std::function< void(const std::string &topic_name)> | SubscribeCallback Set callback for subscribing to topics (used by transport layer) |
Public Functions
| Type | Name |
|---|---|
| DomainParticipant (uint32_t domain_id, uint32_t participant_id) |
|
| DomainParticipant (const DomainParticipant &) = delete |
|
| ContentFilteredTopic * | create_contentfilteredtopic (const char * name, Topic * related_topic, const char * filter_expression, const StringSeq & expression_parameters) Create a content-filtered topic. |
| Publisher * | create_publisher (const PublisherQos & qos=PublisherQos{}) Create a publisher. |
| Publisher * | create_publisher (const PublisherQos & qos, PublisherListener * listener, StatusMask mask=STATUS_MASK_ALL) Create a publisher with listener and status mask (PSM overload) |
| Replier * | create_replier (const std::string & service_name, const std::string & request_type_name, const std::string & reply_type_name, const ReplierQos & qos=ReplierQos{}) Create a Replier (service-side RPC endpoint) for a service. |
| Requester * | create_requester (const std::string & service_name, const std::string & request_type_name, const std::string & reply_type_name, const RequesterQos & qos=RequesterQos{}) Create a Requester (client-side RPC endpoint) for a service. |
| Subscriber * | create_subscriber (const SubscriberQos & qos=SubscriberQos{}) Create a subscriber. |
| Subscriber * | create_subscriber (const SubscriberQos & qos, SubscriberListener * listener, StatusMask mask=STATUS_MASK_ALL) Create a subscriber with listener and status mask (PSM overload) |
| Topic * | create_topic (const std::string & topic_name, const std::string & type_name, const TopicQos & qos=TopicQos{}) Create a topic in this domain. |
| Topic * | create_topic (const char * topic_name, const char * type_name, const TopicQos & qos, TopicListener * listener, StatusMask mask=STATUS_MASK_ALL) Create a topic with listener and status mask (PSM overload) |
| TimerService * | deadline_timers () |
| ReturnCode_t | delete_contained_entities () Delete all contained entities (topics, publishers, subscribers) |
| bool | delete_contentfilteredtopic (ContentFilteredTopic * cft) Delete a content-filtered topic. |
| bool | delete_publisher (Publisher * publisher) Delete a publisher. |
| bool | delete_replier (Replier * replier) Delete a Replier previously returned bycreate_replier() . |
| bool | delete_requester (Requester * requester) Delete a Requester previously returned bycreate_requester() . |
| bool | delete_subscriber (Subscriber * subscriber) Delete a subscriber. |
| bool | delete_topic (Topic * topic) Delete a topic. |
| void | deliver_data (const std::string & topic_name, const std::vector< uint8_t > & data, const rtps::GUID_t & writer_guid=rtps::GUID_t{}, int32_t ownershipStrength=0, const rtps::SequenceNumber_t & sequenceNumber=rtps::SequenceNumber_t{}) Deliver received data to appropriate DataReaders. |
| uint32_t | domain_id () const |
| bool | enable () Enable the participant (start discovery) |
| ReturnCode_t | get_default_publisher_qos (PublisherQos & qos) const |
| ReturnCode_t | get_default_subscriber_qos (SubscriberQos & qos) const |
| ReturnCode_t | get_default_topic_qos (TopicQos & qos) const |
| std::vector< DiscoveredPublication > | get_discovered_publications () const Enumerate all currently discovered remote DataWriters, one record per endpoint, each self-contained (embeds owning participant identity). |
| std::vector< DiscoveredSubscription > | get_discovered_subscriptions () const Enumerate all currently discovered remote DataReaders. |
| std::vector< std::pair< std::string, std::string > > | get_discovered_topic_names_and_types () const Return a deduplicated list of {topic_name, type_name} pairs seen across all discovered remote writers and readers. Used by the RMW graph query API (rmw_get_topic_names_and_types). |
| DomainParticipantListener * | get_listener () const |
| StatusMask | get_listener_mask () const |
| const DomainParticipantQos & | get_qos () const |
| DataReaderFactory | get_reader_factory (const std::string & type_name) const Look up a registered reader factory for the given type name. |
| DataWriterFactory | get_writer_factory (const std::string & type_name) const Look up a registered writer factory for the given type name. |
| const rtps::GuidPrefix_t & | guid_prefix () const |
| bool | is_enabled () const |
| LivelinessManager * | liveliness_manager () |
| void | local_deliver (const std::string & topic_name, const std::vector< uint8_t > & data, const rtps::GUID_t & writer_guid, const rtps::SequenceNumber_t & sequenceNumber) Deliver a sample from a local DataWriter to same-participant DataReaders. |
| void | match_reader_to_discovered_writers (DataReader * reader, const std::vector< std::string > & subPartitions) Match a newly created reader against already-discovered remote writers. Fires on_subscription_matched or on_requested_incompatible_qos as appropriate. |
| void | match_writer_to_discovered_readers (DataWriter * writer, const std::vector< std::string > & pubPartitions) Match a newly created writer against already-discovered remote readers. Fires on_publication_matched or on_offered_incompatible_qos as appropriate. |
| void | notify_subscription (const std::string & topic_name) Notify that a subscription was created. |
| DomainParticipant & | operator= (const DomainParticipant &) = delete |
| uint32_t | participant_id () const |
| void | register_reader (const std::string & topic_name, const std::string & type_name, const std::vector< std::string > & partitions={}, const DataReaderQos & qos={}) Register a reader with the transport layer. |
| void | register_type_factory (const std::string & type_name, DataWriterFactory wf, DataReaderFactory rf) Register typed DataWriter/DataReader factories for a type name. |
| void | register_writer (const std::string & topic_name, const std::string & type_name, const std::vector< std::string > & partitions={}, const DataWriterQos & qos={}) Register a writer with the transport layer. |
| void | replay_history_to_reader (DataWriter * writer) Replay TRANSIENT_LOCAL writer history to a newly matched reader. Called when a new remote reader matches a local writer with TRANSIENT_LOCAL durability. |
| rtps::RtpsUdpTransport * | rtps_transport () const |
| void | send_data (const std::string & topic_name, const std::vector< uint8_t > & data) Send data via the transport layer. |
| void | send_data (const std::string & topic_name, const std::vector< uint8_t > & xcdr1Data, const std::vector< uint8_t > & xcdr2Data) Send dual-encoded data via the transport layer. |
| void | set_data_received_callback (DataReceivedCallback callback) |
| void | set_listener (DomainParticipantListener * listener, StatusMask mask=STATUS_MASK_ALL) |
| void | set_participant_lease_duration_seconds (uint32_t sec) Override the outbound SPDP PID_PARTICIPANT_LEASE_DURATION. Defaults to 100 s per RTPS 2.5. Values below 1 s are clamped to 1 s. If called before enable() the new value is applied when the transport is created; if called after, the change takes effect on the next SPDP announcement. |
| void | set_qos (const DomainParticipantQos & qos) |
| void | set_send_data_callback (SendDataCallback callback) |
| void | set_spdp_announce_interval_ms (uint32_t ms) Override the SPDP announcement interval in milliseconds. Defaults to 3000 ms. Values below 50 ms are clamped. Applies immediately when called after enable() . |
| void | set_subscribe_callback (SubscribeCallback callback) |
| void | stop () Stop the participant. |
| void | unregister_reader (const std::string & topic_name) Unregister a reader from the transport layer. |
| void | unregister_writer (const std::string & topic_name) Unregister a writer from the transport layer. |
| ~DomainParticipant () |
Detailed Description
The DomainParticipant provides: * Factory methods for Topics, Publishers, Subscribers * SPDP participant discovery * SEDP endpoint discovery * Transport management
Public Types Documentation
typedef DataReaderFactory
using astutedds::dcps::DomainParticipant::DataReaderFactory = std::function<DataReader *(Topic *, Subscriber *)>;
typedef DataReceivedCallback
Set callback for received data.
using astutedds::dcps::DomainParticipant::DataReceivedCallback = std::function<void(const std::string &topic, const ReceivedSample &)>;
typedef DataWriterFactory
Factory function types for creating typed DataWriter/DataReader subclasses.
using astutedds::dcps::DomainParticipant::DataWriterFactory = std::function<DataWriter *(Topic *, Publisher *)>;
Registered via register_type_factory(); used by Publisher::create_datawriter() and Subscriber::create_datareader() so that dynamic_cast to the typed subclass succeeds (required by the OMG interop test suite's shape_main.cxx).
typedef SendDataCallback
Set callback for sending data (used by transport layer)
using astutedds::dcps::DomainParticipant::SendDataCallback = std::function<void(const std::string &topic_name, const std::vector<uint8_t> &data)>;
typedef SubscribeCallback
Set callback for subscribing to topics (used by transport layer)
using astutedds::dcps::DomainParticipant::SubscribeCallback = std::function<void(const std::string &topic_name)>;
Public Functions Documentation
function DomainParticipant [1/2]
astutedds::dcps::DomainParticipant::DomainParticipant (
uint32_t domain_id,
uint32_t participant_id
)
function DomainParticipant [2/2]
astutedds::dcps::DomainParticipant::DomainParticipant (
const DomainParticipant &
) = delete
function create_contentfilteredtopic
Create a content-filtered topic.
ContentFilteredTopic * astutedds::dcps::DomainParticipant::create_contentfilteredtopic (
const char * name,
Topic * related_topic,
const char * filter_expression,
const StringSeq & expression_parameters
)
Parameters:
nameThe name of the filtered topicrelated_topicThe related Topicfilter_expressionSQL-like filter expressionexpression_parametersParameters for the filter expression
Returns:
Pointer to the new ContentFilteredTopic, or nullptr on error
function create_publisher [1/2]
Create a publisher.
Publisher * astutedds::dcps::DomainParticipant::create_publisher (
const PublisherQos & qos=PublisherQos {}
)
function create_publisher [2/2]
Create a publisher with listener and status mask (PSM overload)
inline Publisher * astutedds::dcps::DomainParticipant::create_publisher (
const PublisherQos & qos,
PublisherListener * listener,
StatusMask mask=STATUS_MASK_ALL
)
function create_replier
Create a Replier (service-side RPC endpoint) for a service.
Replier * astutedds::dcps::DomainParticipant::create_replier (
const std::string & service_name,
const std::string & request_type_name,
const std::string & reply_type_name,
const ReplierQos & qos=ReplierQos {}
)
Topic derivation matches create_requester().
function create_requester
Create a Requester (client-side RPC endpoint) for a service.
Requester * astutedds::dcps::DomainParticipant::create_requester (
const std::string & service_name,
const std::string & request_type_name,
const std::string & reply_type_name,
const RequesterQos & qos=RequesterQos {}
)
The service_name is unqualified; the two underlying topics are derived as rq/<service_name>Request and rr/<service_name>Reply (matching the ROS 2 / DDS-RPC convention).
function create_subscriber [1/2]
Create a subscriber.
Subscriber * astutedds::dcps::DomainParticipant::create_subscriber (
const SubscriberQos & qos=SubscriberQos {}
)
function create_subscriber [2/2]
Create a subscriber with listener and status mask (PSM overload)
inline Subscriber * astutedds::dcps::DomainParticipant::create_subscriber (
const SubscriberQos & qos,
SubscriberListener * listener,
StatusMask mask=STATUS_MASK_ALL
)
function create_topic [1/2]
Create a topic in this domain.
Topic * astutedds::dcps::DomainParticipant::create_topic (
const std::string & topic_name,
const std::string & type_name,
const TopicQos & qos=TopicQos {}
)
function create_topic [2/2]
Create a topic with listener and status mask (PSM overload)
inline Topic * astutedds::dcps::DomainParticipant::create_topic (
const char * topic_name,
const char * type_name,
const TopicQos & qos,
TopicListener * listener,
StatusMask mask=STATUS_MASK_ALL
)
function deadline_timers
inline TimerService * astutedds::dcps::DomainParticipant::deadline_timers ()
Access the shared deadline TimerService. Returns nullptr if the participant has not been enable()d yet. Not part of the public DDS API — used by DataWriter / DataReader hooks.
function delete_contained_entities
Delete all contained entities (topics, publishers, subscribers)
ReturnCode_t astutedds::dcps::DomainParticipant::delete_contained_entities ()
function delete_contentfilteredtopic
Delete a content-filtered topic.
bool astutedds::dcps::DomainParticipant::delete_contentfilteredtopic (
ContentFilteredTopic * cft
)
function delete_publisher
Delete a publisher.
bool astutedds::dcps::DomainParticipant::delete_publisher (
Publisher * publisher
)
function delete_replier
Delete a Replier previously returned bycreate_replier() .
bool astutedds::dcps::DomainParticipant::delete_replier (
Replier * replier
)
function delete_requester
Delete a Requester previously returned bycreate_requester() .
bool astutedds::dcps::DomainParticipant::delete_requester (
Requester * requester
)
function delete_subscriber
Delete a subscriber.
bool astutedds::dcps::DomainParticipant::delete_subscriber (
Subscriber * subscriber
)
function delete_topic
Delete a topic.
bool astutedds::dcps::DomainParticipant::delete_topic (
Topic * topic
)
function deliver_data
Deliver received data to appropriate DataReaders.
void astutedds::dcps::DomainParticipant::deliver_data (
const std::string & topic_name,
const std::vector< uint8_t > & data,
const rtps::GUID_t & writer_guid=rtps::GUID_t {},
int32_t ownershipStrength=0,
const rtps::SequenceNumber_t & sequenceNumber=rtps::SequenceNumber_t {}
)
function domain_id
inline uint32_t astutedds::dcps::DomainParticipant::domain_id () const
function enable
Enable the participant (start discovery)
bool astutedds::dcps::DomainParticipant::enable ()
function get_default_publisher_qos
inline ReturnCode_t astutedds::dcps::DomainParticipant::get_default_publisher_qos (
PublisherQos & qos
) const
function get_default_subscriber_qos
inline ReturnCode_t astutedds::dcps::DomainParticipant::get_default_subscriber_qos (
SubscriberQos & qos
) const
function get_default_topic_qos
inline ReturnCode_t astutedds::dcps::DomainParticipant::get_default_topic_qos (
TopicQos & qos
) const
function get_discovered_publications
Enumerate all currently discovered remote DataWriters, one record per endpoint, each self-contained (embeds owning participant identity).
std::vector< DiscoveredPublication > astutedds::dcps::DomainParticipant::get_discovered_publications () const
function get_discovered_subscriptions
Enumerate all currently discovered remote DataReaders.
std::vector< DiscoveredSubscription > astutedds::dcps::DomainParticipant::get_discovered_subscriptions () const
function get_discovered_topic_names_and_types
Return a deduplicated list of {topic_name, type_name} pairs seen across all discovered remote writers and readers. Used by the RMW graph query API (rmw_get_topic_names_and_types).
std::vector< std::pair< std::string, std::string > > astutedds::dcps::DomainParticipant::get_discovered_topic_names_and_types () const
function get_listener
inline DomainParticipantListener * astutedds::dcps::DomainParticipant::get_listener () const
function get_listener_mask
inline StatusMask astutedds::dcps::DomainParticipant::get_listener_mask () const
function get_qos
inline const DomainParticipantQos & astutedds::dcps::DomainParticipant::get_qos () const
function get_reader_factory
Look up a registered reader factory for the given type name.
DataReaderFactory astutedds::dcps::DomainParticipant::get_reader_factory (
const std::string & type_name
) const
function get_writer_factory
Look up a registered writer factory for the given type name.
DataWriterFactory astutedds::dcps::DomainParticipant::get_writer_factory (
const std::string & type_name
) const
Returns:
The factory, or nullptr-wrapping empty std::function if not registered.
function guid_prefix
inline const rtps::GuidPrefix_t & astutedds::dcps::DomainParticipant::guid_prefix () const
function is_enabled
inline bool astutedds::dcps::DomainParticipant::is_enabled () const
function liveliness_manager
inline LivelinessManager * astutedds::dcps::DomainParticipant::liveliness_manager ()
Access the participant's liveliness manager. Returns nullptr if the participant has not been enable()d yet. Not part of the public DDS API — used by DataWriter / DataReader hooks.
function local_deliver
Deliver a sample from a local DataWriter to same-participant DataReaders.
void astutedds::dcps::DomainParticipant::local_deliver (
const std::string & topic_name,
const std::vector< uint8_t > & data,
const rtps::GUID_t & writer_guid,
const rtps::SequenceNumber_t & sequenceNumber
)
Intra-participant loopback: called by DataWriter::write() alongside the transport publish() so that same-participant readers can receive the sample without going through the RTPS/UDP path (which drops packets whose sender GUID prefix matches our own — see udp_transport.cpp).
Honours topic name, PublisherQos::partition vs SubscriberQos::partition matching, writer/reader RxO QoS compatibility, and per-reader DataReaderQos::ignore_local_publications. The RTPS transport publish path is untouched; remote (cross-participant) delivery still flows through the UDP transport unchanged.
function match_reader_to_discovered_writers
Match a newly created reader against already-discovered remote writers. Fires on_subscription_matched or on_requested_incompatible_qos as appropriate.
void astutedds::dcps::DomainParticipant::match_reader_to_discovered_writers (
DataReader * reader,
const std::vector< std::string > & subPartitions
)
function match_writer_to_discovered_readers
Match a newly created writer against already-discovered remote readers. Fires on_publication_matched or on_offered_incompatible_qos as appropriate.
void astutedds::dcps::DomainParticipant::match_writer_to_discovered_readers (
DataWriter * writer,
const std::vector< std::string > & pubPartitions
)
function notify_subscription
Notify that a subscription was created.
void astutedds::dcps::DomainParticipant::notify_subscription (
const std::string & topic_name
)
function operator=
DomainParticipant & astutedds::dcps::DomainParticipant::operator= (
const DomainParticipant &
) = delete
function participant_id
inline uint32_t astutedds::dcps::DomainParticipant::participant_id () const
function register_reader
Register a reader with the transport layer.
void astutedds::dcps::DomainParticipant::register_reader (
const std::string & topic_name,
const std::string & type_name,
const std::vector< std::string > & partitions={},
const DataReaderQos & qos={}
)
Parameters:
topic_nameThe topic the reader is subscribing totype_nameThe IDL type name for the topicpartitionsPartition names for this reader's subscriber
function register_type_factory
Register typed DataWriter/DataReader factories for a type name.
void astutedds::dcps::DomainParticipant::register_type_factory (
const std::string & type_name,
DataWriterFactory wf,
DataReaderFactory rf
)
When create_datawriter()/create_datareader() sees a topic whose type_name() matches, it delegates object construction to these factories instead of allocating a plain DataWriter/DataReader.
function register_writer
Register a writer with the transport layer.
void astutedds::dcps::DomainParticipant::register_writer (
const std::string & topic_name,
const std::string & type_name,
const std::vector< std::string > & partitions={},
const DataWriterQos & qos={}
)
Parameters:
topic_nameThe topic the writer is publishing topartitionsPartition names for this writer's publisher
function replay_history_to_reader
Replay TRANSIENT_LOCAL writer history to a newly matched reader. Called when a new remote reader matches a local writer with TRANSIENT_LOCAL durability.
void astutedds::dcps::DomainParticipant::replay_history_to_reader (
DataWriter * writer
)
function rtps_transport
inline rtps::RtpsUdpTransport * astutedds::dcps::DomainParticipant::rtps_transport () const
Low-level access to the underlying RTPS transport. Intended for tests and diagnostic tooling only — the DCPS API surface is the supported entry point for production code. Returns nullptr before enable() has been called successfully.
function send_data [1/2]
Send data via the transport layer.
void astutedds::dcps::DomainParticipant::send_data (
const std::string & topic_name,
const std::vector< uint8_t > & data
)
Parameters:
topic_nameThe topic to send ondataThe serialized data
function send_data [2/2]
Send dual-encoded data via the transport layer.
void astutedds::dcps::DomainParticipant::send_data (
const std::string & topic_name,
const std::vector< uint8_t > & xcdr1Data,
const std::vector< uint8_t > & xcdr2Data
)
Parameters:
topic_nameThe topic to send onxcdr1DataXCDR1 serialized dataxcdr2DataXCDR2 serialized data
function set_data_received_callback
inline void astutedds::dcps::DomainParticipant::set_data_received_callback (
DataReceivedCallback callback
)
function set_listener
inline void astutedds::dcps::DomainParticipant::set_listener (
DomainParticipantListener * listener,
StatusMask mask=STATUS_MASK_ALL
)
function set_participant_lease_duration_seconds
Override the outbound SPDP PID_PARTICIPANT_LEASE_DURATION. Defaults to 100 s per RTPS 2.5. Values below 1 s are clamped to 1 s. If called before enable() the new value is applied when the transport is created; if called after, the change takes effect on the next SPDP announcement.
void astutedds::dcps::DomainParticipant::set_participant_lease_duration_seconds (
uint32_t sec
)
function set_qos
void astutedds::dcps::DomainParticipant::set_qos (
const DomainParticipantQos & qos
)
function set_send_data_callback
inline void astutedds::dcps::DomainParticipant::set_send_data_callback (
SendDataCallback callback
)
function set_spdp_announce_interval_ms
Override the SPDP announcement interval in milliseconds. Defaults to 3000 ms. Values below 50 ms are clamped. Applies immediately when called after enable() .
void astutedds::dcps::DomainParticipant::set_spdp_announce_interval_ms (
uint32_t ms
)
function set_subscribe_callback
inline void astutedds::dcps::DomainParticipant::set_subscribe_callback (
SubscribeCallback callback
)
function stop
Stop the participant.
void astutedds::dcps::DomainParticipant::stop ()
function unregister_reader
Unregister a reader from the transport layer.
void astutedds::dcps::DomainParticipant::unregister_reader (
const std::string & topic_name
)
§1.1b-A fast-path — see unregister_writer. Called from Subscriber::delete_datareader.
function unregister_writer
Unregister a writer from the transport layer.
void astutedds::dcps::DomainParticipant::unregister_writer (
const std::string & topic_name
)
§1.1b-A fast-path: emits a SEDP DATA(w) DISPOSE so peers unmatch immediately rather than waiting for the lease sweeper. Called from Publisher::delete_datawriter on clean shutdown.
function ~DomainParticipant
astutedds::dcps::DomainParticipant::~DomainParticipant ()
The documentation for this class was generated from the following file include/astutedds/dcps/dcps.hpp