17 #ifndef PYTHON_WRAPPER_PY_RECORD_H_ 18 #define PYTHON_WRAPPER_PY_RECORD_H_ 33 #include "cyber/proto/record.pb.h" 57 uint64_t begin_time = 0,
58 uint64_t end_time = std::numeric_limits<uint64_t>::max()) {
61 if (!record_reader_->ReadMessage(&record_message, begin_time, end_time)) {
71 record_reader_->GetMessageType(record_message.
channel_name);
76 return record_reader_->GetMessageNumber(channel_name);
80 return record_reader_->GetMessageType(channel_name);
84 return record_reader_->GetProtoDesc(channel_name);
89 record_reader_->GetHeader().SerializeToString(&org_data);
93 void Reset() { record_reader_->Reset(); }
96 return record_reader_->GetChannelList();
100 std::unique_ptr<RecordReader> record_reader_;
105 bool Open(
const std::string& path) {
return record_writer_.Open(path); }
107 void Close() { record_writer_.Close(); }
109 bool WriteChannel(
const std::string& channel_str,
const std::string& type,
110 const std::string& proto_desc) {
111 return record_writer_.WriteChannel(channel_str, type, proto_desc);
115 const std::string& rawmessage, uint64_t time,
116 const std::string& proto_desc =
"") {
117 return record_writer_.WriteMessage(
118 channel_name, std::make_shared<message::RawMessage>(rawmessage), time,
123 return record_writer_.SetSizeOfFileSegmentation(size_kilobytes);
127 return record_writer_.SetIntervalOfFileSegmentation(time_sec);
131 return record_writer_.GetMessageNumber(channel_name);
135 return record_writer_.GetMessageType(channel_name);
139 return record_writer_.GetProtoDesc(channel_name);
150 #endif // PYTHON_WRAPPER_PY_RECORD_H_
Definition: py_record.h:103
uint64_t time
The time (nanosecond) of the message.
Definition: record_message.h:64
Basic data struct of record message.
Definition: record_message.h:34
const std::string & GetProtoDesc(const std::string &channel_name) const
Definition: py_record.h:138
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::string content
The content of the message.
Definition: record_message.h:59
The record writer.
Definition: record_writer.h:44
bool Open(const std::string &path)
Definition: py_record.h:105
uint64_t timestamp
Definition: py_record.h:43
std::string channel_name
Definition: py_record.h:44
bool WriteChannel(const std::string &channel_str, const std::string &type, const std::string &proto_desc)
Definition: py_record.h:109
bool SetIntervalOfFileSegmentation(uint64_t time_sec)
Definition: py_record.h:126
Definition: py_record.h:42
PyRecordReader(const std::string &file)
Definition: py_record.h:52
The record reader.
Definition: record_reader.h:39
std::string channel_name
The channel name of the message.
Definition: record_message.h:54
std::string data_type
Definition: py_record.h:46
uint64_t GetMessageNumber(const std::string &channel_name)
Definition: py_record.h:75
uint64_t GetMessageNumber(const std::string &channel_name) const
Definition: py_record.h:130
void Reset()
Definition: py_record.h:93
bool end
Definition: py_record.h:47
bool WriteMessage(const std::string &channel_name, const std::string &rawmessage, uint64_t time, const std::string &proto_desc="")
Definition: py_record.h:114
const std::string & GetMessageType(const std::string &channel_name) const
Definition: py_record.h:134
bool SetSizeOfFileSegmentation(uint64_t size_kilobytes)
Definition: py_record.h:122
std::string GetMessageType(const std::string &channel_name)
Definition: py_record.h:79
void Close()
Definition: py_record.h:107
std::string GetProtoDesc(const std::string &channel_name)
Definition: py_record.h:83
std::set< std::string > GetChannelList() const
Definition: py_record.h:95
std::string data
Definition: py_record.h:45
BagMessage ReadMessage(uint64_t begin_time=0, uint64_t end_time=std::numeric_limits< uint64_t >::max())
Definition: py_record.h:56
Definition: py_record.h:50
std::string GetHeaderString()
Definition: py_record.h:87