Apollo 11.0
自动驾驶开放平台
container_manager.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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
23
24namespace apollo {
25namespace prediction {
26
29
31 config_.CopyFrom(config);
32 RegisterContainers();
33}
34
35void ContainerManager::RegisterContainers() {
36 for (const auto& adapter_config : config_.config()) {
37 if (adapter_config.has_type() &&
38 (adapter_config.mode() == AdapterConfig::RECEIVE_ONLY ||
39 adapter_config.mode() == AdapterConfig::DUPLEX)) {
40 RegisterContainer(adapter_config.type());
41 }
42 }
43}
44
45std::unique_ptr<Container> ContainerManager::CreateContainer(
46 const AdapterConfig::MessageType& type) {
47 std::unique_ptr<Container> container_ptr(nullptr);
49 container_ptr.reset(new ObstaclesContainer());
50 } else if (type == AdapterConfig::LOCALIZATION) {
51 container_ptr.reset(new PoseContainer());
52 } else if (type == AdapterConfig::PLANNING_TRAJECTORY) {
53 container_ptr.reset(new ADCTrajectoryContainer());
54 } else if (type == AdapterConfig::STORYTELLING) {
55 container_ptr.reset(new StoryTellingContainer());
56 }
57 return container_ptr;
58}
59
60void ContainerManager::RegisterContainer(
61 const AdapterConfig::MessageType& type) {
62 containers_[static_cast<int>(type)] = CreateContainer(type);
63 AINFO << "Container [" << type << "] is registered.";
64}
65
66} // namespace prediction
67} // namespace apollo
ADC trajectory container
std::unique_ptr< Container > CreateContainer(const common::adapter::AdapterConfig::MessageType &type)
Create a container
void Init(const common::adapter::AdapterManagerConfig &config)
Container manager initialization
Use container manager to manage all containers
#define AINFO
Definition log.h:42
class register implement
Definition arena_queue.h:37
Obstacles container
Obstacles container
story telling container