Apollo 10.0
自动驾驶开放平台
subscriber_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_TRANSPORT_DISPATCHER_SUBSCRIBER_LISTENER_H_
18#define CYBER_TRANSPORT_DISPATCHER_SUBSCRIBER_LISTENER_H_
19
20#include <functional>
21#include <iostream>
22#include <memory>
23#include <mutex>
24#include <string>
25
26#include "cyber/base/macros.h"
27
28#include "fastdds/dds/subscriber/DataReader.hpp"
29#include "fastdds/dds/subscriber/SampleInfo.hpp"
30#include "fastdds/dds/subscriber/SubscriberListener.hpp"
31#include "fastdds/dds/topic/TopicDescription.hpp"
32
33#include "cyber/common/util.h"
38
39namespace apollo {
40namespace cyber {
41namespace transport {
42namespace dispatcher {
43class SubscriberListener : public eprosima::fastdds::dds::SubscriberListener {
44 public:
45 explicit SubscriberListener(const rtps::subsciber_callback& callback);
46 virtual ~SubscriberListener();
47
48 void on_data_available(eprosima::fastdds::dds::DataReader* reader) override;
50 eprosima::fastdds::dds::DataReader* reader,
51 const eprosima::fastdds::dds::SubscriptionMatchedStatus& info)
52 override; // NOLINT
53
54 private:
56 MessageInfo msg_info_;
57 std::mutex mutex_;
58};
59
60} // namespace dispatcher
61} // namespace transport
62} // namespace cyber
63} // namespace apollo
64
65#endif // CYBER_TRANSPORT_DISPATCHER_SUBSCRIBER_LISTENER_H_
void on_subscription_matched(eprosima::fastdds::dds::DataReader *reader, const eprosima::fastdds::dds::SubscriptionMatchedStatus &info) override
void on_data_available(eprosima::fastdds::dds::DataReader *reader) override
std::function< void(const std::shared_ptr< std::string > &msg_str, uint64_t channel_id, const MessageInfo &msg_info)> subsciber_callback
Definition common_type.h:30
class register implement
Definition arena_queue.h:37