Apollo 11.0
自动驾驶开放平台
participant.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_TRANSPORT_RTPS_PARTICIPANT_H_
18#define CYBER_TRANSPORT_RTPS_PARTICIPANT_H_
19
20#include <atomic>
21#include <memory>
22#include <mutex>
23#include <string>
24
26#include "fastrtps/Domain.h"
27#include "fastrtps/attributes/ParticipantAttributes.h"
28#include "fastrtps/participant/Participant.h"
29#include "fastrtps/participant/ParticipantListener.h"
30#include "fastrtps/rtps/common/Locator.h"
31
32namespace apollo {
33namespace cyber {
34namespace transport {
35
36class Participant;
37using ParticipantPtr = std::shared_ptr<Participant>;
38
40 public:
41 Participant(const std::string& name, int send_port,
42 eprosima::fastrtps::ParticipantListener* listener = nullptr);
43 virtual ~Participant();
44
45 void Shutdown();
46
47 eprosima::fastrtps::Participant* fastrtps_participant();
48 bool is_shutdown() const { return shutdown_.load(); }
49
50 private:
51 void CreateFastRtpsParticipant(
52 const std::string& name, int send_port,
53 eprosima::fastrtps::ParticipantListener* listener);
54
55 std::atomic<bool> shutdown_;
56 std::string name_;
57 int send_port_;
58 eprosima::fastrtps::ParticipantListener* listener_;
60 eprosima::fastrtps::Participant* fastrtps_participant_;
61 std::mutex mutex_;
62};
63
64} // namespace transport
65} // namespace cyber
66} // namespace apollo
67
68#endif // CYBER_TRANSPORT_RTPS_PARTICIPANT_H_
eprosima::fastrtps::Participant * fastrtps_participant()
This class represents the TopicDataType of the type UnderlayMessage defined by the user in the IDL fi...
std::shared_ptr< Participant > ParticipantPtr
Definition participant.h:37
class register implement
Definition arena_queue.h:37