Apollo 11.0
自动驾驶开放平台
registerer.cc
浏览该文件的文档.
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
18
19namespace apollo {
20namespace perception {
21namespace lib {
22
24 static BaseClassMap factory_map;
25 return factory_map;
26}
27
29 const std::string &base_class_name,
30 std::vector<std::string> *registered_derived_classes_names) {
31 if (registered_derived_classes_names == nullptr) {
32 AERROR << "registered_derived_classes_names is not available";
33 return false;
34 }
36 auto iter = map.find(base_class_name);
37 if (iter == map.end()) {
38 AERROR << "class not registered:" << base_class_name;
39 return false;
40 }
41 for (auto pair : iter->second) {
42 registered_derived_classes_names->push_back(pair.first);
43 }
44 return true;
45}
46
47} // namespace lib
48} // namespace perception
49} // namespace apollo
#define AERROR
Definition log.h:44
bool GetRegisteredClasses(const std::string &base_class_name, std::vector< std::string > *registered_derived_classes_names)
Definition registerer.cc:28
std::map< std::string, FactoryMap > BaseClassMap
Definition registerer.h:81
BaseClassMap & GlobalFactoryMap()
Definition registerer.cc:23
class register implement
Definition arena_queue.h:37