Last active
June 19, 2019 05:17
-
-
Save ivelin/6fe67e2251bca5960f7caa54b379d8f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// read packets from the file up to record_to_read or end of file | |
while ((*record_read) < record_to_read) { | |
int64 record_count = 0; | |
double packet_timestamp; | |
string packet_data_buffer; | |
Status status = state.get()->ReadRecord(packet_timestamp, &packet_data_buffer, record_count); | |
if (!(status.ok() || errors::IsOutOfRange(status))) { | |
return status; | |
} | |
if (record_count > 0) { | |
Tensor timestamp_tensor = (*out_tensors)[0]; | |
timestamp_tensor.flat<double>()(*record_read) = packet_timestamp; | |
Tensor data_tensor = (*out_tensors)[1]; | |
data_tensor.flat<string>()(*record_read) = std::move(packet_data_buffer); | |
(*record_read) += record_count; | |
} else { | |
// no more records available to read | |
// record_count == 0 | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment