evaluator_factory.cc 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/******************************************************************************
 * Copyright 2017 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#include "modules/prediction/evaluator/evaluator_factory.h"

#include "modules/common/log.h"
20
#include "modules/prediction/evaluator/vehicle/mlp_evaluator.h"
21 22 23 24

namespace apollo {
namespace prediction {

25 26 27
EvaluatorFactory::EvaluatorFactory() {
  RegisterEvaluator();
}
28 29

void EvaluatorFactory::RegisterEvaluator() {
30
  Register(ObstacleConf::MLP_EVALUATOR,
31
        []() -> Evaluator* { return new MLPEvaluator(); });
32 33 34
}

std::unique_ptr<Evaluator> EvaluatorFactory::CreateEvaluator(
35 36
    const ObstacleConf::EvaluatorType& type) {
  auto evaluator = CreateObject(type);
37
  if (!evaluator) {
38
    AERROR << "Failed to create an evaluator with " << type;
39
  } else {
40
    ADEBUG << "Succeeded in creating an evaluator with " << type;
41 42 43 44
  }
  return evaluator;
}

C
Calvin Miao 已提交
45 46
}  // namespace prediction
}  // namespace apollo