Apollo 10.0
自动驾驶开放平台
fuel_monitor_manager.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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 <memory>
20#include <string>
21#include <unordered_map>
22
23#include <boost/thread/shared_mutex.hpp>
24
25#include "cyber/common/macros.h"
28
33namespace apollo {
34namespace dreamview {
35
37 std::unordered_map<std::string, std::unique_ptr<FuelMonitor>>;
38
40 public:
41 void RegisterFuelMonitor(const std::string& mode,
42 std::unique_ptr<FuelMonitor>&& fuel_monitor);
43
44 void SetCurrentMode(const std::string& mode);
45
46 // Getter
48
49 private:
50 std::unordered_map<std::string, FuelMonitorMap> monitors_;
51 FuelMonitorMap* current_monitors_ = nullptr;
52 std::string current_mode_;
53 // Mutex to protect concurrent access to current_progress_json_.
54 // NOTE: Use boost until we have std version of rwlock support.
55 boost::shared_mutex mutex_;
56
58};
59
60} // namespace dreamview
61} // namespace apollo
void RegisterFuelMonitor(const std::string &mode, std::unique_ptr< FuelMonitor > &&fuel_monitor)
void SetCurrentMode(const std::string &mode)
#define DECLARE_SINGLETON(classname)
Definition macros.h:52
std::unordered_map< std::string, std::unique_ptr< FuelMonitor > > FuelMonitorMap
class register implement
Definition arena_queue.h:37