Apollo 10.0
自动驾驶开放平台
apollo::cyber::service_discovery::ParticipantListener类 参考

#include <participant_listener.h>

类 apollo::cyber::service_discovery::ParticipantListener 继承关系图:
apollo::cyber::service_discovery::ParticipantListener 的协作图:

Public 类型

using ChangeFunc = std::function< void(const eprosima::fastrtps::rtps::ParticipantDiscoveryInfo &info)>
 

Public 成员函数

 ParticipantListener (const ChangeFunc &callback)
 
virtual ~ParticipantListener ()
 
void on_participant_discovery (eprosima::fastdds::dds::DomainParticipant *p, eprosima::fastrtps::rtps::ParticipantDiscoveryInfo &&info) override
 Event handler for participant discovery.
 

详细描述

在文件 participant_listener.h32 行定义.

成员类型定义说明

◆ ChangeFunc

using apollo::cyber::service_discovery::ParticipantListener::ChangeFunc = std::function<void( const eprosima::fastrtps::rtps::ParticipantDiscoveryInfo& info)>

在文件 participant_listener.h35 行定义.

构造及析构函数说明

◆ ParticipantListener()

apollo::cyber::service_discovery::ParticipantListener::ParticipantListener ( const ChangeFunc callback)
explicit

在文件 participant_listener.cc25 行定义.

26 : callback_(callback) {}

◆ ~ParticipantListener()

apollo::cyber::service_discovery::ParticipantListener::~ParticipantListener ( )
virtual

在文件 participant_listener.cc28 行定义.

28 {
29 std::lock_guard<std::mutex> lck(mutex_);
30 callback_ = nullptr;
31}

成员函数说明

◆ on_participant_discovery()

void apollo::cyber::service_discovery::ParticipantListener::on_participant_discovery ( eprosima::fastdds::dds::DomainParticipant *  p,
eprosima::fastrtps::rtps::ParticipantDiscoveryInfo &&  info 
)
override

Event handler for participant discovery.

This function is called when a new participant is discovered in the DDS domain.

参数
pPointer to the DomainParticipant. This parameter is unused in this function. DomainParticipant represents an entity that participates in a DDS domain, allowing publishers and subscribers to communicate.
infoAn rvalue reference to the ParticipantDiscoveryInfo, which contains information about the discovered participant.

在文件 participant_listener.cc44 行定义.

46 {
47 RETURN_IF_NULL(callback_);
48 (void)p;
49 std::lock_guard<std::mutex> lock(mutex_);
50 callback_(info);
51}
#define RETURN_IF_NULL(ptr)
Definition log.h:90

该类的文档由以下文件生成: