GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
map_creator_factory.cpp
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
9
10#include <memory>
11#include <string>
12#include <utility>
13
14#include "cassert_define.h"
15#include "map_creator_by_csv.h"
18#include "toml_file_importer.h"
20
21
22namespace designlab
23{
24
25std::unique_ptr<IMapCreator> MapCreatorFactory::Create(const SimulationSettingRecord& record)
26{
27 std::unique_ptr<IMapCreator> map_creator;
28
30 {
31 map_creator = std::make_unique<MapCreatorByCsv>(
33 }
35 {
36 auto validator_ptr = std::make_unique<SimulationMapParameterValidator>();
37
38 const TomlFileImporter<SimulationMapParameter> simulation_map_parameter_importer(
39 std::move(validator_ptr));
40
41 const std::string simulation_map_param_file_path =
43
44 const auto simulation_map_parameter =
45 simulation_map_parameter_importer.ImportOrUseDefault(simulation_map_param_file_path);
46
47 map_creator = std::make_unique<MapCreatorForSimulation>(simulation_map_parameter);
48 }
49 else
50 {
51 assert(false && "MapCreateMode is not supported.");
52 }
53
54 return std::move(map_creator);
55}
56
57
58} // namespace designlab
static std::unique_ptr< IMapCreator > Create(const SimulationSettingRecord &record)
マップを生成するクラスを生成する.
static const char kTomlFileDirPath[]
TOMLファイルを入れるディレクトリのパス.
tomlファイルを読み込んで構造体に変換するテンプレートクラス.
T ImportOrUseDefault(const std::string &file_path) const
指定したファイルパスのファイルを読み込み,構造体に変換する. 読込に失敗した場合は,デフォルトの構造体を返す. また,読込に失敗した場合には, デフォルトの構造体をファイルに出力するかどうかをユーザに問...