Apollo
10.0
自动驾驶开放平台
multicast_notifier.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_SHM_MULTICAST_NOTIFIER_H_
18
#define CYBER_TRANSPORT_SHM_MULTICAST_NOTIFIER_H_
19
20
#include <netinet/in.h>
21
#include <atomic>
22
23
#include "
cyber/common/macros.h
"
24
#include "
cyber/transport/shm/notifier_base.h
"
25
26
namespace
apollo
{
27
namespace
cyber {
28
namespace
transport {
29
30
class
MulticastNotifier
:
public
NotifierBase
{
31
public
:
32
virtual
~MulticastNotifier
();
33
34
void
Shutdown
()
override
;
35
bool
Notify
(
const
ReadableInfo
& info)
override
;
36
bool
Listen
(
int
timeout_ms,
ReadableInfo
* info)
override
;
37
38
static
const
char
*
Type
() {
return
"multicast"
; }
39
40
private
:
41
bool
Init();
42
43
int
notify_fd_ = -1;
44
struct
sockaddr_in notify_addr_;
45
int
listen_fd_ = -1;
46
struct
sockaddr_in listen_addr_;
47
48
std::atomic<bool> is_shutdown_ = {
false
};
49
50
DECLARE_SINGLETON
(MulticastNotifier)
51
};
52
53
}
// namespace transport
54
}
// namespace cyber
55
}
// namespace apollo
56
57
#endif
// CYBER_TRANSPORT_SHM_MULTICAST_NOTIFIER_H_
apollo::cyber::transport::MulticastNotifier
Definition
multicast_notifier.h:30
apollo::cyber::transport::MulticastNotifier::~MulticastNotifier
virtual ~MulticastNotifier()
Definition
multicast_notifier.cc:43
apollo::cyber::transport::MulticastNotifier::Notify
bool Notify(const ReadableInfo &info) override
Definition
multicast_notifier.cc:63
apollo::cyber::transport::MulticastNotifier::Listen
bool Listen(int timeout_ms, ReadableInfo *info) override
Definition
multicast_notifier.cc:76
apollo::cyber::transport::MulticastNotifier::Type
static const char * Type()
Definition
multicast_notifier.h:38
apollo::cyber::transport::MulticastNotifier::Shutdown
void Shutdown() override
Definition
multicast_notifier.cc:45
apollo::cyber::transport::NotifierBase
Definition
notifier_base.h:31
apollo::cyber::transport::ReadableInfo
Definition
readable_info.h:32
macros.h
DECLARE_SINGLETON
#define DECLARE_SINGLETON(classname)
Definition
macros.h:52
apollo
class register implement
Definition
arena_queue.h:37
notifier_base.h
cyber
transport
shm
multicast_notifier.h