Apollo 10.0
自动驾驶开放平台
object_maintainer.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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 *****************************************************************************/
17
18namespace apollo {
19namespace perception {
20namespace camera {
21
23 auto obj_it = assigned_index_.find(idx);
24 if (obj_it == assigned_index_.end()) {
25 assigned_index_[idx] = obj;
26 return true;
27 }
28
29 auto pre_obj = obj_it->second;
30 int cur_type = static_cast<int>(obj->sub_type);
31 int pre_type = static_cast<int>(pre_obj->sub_type);
32
33 if (obj->sub_type_probs[cur_type] > pre_obj->sub_type_probs[pre_type]) {
34 *pre_obj = *obj;
35 }
36 return false;
37}
38
39} // namespace camera
40} // namespace perception
41} // namespace apollo
std::map< int, base::ObjectPtr > assigned_index_
bool Add(int idx, base::ObjectPtr obj)
Maintain a collection of objects that can be added based on the index.
std::shared_ptr< Object > ObjectPtr
Definition object.h:127
class register implement
Definition arena_queue.h:37