GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
DesignLab
map_file_exporter.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
8
#include "
map_file_exporter.h
"
9
10
#include <fstream>
11
12
#include "
cmdio_util.h
"
13
14
namespace
designlab
{
15
16
bool
MapFileExporter::ExportMap
(
const
std::string& file_path,
17
const
MapState
& map_state)
const
noexcept
{
18
// ファイルを開く.
19
std::ofstream ofs(file_path);
20
21
// ファイルが開けないならば false を返す.
22
if
(!ofs.is_open()) {
23
cmdio::ErrorOutput
(
"ファイルを開けませんでした."
);
24
25
return
false
;
26
}
27
28
// ファイルを1行ずつ書き込む.
29
const
size_t
map_point_size = map_state.GetMapPointSize();
30
31
for
(
size_t
i = 0; i < map_point_size; ++i) {
32
ofs << map_state.GetMapPoint(i) << std::endl;
33
}
34
35
// ファイルを閉じる.
36
ofs.close();
37
38
return
true
;
39
}
40
41
}
// namespace designlab
designlab::MapFileExporter::ExportMap
bool ExportMap(const std::string &file_path, const MapState &map_state) const noexcept
マップを csv に出力する.
Definition
map_file_exporter.cpp:16
designlab::MapState
マップを表すクラス.
Definition
map_state.h:29
cmdio_util.h
map_file_exporter.h
designlab::cmdio::ErrorOutput
void ErrorOutput(const std::string &str)
コマンドラインに文字を出力する関数. Error 用の出力.
Definition
cmdio_util.h:69
designlab
Definition
abstract_dxlib_gui.cpp:18
構築:
1.9.8