Apollo 11.0
自动驾驶开放平台
container_manager.h
浏览该文件的文档.
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
22#pragma once
23
24#include <memory>
25#include <unordered_map>
26
27#include "cyber/common/macros.h"
28#include "gtest/gtest.h"
29
30#include "modules/common/adapters/proto/adapter_config.pb.h"
32
37namespace apollo {
38namespace prediction {
39
41 public:
45 ContainerManager() = default;
46
52
58 template <typename T>
60 auto key_type = static_cast<int>(type);
61 if (containers_.find(key_type) != containers_.end()) {
62 return static_cast<T *>(containers_[key_type].get());
63 }
64 return nullptr;
65 }
66
72 std::unique_ptr<Container> CreateContainer(
74
75 FRIEND_TEST(FeatureExtractorTest, junction);
76 FRIEND_TEST(ScenarioManagerTest, run);
77
78 private:
83 void RegisterContainer(
85
89 void RegisterContainers();
90
91 private:
92 std::unordered_map<int, std::unique_ptr<Container>> containers_;
93
95};
96
97} // namespace prediction
98} // namespace apollo
std::unique_ptr< Container > CreateContainer(const common::adapter::AdapterConfig::MessageType &type)
Create a container
ContainerManager()=default
Constructor
FRIEND_TEST(FeatureExtractorTest, junction)
T * GetContainer(const common::adapter::AdapterConfig::MessageType &type)
Get mutable container
void Init(const common::adapter::AdapterManagerConfig &config)
Container manager initialization
FRIEND_TEST(ScenarioManagerTest, run)
Define the data container base class
class register implement
Definition arena_queue.h:37