Template Class BasicPublisher
Defined in File agnocast_publisher.hpp
Class Documentation
-
template<typename MessageT, typename BridgeRequestPolicy>
class BasicPublisher Public Types
Public Functions
-
inline BasicPublisher(rclcpp::Node *node, const std::string &topic_name, const rclcpp::QoS &qos, const PublisherOptions &options, const bool is_bridge = false)
-
inline BasicPublisher(agnocast::Node *node, const std::string &topic_name, const rclcpp::QoS &qos, const PublisherOptions &options = PublisherOptions{})
-
inline ~BasicPublisher()
- inline AGNOCAST_PUBLIC ipc_shared_ptr< MessageT > borrow_loaned_message ()
Allocate a new default-constructed message in shared memory. The caller must either pass the returned pointer to publish() or let it go out of scope (which frees the memory).
- Returns:
Owned pointer to the newly allocated message in shared memory.
- inline AGNOCAST_PUBLIC void publish (ipc_shared_ptr< MessageT > &&message)
Publish a message via zero-copy IPC. Ownership is transferred: after this call, the passed-in ipc_shared_ptr and all copies sharing its control block are invalidated — dereferencing them calls std::terminate().
- Parameters:
message – Message obtained from borrow_loaned_message(). Must be moved in.
- inline AGNOCAST_PUBLIC uint32_t get_subscription_count () const
Return the total subscriber count for this topic (Agnocast + ROS 2 via bridge).
- Returns:
Total subscriber count.
- inline AGNOCAST_PUBLIC const rmw_gid_t & get_gid () const
Return the GID of this publisher, unique across both Agnocast and ROS 2.
- Returns:
Publisher GID.
- inline AGNOCAST_PUBLIC uint32_t get_intra_subscription_count () const
Return the number of Agnocast intra-process subscribers only (excludes ROS 2).
- Returns:
Agnocast subscriber count.
- inline AGNOCAST_PUBLIC const char * get_topic_name () const
Return the fully-resolved topic name.
- Returns:
Null-terminated topic name string.
-
inline BasicPublisher(rclcpp::Node *node, const std::string &topic_name, const rclcpp::QoS &qos, const PublisherOptions &options, const bool is_bridge = false)