Apollo
11.0
自动驾驶开放平台
participant_listener.h
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2018 The Apollo Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*****************************************************************************/
16
17
#ifndef CYBER_SERVICE_DISCOVERY_COMMUNICATION_PARTICIPANT_LISTENER_H_
18
#define CYBER_SERVICE_DISCOVERY_COMMUNICATION_PARTICIPANT_LISTENER_H_
19
20
#include <functional>
21
#include <mutex>
22
23
#include "fastrtps/Domain.h"
24
#include "fastrtps/participant/Participant.h"
25
#include "fastrtps/participant/ParticipantListener.h"
26
27
namespace
apollo
{
28
namespace
cyber {
29
namespace
service_discovery {
30
31
class
ParticipantListener
:
public
eprosima::fastrtps::ParticipantListener {
32
public
:
33
using
ChangeFunc
= std::function<void(
34
const
eprosima::fastrtps::ParticipantDiscoveryInfo& info)>;
35
36
explicit
ParticipantListener
(
const
ChangeFunc
& callback);
37
virtual
~ParticipantListener
();
38
39
virtual
void
onParticipantDiscovery
(
40
eprosima::fastrtps::Participant* p,
41
eprosima::fastrtps::ParticipantDiscoveryInfo info);
42
43
private
:
44
ChangeFunc
callback_;
45
std::mutex mutex_;
46
};
47
48
}
// namespace service_discovery
49
}
// namespace cyber
50
}
// namespace apollo
51
52
#endif
// CYBER_SERVICE_DISCOVERY_COMMUNICATION_PARTICIPANT_LISTENER_H_
apollo::cyber::service_discovery::ParticipantListener
Definition
participant_listener.h:31
apollo::cyber::service_discovery::ParticipantListener::onParticipantDiscovery
virtual void onParticipantDiscovery(eprosima::fastrtps::Participant *p, eprosima::fastrtps::ParticipantDiscoveryInfo info)
Definition
participant_listener.cc:33
apollo::cyber::service_discovery::ParticipantListener::~ParticipantListener
virtual ~ParticipantListener()
Definition
participant_listener.cc:28
apollo::cyber::service_discovery::ParticipantListener::ChangeFunc
std::function< void(const eprosima::fastrtps::ParticipantDiscoveryInfo &info)> ChangeFunc
Definition
participant_listener.h:34
apollo
class register implement
Definition
arena_queue.h:37
cyber
service_discovery
communication
participant_listener.h