Apollo 10.0
自动驾驶开放平台
udp_bridge_sender_component.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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#pragma once
18
19#include <netinet/in.h>
20#include <sys/socket.h>
21
22#include <cstdlib>
23#include <iostream>
24#include <memory>
25#include <string>
26#include <vector>
27
28#include "modules/bridge/proto/udp_bridge_remote_info.pb.h"
29#include "modules/common_msgs/planning_msgs/planning.pb.h"
30
33#include "cyber/cyber.h"
34#include "cyber/init.h"
35#include "cyber/io/session.h"
40
41namespace apollo {
42namespace bridge {
43
44#define BRIDGE_COMPONENT_REGISTER(pb_msg) \
45 CYBER_REGISTER_COMPONENT(UDPBridgeSenderComponent<pb_msg>)
46
47template <typename T>
49 public:
51 : monitor_logger_buffer_(common::monitor::MonitorMessageItem::CONTROL) {}
52
53 bool Init() override;
54 bool Proc(const std::shared_ptr<T> &pb_msg) override;
55
56 std::string Name() const { return FLAGS_bridge_module_name; }
57
58 private:
59 common::monitor::MonitorLogBuffer monitor_logger_buffer_;
60 unsigned int remote_port_ = 0;
61 std::string remote_ip_ = "";
62 std::string proto_name_ = "";
63 std::mutex mutex_;
64};
65
68
69} // namespace bridge
70} // namespace apollo
bool Proc(const std::shared_ptr< T > &pb_msg) override
Some util functions.
The class of MonitorLogBuffer
class register implement
Definition arena_queue.h:37
#define BRIDGE_COMPONENT_REGISTER(pb_msg)