19#include "absl/strings/str_cat.h"
27LearningData FeatureOutput::learning_data_;
28int FeatureOutput::learning_data_file_index_ = 0;
33 learning_data_.Clear();
34 learning_data_file_index_ = 0;
43 const std::string& record_file,
45 learning_data_.add_learning_data_frame()->CopyFrom(learning_data_frame);
48 if (learning_data_.learning_data_frame_size() >=
49 FLAGS_learning_data_frame_num_per_file) {
55 const int size = learning_data_.learning_data_frame_size();
56 return size > 0 ? learning_data_.mutable_learning_data_frame(size - 1)
63 std::string src_file_name =
64 record_file.substr(record_file.find_last_of(
"/") + 1);
65 src_file_name = src_file_name.empty() ?
"00000" : src_file_name;
66 const std::string dest_file =
67 absl::StrCat(FLAGS_planning_data_dir,
"/", src_file_name,
".",
68 learning_data_file_index_,
".bin");
71 learning_data_.Clear();
72 learning_data_file_index_++;
76 const std::string& record_file) {
77 if (learning_data_.learning_data_frame_size() > 0) {
static LearningDataFrame * GetLatestLearningDataFrame()
static void InsertLearningDataFrame(const std::string &record_filename, const LearningDataFrame &learning_data_frame)
Insert a a frame of learning data
static void WriteRemainderiLearningData(const std::string &record_file)
static bool Ready()
Check if output is ready
static void Close()
Close the output stream
static void InsertPlanningResult()
static void WriteLearningData(const std::string &record_file)
Write LearningData to a file
Planning module main class.
bool SetProtoToBinaryFile(const google::protobuf::Message &message, const std::string &file_name)
Sets the content of the file specified by the file_name to be the binary representation of the input ...