Apollo  6.0
Open source self driving car software
scene_manager.h
Go to the documentation of this file.
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 #pragma once
17 
18 #include <map>
19 #include <string>
20 
22 
23 namespace apollo {
24 namespace perception {
25 namespace lidar {
26 
28 
29 class SceneManager {
30  public:
31  static SceneManager& Instance() {
32  static SceneManager manager;
33  return manager;
34  }
35  ~SceneManager() = default;
36  // @brief: initialize scene manager with lock
37  // @param [in]: initialization options
38  // @return: status
39  bool Init(const SceneManagerInitOptions& options = SceneManagerInitOptions());
40  // @brief: get service given name
41  // @param [in]: service name
42  // @return: service pointer
43  SceneServicePtr Service(const std::string& name);
44  // @brief: get name of this class
45  // @return: name
46  std::string Name() const { return "SceneManager"; }
47  // @brief: reset scene manager
48  // @param [in]: initialization options
49  // @return: status
50  bool Reset(
52 
53  int GetServiceNum() const { return static_cast<int>(services_.size()); }
54 
55  protected:
56  SceneManager() = default;
57  // @brief: initialize scene manager
58  // @param [in]: initialization options
59  // @return: status
60  bool InitInternal(
62 
63  protected:
64  std::map<std::string, SceneServicePtr> services_;
65  bool initialized_ = false;
66  std::mutex mutex_;
67 };
68 
69 } // namespace lidar
70 } // namespace perception
71 } // namespace apollo
std::mutex mutex_
Definition: scene_manager.h:66
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::string Name() const
Definition: scene_manager.h:46
bool Init(const char *binary_name)
Definition: scene_manager.h:29
int GetServiceNum() const
Definition: scene_manager.h:53
std::shared_ptr< SceneService > SceneServicePtr
Definition: scene_service.h:97
std::map< std::string, SceneServicePtr > services_
Definition: scene_manager.h:64
static SceneManager & Instance()
Definition: scene_manager.h:31