GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
simulation_result_record.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 <sstream>
11
12#include "string_util.h"
13#include "hexapod_const.h"
14#include "leg_state.h"
15
16
17namespace designlab
18{
19
21{
22 // シミュレーションの最終的な結果の出力.
23 std::stringstream ss;
24 ss << "Simulation Result," <<
26 ss << std::endl;
27
28 ss << GraphSearchResultRecord::GetCsvHeader() << std::endl;
29
30 const size_t kLength = graph_search_result_recorder.size();
31
32 for (size_t i = 0; i < kLength; i++)
33 {
34 ss << i << ",";
35
36 // グラフ探索の結果の出力.
37 ss << graph_search_result_recorder[i].ToCsvString() << ",";
38
39 ss << std::endl;
40 }
41
42
43 ss << std::endl;
44
45 return ss.str();
46}
47
48} // namespace designlab
std::string EnumToStringRemoveTopK(const T &enum_value)
enumを文字列に変換する関数. Google C++ coding style だと enumの要素は 先頭にkをつけてキャメルケースで書くことが推奨されている. 例えば,
Definition string_util.h:54
static std::string GetCsvHeader()
CSV形式のヘッダを返す.
enums::SimulationResult simulation_result
シミュレーション全体の結果.
std::vector< GraphSearchResultRecord > graph_search_result_recorder
std::string ToCsvString() const
このクラスのデータを, csvファイルに出力する用の形式で文字列に変換する.