Apollo 10.0
自动驾驶开放平台
livox_obserable_binder.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2024 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#ifndef APOLLO_LIVOX_OBSERABLE_BINDER_H
17#define APOLLO_LIVOX_OBSERABLE_BINDER_H
18
19#include <functional>
20#include <memory>
21#include <utility>
22
23#include "cyber/cyber.h"
24
25namespace apollo {
26namespace drivers {
27namespace lidar {
28
29template <typename... FuncArgs>
31 public:
32 using FuncType = std::shared_ptr<std::function<void(FuncArgs...)>>;
33 static void Callback(FuncArgs... args);
34
35 static void RegisterCallback(FuncType func);
36
38};
39
40template <typename... FuncArgs>
42 if (func_cb_) {
43 (*func_cb_)(std::forward<FuncArgs>(args)...);
44 } else {
45 AERROR << "Binder callback is empty";
46 }
47}
48
49template <typename... FuncArgs>
54
55template <typename... FuncArgs>
56std::shared_ptr<std::function<void(FuncArgs...)>>
57 LivoxObserableBinder<FuncArgs...>::func_cb_ = nullptr;
58
59} // namespace lidar
60} // namespace drivers
61} // namespace apollo
62#endif // APOLLO_LIVOX_OBSERABLE_BINDER_H
std::shared_ptr< std::function< void(FuncArgs...)> > FuncType
#define AERROR
Definition log.h:44
class register implement
Definition arena_queue.h:37