20namespace fs = ::std::filesystem;
26 const std::string& file_path, std::vector<RobotStateNode>* node_list,
30 assert(node_list !=
nullptr);
31 assert(node_list->empty());
32 assert(map_state !=
nullptr);
37 if (!fs::exists(file_path))
44 std::string map_file_path = file_path;
46 map_file_path.replace(
51 if (!fs::exists(map_file_path))
58 if (!ImportNodeList(file_path, node_list) ||
59 !ImportMapState(map_file_path, map_state))
67bool ResultFileImporter::ImportNodeList(
68 const std::string& file_path,
69 std::vector<RobotStateNode>* node_list)
const
72 std::ifstream ifs(file_path);
85 std::vector<std::string> str_list;
87 while (std::getline(ifs, str))
89 str_list.push_back(str);
97 for (
const auto& i : str_list)
100 std::stringstream ss(i);
104 (*node_list).push_back(node);
110bool ResultFileImporter::ImportMapState(
111 const std::string& file_path, MapState* map_state)
const
113 assert(map_state !=
nullptr);
116 std::ifstream ifs(file_path);
129 std::vector<std::string> str_list;
131 while (std::getline(ifs, str))
133 str_list.push_back(str);
140 (*map_state).ClearMapPoint();
142 for (
const auto& i : str_list)
145 std::stringstream ss(i);
151 (*map_state).AddMapPoint(point);
157 "読み込むことのできない行があったため無視します.「{}」",
static void SystemOutput(const std::string &str)
コマンドラインに文字を出力する関数.System用の出力.
static void ErrorOutput(const std::string &str)
コマンドラインに文字を出力する関数.Error用の出力.
static void FormatOutput(OutputDetail detail, const std::format_string< Args... > str, Args &&... args)
コマンドラインに文字を出力する関数. SetOutputLimit() で設定した出力の許可範囲内であれば出力される. 必ず SetOutputLimit() を呼び出してから使うこと.
size_t GetMapPointSize() const noexcept
脚設置可能点の総数を返す.
static const std::string kNodeListName
ノードリストのファイル名 (プログラムの読み込み用)
static const std::string kMapStateName
マップ状態のファイル名 (プログラムの読み込み用)
bool ImportNodeListAndMapState(const std::string &file_path, std::vector< RobotStateNode > *node_list, MapState *map_state) const
ノードリストとマップの状態をファイルから読み込む.
@ kWarning
警告メッセージ,エラーではないが注意が必要なメッセージ.
static RobotStateNode FromString(const std::string &str)
文字列をノードの情報に変換する関数.