18namespace fs = ::std::filesystem;
23 const std::string& file_path, std::vector<RobotStateNode>* node_list,
26 assert(node_list !=
nullptr);
27 assert(node_list->empty());
28 assert(map_state !=
nullptr);
32 if (!fs::exists(file_path)) {
38 std::string map_file_path = file_path;
44 if (!fs::exists(map_file_path)) {
49 if (!ImportNodeList(file_path, node_list) ||
50 !ImportMapState(map_file_path, map_state)) {
57bool ResultFileImporter::ImportNodeList(
58 const std::string& file_path,
59 std::vector<RobotStateNode>* node_list)
const {
61 std::ifstream ifs(file_path);
72 std::vector<std::string> str_list;
74 while (std::getline(ifs, str)) {
75 str_list.push_back(str);
83 for (
const auto& i : str_list) {
85 std::stringstream ss(i);
89 (*node_list).push_back(node);
95bool ResultFileImporter::ImportMapState(
const std::string& file_path,
96 MapState* map_state)
const {
97 assert(map_state !=
nullptr);
100 std::ifstream ifs(file_path);
103 if (!ifs.is_open()) {
111 std::vector<std::string> str_list;
113 while (std::getline(ifs, str)) {
114 str_list.push_back(str);
121 (*map_state).ClearMapPoint();
123 for (
const auto& i : str_list) {
125 std::stringstream ss(i);
130 (*map_state).AddMapPoint(point);
133 "読み込むことのできない行があったため無視します.「{}」",
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
ノードリストとマップの状態をファイルから読み込む.
void OutputF(OutputDetail detail, const std::format_string< Args... > str, Args &&... args)
コマンドラインに文字を出力する関数, format した文字列を出力する. SetOutputLimit() で設定した出力の許可範囲内であれば出力される.
void ErrorOutput(const std::string &str)
コマンドラインに文字を出力する関数. Error 用の出力.
void SystemOutput(const std::string &str)
コマンドラインに文字を出力する関数. System 用の出力.
@ kWarning
警告メッセージ,エラーではないが注意が必要なメッセージ.
static RobotStateNode FromString(const std::string &str)
文字列をノードの情報に変換する関数.