Struct AstuteDDSContext
#include <types.hpp>
Classes
| Type | Name |
|---|---|
| struct | NodeEndpoint |
| struct | NodeIdentity |
Public Attributes
| Type | Name |
|---|---|
| std::vector< std::string > | clients Service names of every rmw_client_t alive in this context. |
| AstuteDDS_Publisher | dds_pub = { nullptr }Factory for all DataWriters created by this context. |
| AstuteDDS_Subscriber | dds_sub = { nullptr }Factory for all DataReaders created by this context. |
| std::mutex | endpoint_mtx |
| std::map< std::array< uint8_t, 16 >, NodeIdentity > | gid_to_node |
| rmw_dds_common::Context | graph_ctx |
| std::mutex | graph_mtx |
| rmw_publisher_t | graph_pub_handle = {}Never-dereferenced placeholder targets for graph_ctx.pub /.sub . |
| AstuteDDS_DataReader | graph_reader = { nullptr } |
| rmw_subscription_t | graph_sub_handle = {} |
| AstuteDDS_Topic | graph_topic = { nullptr }Raw DDS entities backing the ros_discovery_info topic. |
| TypeSupportHandle | graph_type_support = {} |
| AstuteDDS_DataWriter | graph_writer = { nullptr } |
| std::vector< NodeEndpoint > | local_clients |
| std::vector< NodeEndpoint > | local_publishers |
| std::vector< NodeEndpoint > | local_services |
| std::vector< NodeEndpoint > | local_subscriptions |
| std::vector< rmw_guard_condition_t * > | node_gcs |
| std::mutex | node_mtx Protects nodes . |
| std::vector< std::pair< std::string, std::string > > | nodes (name, namespace) of every node created in this context. |
| AstuteDDS_Participant | participant = { nullptr }The one DomainParticipant this RMW context owns. |
| std::vector< std::string > | services Service names of every rmw_service_t alive in this context. |
| std::shared_mutex | shutdown_mtx |
| std::atomic< bool > | shutting_down = {false} |
| std::mutex | svc_mtx Protects services andclients . |
| std::mutex | topic_mtx |
| std::map< std::string, int > | topic_refcount |
Detailed Description
Per-context state pointed to by rmw_context_t::impl.
Owns the DomainParticipant plus the two DDS entity factories (a Publisher for DataWriters, a Subscriber for DataReaders). Also holds in-process registries — nodes and service/client names — so graph queries and rmw_service_server_is_available() can answer sensibly when everything lives in one process.
Public Attributes Documentation
variable clients
Service names of every rmw_client_t alive in this context.
std::vector<std::string> AstuteDDSContext::clients;
variable dds_pub
Factory for all DataWriters created by this context.
AstuteDDS_Publisher AstuteDDSContext::dds_pub;
variable dds_sub
Factory for all DataReaders created by this context.
AstuteDDS_Subscriber AstuteDDSContext::dds_sub;
variable endpoint_mtx
std::mutex AstuteDDSContext::endpoint_mtx;
variable gid_to_node
std::map<std::array<uint8_t, 16>, NodeIdentity> AstuteDDSContext::gid_to_node;
variable graph_ctx
rmw_dds_common::Context AstuteDDSContext::graph_ctx;
Cross-process graph state (rmw_dds_common::GraphCache + participant GID + "publish a ParticipantEntitiesInfo update" callback). Populated locally on every node/pub/sub create+destroy (see graph_sync.hpp) and kept in sync with remote participants via the ros_discovery_info topic, so rmw_get_node_names() and the _by_node graph queries work across processes instead of only for nodes created in this one. graph_ctx.pub/sub point at graph_pub_handle / graph_sub_handle below rather than real publisher/subscription objects: rmw_dds_common::Context:: add_node_graph() et al. require non-null pointers there (verified empirically — a null pub makes every *_graph() call fail before it even touches graph_cache), but never dereference their contents, since this RMW writes/reads the DDS entities below directly instead of through the public rmw_publisher_t/rmw_subscription_t API (no node exists yet when the context is created).
variable graph_mtx
std::mutex AstuteDDSContext::graph_mtx;
Serialises every access to graph_ctx (both the local mutation path in node.cpp/pubsub/*.cpp and the ros_discovery_info reader's data-available callback in graph_sync.cpp), since local mutation goes through rmw_dds_common::Context's own internal mutex while the reader callback calls graph_cache.update_participant_entities() directly \u2014 without this, those two paths only serialise against each other via GraphCache's own per-call locking, not as the single atomic operations (cache mutation + publish) they need to be.
variable graph_pub_handle
Never-dereferenced placeholder targets for graph_ctx.pub /.sub .
rmw_publisher_t AstuteDDSContext::graph_pub_handle;
variable graph_reader
AstuteDDS_DataReader AstuteDDSContext::graph_reader;
variable graph_sub_handle
rmw_subscription_t AstuteDDSContext::graph_sub_handle;
variable graph_topic
Raw DDS entities backing the ros_discovery_info topic.
AstuteDDS_Topic AstuteDDSContext::graph_topic;
variable graph_type_support
TypeSupportHandle AstuteDDSContext::graph_type_support;
Resolved once in graph_sync_init(); describes rmw_dds_common::msg::ParticipantEntitiesInfo's layout for the CDR codec, reused by every publish and by the reader's data-available callback.
variable graph_writer
AstuteDDS_DataWriter AstuteDDSContext::graph_writer;
variable local_clients
std::vector<NodeEndpoint> AstuteDDSContext::local_clients;
variable local_publishers
std::vector<NodeEndpoint> AstuteDDSContext::local_publishers;
variable local_services
std::vector<NodeEndpoint> AstuteDDSContext::local_services;
variable local_subscriptions
std::vector<NodeEndpoint> AstuteDDSContext::local_subscriptions;
variable node_gcs
std::vector<rmw_guard_condition_t *> AstuteDDSContext::node_gcs;
Graph guard condition of every node currently alive in this context, parallel to nodes (same index, protected by node_mtx) so a graph_cache change (local or remote) can wake every node's rmw_wait(). Each node keeps its own private guard condition (see AstuteDDSNode) rather than sharing one, so this is a fan-out list rather than a single shared handle.
variable node_mtx
Protects nodes .
std::mutex AstuteDDSContext::node_mtx;
variable nodes
(name, namespace) of every node created in this context.
std::vector<std::pair<std::string, std::string> > AstuteDDSContext::nodes;
variable participant
The one DomainParticipant this RMW context owns.
AstuteDDS_Participant AstuteDDSContext::participant;
variable services
Service names of every rmw_service_t alive in this context.
std::vector<std::string> AstuteDDSContext::services;
variable shutdown_mtx
std::shared_mutex AstuteDDSContext::shutdown_mtx;
Guards every hot-path call into a DataReader/DataWriter (rmw_take*, rmw_publish*, rmw_wait's per-subscription poll) against rmw_shutdown() concurrently destroying those same DDS entities (DomainParticipant::stop() clears subscribers_/ publishers_, freeing every DataReader/DataWriter). Without this, a background executor thread still spinning when SIGTERM triggers rcl_shutdown() on another thread can call astutedds_take_next()/astutedds_write() on an already-freed reader/writer — confirmed via AddressSanitizer as a genuine heap-use-after-free (not a theoretical concern).
Hot-path callers take a shared lock, then re-check shutting_down before touching the DDS entity. rmw_shutdown() sets shutting_down first, then takes a unique lock purely as a barrier — this blocks until any in-flight shared-lock holder finishes, guaranteeing no concurrent core-API call is in progress before the entities are destroyed.
variable shutting_down
std::atomic<bool> AstuteDDSContext::shutting_down;
variable svc_mtx
Protects services andclients .
std::mutex AstuteDDSContext::svc_mtx;
variable topic_mtx
std::mutex AstuteDDSContext::topic_mtx;
Reference count per DDS topic name.
astutedds::dcps::DomainParticipant::create_topic() deduplicates by name: a second astutedds_create_topic() call for a topic name that already exists on this participant returns the SAME Topic* rather than creating a new one (e.g. when a publisher and a subscription, or several of either, share a topic). astutedds_delete_topic() has no refcounting of its own, so deleting it as soon as the first side is torn down frees memory a still-live DataWriter/DataReader on the other side continues to reference. Every rmw_create_publisher/ rmw_create_subscription call must increment this counter after a successful astutedds_create_topic(), and every rmw_destroy_ publisher/rmw_destroy_subscription (and any later failure path in create) must go through release_topic_ref() instead of calling astutedds_delete_topic() directly, only actually deleting once the count reaches zero. Protected by topic_mtx.
variable topic_refcount
std::map<std::string, int> AstuteDDSContext::topic_refcount;
The documentation for this class was generated from the following file include/astutedds/rmw/types.hpp