Apollo 11.0
自动驾驶开放平台
apollo::perception::lidar::SceneManager类 参考

#include <scene_manager.h>

apollo::perception::lidar::SceneManager 的协作图:

Public 成员函数

 ~SceneManager ()=default
 
bool Init ()
 
SceneServicePtr Service (const std::string &name)
 
std::string Name () const
 
bool Reset (const SceneManagerInitOptions &options=SceneManagerInitOptions())
 
int GetServiceNum () const
 

静态 Public 成员函数

static SceneManagerInstance ()
 

Protected 成员函数

 SceneManager ()=default
 
bool InitInternal (const SceneManagerInitOptions &options=SceneManagerInitOptions())
 

Protected 属性

std::map< std::string, SceneServicePtrservices_
 
bool initialized_ = false
 
std::mutex mutex_
 

详细描述

在文件 scene_manager.h34 行定义.

构造及析构函数说明

◆ ~SceneManager()

apollo::perception::lidar::SceneManager::~SceneManager ( )
default

◆ SceneManager()

apollo::perception::lidar::SceneManager::SceneManager ( )
protecteddefault

成员函数说明

◆ GetServiceNum()

int apollo::perception::lidar::SceneManager::GetServiceNum ( ) const
inline

在文件 scene_manager.h58 行定义.

58{ return static_cast<int>(services_.size()); }
std::map< std::string, SceneServicePtr > services_

◆ Init()

bool apollo::perception::lidar::SceneManager::Init ( )

在文件 scene_manager.cc60 行定义.

60 {
61 std::lock_guard<std::mutex> lock(mutex_);
62 bool status = InitInternal();
63 return status;
64}
bool InitInternal(const SceneManagerInitOptions &options=SceneManagerInitOptions())

◆ InitInternal()

bool apollo::perception::lidar::SceneManager::InitInternal ( const SceneManagerInitOptions options = SceneManagerInitOptions())
protected

在文件 scene_manager.cc29 行定义.

29 {
30 if (initialized_) {
31 return true;
32 }
33
34 std::string config_file = FLAGS_scene_manager_file;
35 if (!options.config_file.empty()) {
36 config_file = options.config_file;
37 }
38 config_file = GetCommonConfigFile(config_file);
39 SceneManagerConfig config;
40 ACHECK(cyber::common::GetProtoFromFile(config_file, &config));
41 services_.clear();
42 for (int i = 0; i < config.service_name_size(); ++i) {
43 const auto& name = config.service_name(i);
44 SceneServicePtr service(SceneServiceRegisterer::GetInstanceByName(name));
45 if (service == nullptr) {
46 AINFO << "Failed to find scene service: " << name << ", skipped";
47 continue;
48 }
49 if (!service->Init()) {
50 AINFO << "Failed to init scene service: " << name << ", skipped";
51 continue;
52 }
53 services_.emplace(name, service);
54 AINFO << "Scene manager add service: " << name;
55 }
56 initialized_ = true;
57 return true;
58}
#define ACHECK(cond)
Definition log.h:80
#define AINFO
Definition log.h:42
bool GetProtoFromFile(const std::string &file_name, google::protobuf::Message *message)
Parses the content of the file specified by the file_name as a representation of protobufs,...
Definition file.cc:132
std::shared_ptr< SceneService > SceneServicePtr
std::string GetCommonConfigFile(const std::string &config_file)
Get the perception common config path
Definition util.cc:28

◆ Instance()

static SceneManager & apollo::perception::lidar::SceneManager::Instance ( )
inlinestatic

在文件 scene_manager.h36 行定义.

36 {
37 static SceneManager manager;
38 return manager;
39 }

◆ Name()

std::string apollo::perception::lidar::SceneManager::Name ( ) const
inline

在文件 scene_manager.h51 行定义.

51{ return "SceneManager"; }

◆ Reset()

bool apollo::perception::lidar::SceneManager::Reset ( const SceneManagerInitOptions options = SceneManagerInitOptions())

在文件 scene_manager.cc66 行定义.

66 {
67 std::lock_guard<std::mutex> lock(mutex_);
68 initialized_ = false;
69 bool status = InitInternal(options);
70 return status;
71}

◆ Service()

SceneServicePtr apollo::perception::lidar::SceneManager::Service ( const std::string &  name)

在文件 scene_manager.cc73 行定义.

73 {
74 auto iter = services_.find(name);
75 if (iter == services_.end()) {
76 return nullptr;
77 }
78 return iter->second;
79}

类成员变量说明

◆ initialized_

bool apollo::perception::lidar::SceneManager::initialized_ = false
protected

在文件 scene_manager.h70 行定义.

◆ mutex_

std::mutex apollo::perception::lidar::SceneManager::mutex_
protected

在文件 scene_manager.h71 行定义.

◆ services_

std::map<std::string, SceneServicePtr> apollo::perception::lidar::SceneManager::services_
protected

在文件 scene_manager.h69 行定义.


该类的文档由以下文件生成: