15 #ifndef RCLCPP__PUBLISHER_FACTORY_HPP_    16 #define RCLCPP__PUBLISHER_FACTORY_HPP_    24 #include "rosidl_typesupport_cpp/message_type_support.hpp"    49       rclcpp::publisher::PublisherBase::SharedPtr(
    51         const std::string & topic_name,
    61         rclcpp::publisher::PublisherBase::SharedPtr publisher)>;
    70         rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm)>;
    76 template<
typename MessageT, 
typename Alloc, 
typename PublisherT>
    86     const std::string & topic_name,
    89       auto message_alloc = std::make_shared<typename PublisherT::MessageAlloc>(*allocator.get());
    90       publisher_options.allocator = allocator::get_rcl_allocator<MessageT>(*message_alloc.get());
    92       return std::make_shared<PublisherT>(node_base, topic_name, publisher_options, message_alloc);
    99     rclcpp::publisher::PublisherBase::SharedPtr publisher) -> uint64_t
   101       return ipm->
add_publisher<MessageT, Alloc>(std::dynamic_pointer_cast<PublisherT>(publisher));
   107     [](rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm) -> StoreMessageCallbackT
   109       rclcpp::intra_process_manager::IntraProcessManager::WeakPtr weak_ipm = ipm;
   113       auto shared_publish_callback =
   114         [weak_ipm](uint64_t publisher_id, 
void * msg, 
const std::type_info & type_info) -> uint64_t
   116           auto ipm = weak_ipm.lock();
   119             throw std::runtime_error(
   120                     "intra process publish called after destruction of intra process manager");
   123             throw std::runtime_error(
"cannot publisher msg which is a null pointer");
   125           auto & message_type_info = 
typeid(MessageT);
   126           if (message_type_info != type_info) {
   127             throw std::runtime_error(
   128                     std::string(
"published type '") + type_info.name() +
   129                     "' is incompatible from the publisher type '" + message_type_info.name() + 
"'");
   131           MessageT * typed_message_ptr = 
static_cast<MessageT *
>(msg);
   133           std::unique_ptr<MessageT, MessageDeleter> unique_msg(typed_message_ptr);
   134           uint64_t message_seq =
   139       return shared_publish_callback;
   148 #endif  // RCLCPP__PUBLISHER_FACTORY_HPP_ PublisherFactory create_publisher_factory(std::shared_ptr< Alloc > allocator)
Return a PublisherFactory with functions setup for creating a PublisherT<MessageT, Alloc>. 
Definition: publisher_factory.hpp:78
 
PublisherFactoryFunction create_typed_publisher
Definition: publisher_factory.hpp:54
 
SharedPublishCallbackFactoryFunction create_shared_publish_callback
Definition: publisher_factory.hpp:72
 
Definition: allocator_common.hpp:24
 
Factory with functions used to create a MessageT specific PublisherT. 
Definition: publisher_factory.hpp:45
 
std::function< uint64_t(uint64_t, void *, const std::type_info &)> StoreMessageCallbackT
Definition: publisher.hpp:121
 
uint64_t store_intra_process_message(uint64_t intra_process_publisher_id, std::unique_ptr< MessageT, Deleter > &message)
Store a message in the manager, and return the message sequence number. 
Definition: intra_process_manager.hpp:244
 
AddPublisherToIntraProcessManagerFunction add_publisher_to_intra_process_manager
Definition: publisher_factory.hpp:63
 
allocator::Deleter< MessageAlloc, MessageT > MessageDeleter
Definition: publisher.hpp:151
 
uint64_t add_publisher(typename publisher::Publisher< MessageT, Alloc >::SharedPtr publisher, size_t buffer_size=0)
Register a publisher with the manager, returns the publisher unique id. 
Definition: intra_process_manager.hpp:188
 
Pure virtual interface class for the NodeBase part of the Node API. 
Definition: node_base_interface.hpp:36
 
std::function< rclcpp::publisher::PublisherBase::SharedPtr(rclcpp::node_interfaces::NodeBaseInterface *node_base, const std::string &topic_name, rcl_publisher_options_t &publisher_options)> PublisherFactoryFunction
Definition: publisher_factory.hpp:52
 
This class facilitates intra process communication between nodes. 
Definition: intra_process_manager.hpp:121
 
std::function< rclcpp::publisher::PublisherBase::StoreMessageCallbackT(rclcpp::intra_process_manager::IntraProcessManager::SharedPtr ipm)> SharedPublishCallbackFactoryFunction
Definition: publisher_factory.hpp:70
 
std::function< uint64_t(rclcpp::intra_process_manager::IntraProcessManager *ipm, rclcpp::publisher::PublisherBase::SharedPtr publisher)> AddPublisherToIntraProcessManagerFunction
Definition: publisher_factory.hpp:61