13#include <fastdds/dds/domain/DomainParticipant.hpp>
14#include <fastdds/dds/domain/DomainParticipantFactory.hpp>
19 template <
typename MsgPubSubType>
22 template <
typename MsgPubSubType>
30 class Node :
public std::enable_shared_from_this<Node>
33 explicit Node(
const std::string& name, eprosima::fastdds::dds::DomainId_t domain_id = 0)
35 eprosima::fastdds::dds::DomainParticipantQos pqos;
38 eprosima::fastdds::dds::DomainParticipantFactory::get_instance()
39 ->create_participant(domain_id, pqos);
45 eprosima::fastdds::dds::DomainParticipantFactory::get_instance()
46 ->delete_participant(participant_);
55 eprosima::fastdds::dds::DomainParticipant*
participant()
const
68 template <
typename PubSubT>
71 return std::make_shared<Publisher<PubSubT>>(
72 shared_from_this(), topic_name, qos_depth);
84 template <
typename PubSubT>
89 return std::make_shared<Subscription<PubSubT>>(
90 shared_from_this(), topic_name, qos_depth, std::move(cb));
95 eprosima::fastdds::dds::DomainParticipant* participant_{
nullptr };
auto create_subscription(const std::string &topic_name, int qos_depth, typename Subscription< PubSubT >::Callback cb)
Create a subscription object
定义 node.hpp:85
auto create_publisher(const std::string &topic_name, int qos_depth=10)
Create a publisher object
定义 node.hpp:69
eprosima::fastdds::dds::DomainParticipant * participant() const
Get the DDS DomainParticipant.
定义 node.hpp:55
Represents a DDS publisher.
定义 publisher.hpp:28
Represents a DDS subscription.
定义 subscriber.hpp:28
std::function< void(const typename MsgPubSubType::type &)> Callback
Callback type for message reception.
定义 subscriber.hpp:37
Namespace for zzs communication library.
定义 node.hpp:18