GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
map_creator_by_csv.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 <filesystem>
11#include <format>
12#include <fstream>
13
14#include "cassert_define.h"
15#include "cmdio_util.h"
16#include "map_file_importer.h"
17#include "string_util.h"
18
19namespace designlab {
20
21MapCreatorByCsv::MapCreatorByCsv(const std::string& map_file_path)
22 : map_file_path_(map_file_path) {
23 // ファイルが存在するか確認し,なければアサート.
24 if (const bool is_exist = std::filesystem::exists(map_file_path_);
25 !is_exist) {
26 std::string error_mes = std::format(
27 "map fileが存在しません.ファイルのパスは{}です.({}のコンストラクタ)",
28 map_file_path_, string_util::GetTypeName(*this));
29
31
32 assert(false);
33 }
34}
35
37 const MapFileImporter map_file_importer{};
38
39 if (const auto result = map_file_importer.ImportMap(map_file_path_);
40 result.has_value()) {
41 cmdio::InfoOutput("Completed reading map file: " + map_file_path_);
42 return result.value();
43 } else {
44 // エラーが発生した場合は空のマップを返す.
45 cmdio::ErrorOutput(result.error());
46 return MapState();
47 }
48}
49
51 // 何もしない.
52}
53
54} // namespace designlab
void UpdateMap(MapState *current_map) const override
マップの更新を行う.
MapState InitMap() const override
マップの初期化を行う.
MapCreatorByCsv(const std::string &map_file_path)
コンストラクタで作成するマップ情報を与える
マップを csv に出力したものを読み込むクラス.
マップを表すクラス.
Definition map_state.h:29
void ErrorOutput(const std::string &str)
コマンドラインに文字を出力する関数. Error 用の出力.
Definition cmdio_util.h:69
void InfoOutput(const std::string &str)
コマンドラインに文字を出力する関数. Info 用の出力.
Definition cmdio_util.h:57
void Output(const std::string &str, OutputDetail detail)
コマンドラインに文字を出力する関数. SetOutputLimit 関数で設定した出力の許可範囲内であれば出力される.
std::string GetTypeName(const T &type)
@ kError
エラーメッセージ.