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
"
34
#include "
cyber/transport/message/message_info.h
"
35
#include "
cyber/transport/common/common_type.h
"
36
#include "
cyber/transport/rtps/underlay_message.h
"
37
#include "
cyber/transport/rtps/underlay_message_type.h
"
38
39
namespace
apollo
{
40
namespace
cyber {
41
namespace
transport {
42
namespace
dispatcher {
43
class
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
;
49
void
on_subscription_matched
(
50
eprosima::fastdds::dds::DataReader* reader,
51
const
eprosima::fastdds::dds::SubscriptionMatchedStatus& info)
52
override
;
// NOLINT
53
54
private
:
55
rtps::subsciber_callback
callback_;
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_
apollo::cyber::transport::MessageInfo
Definition
message_info.h:30
apollo::cyber::transport::dispatcher::SubscriberListener
Definition
subscriber_listener.h:43
apollo::cyber::transport::dispatcher::SubscriberListener::on_subscription_matched
void on_subscription_matched(eprosima::fastdds::dds::DataReader *reader, const eprosima::fastdds::dds::SubscriptionMatchedStatus &info) override
Definition
subscriber_listener.cc:66
apollo::cyber::transport::dispatcher::SubscriberListener::on_data_available
void on_data_available(eprosima::fastdds::dds::DataReader *reader) override
Definition
subscriber_listener.cc:32
apollo::cyber::transport::dispatcher::SubscriberListener::~SubscriberListener
virtual ~SubscriberListener()
Definition
subscriber_listener.cc:30
common_type.h
macros.h
util.h
message_info.h
apollo::cyber::transport::rtps::subsciber_callback
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
apollo
class register implement
Definition
arena_queue.h:37
underlay_message.h
underlay_message_type.h
cyber
transport
dispatcher
subscriber_listener.h