Spacecraft history. More...
Public Member Functions | |
void | store_matrix (double ts, const ml_matrix &data) |
Store a time-tagged matrix. | |
double | start_time () |
Retrieve the first timestamp stored. | |
double | end_time () |
Retrieve the last stored timestamp. | |
bool | data_for_time (double &ts, ml_matrix &data) |
Retrieve the data for a specific timestamp. | |
bool | data_after_time (double &ts, ml_matrix &data) |
Retrieve the first data point after a specific timestamp. | |
void | clear_data_until (double ts) |
Remove old historical data. |
Historical data storage and retrieval.
This class allows for arbitrary historical matrix storage and retrieval. It is optimized for sequential access patterns with random start and stop points. Data must be added in-order, and old data must be dropped in order.
void sc_history::store_matrix | ( | double | ts, |
const ml_matrix & | data | ||
) |
Store a matrix with a timestamp.
The timestamp must be larger than the most recent stored timestamp.
ts | The timestamp of the matrix to be stored |
data | The matrix to be stored |
References sc_history_segment::data, sc_history_segment::data_count, sc_history_segment::first_time, sc_history_segment::last_time, sc_history_segment::next, and sc_history_segment::timestamps.
double sc_history::start_time | ( | ) |
Retrieve the first timestamp contained in the history.
References sc_history_segment::first_time.
double sc_history::end_time | ( | ) |
Retrieve the last timestamp contained in the history.
References sc_history_segment::last_time.
bool sc_history::data_for_time | ( | double & | ts, |
ml_matrix & | data | ||
) |
Retrieve the data associated with a specific timestamp.
If that timestamp is not available, the first data with a larger timestamp will be returned. If no data with a larger timestamp exists, the most recent data stored in the history will be returned.
ts | When called, the timestamp to lookup. Upon return, this will hold the actual timestamp of the data found. |
data | Upon return, this will hold the found data. |
References sc_history_segment::data, sc_history_segment::data_count, sc_history_segment::first_time, sc_history_segment::last_time, and sc_history_segment::timestamps.
bool sc_history::data_after_time | ( | double & | ts, |
ml_matrix & | data | ||
) |
Retrieve the first data with a timestamp greater than the provided timestamp.
ts | When the function is called, this parameter will hold the timestamp after which the returned data should be found. Upon return, this will hold the actual timestamp of the data found. |
data | Upon return, this will hold the found data. |
References sc_history_segment::data, sc_history_segment::data_count, sc_history_segment::first_time, sc_history_segment::last_time, and sc_history_segment::timestamps.
void sc_history::clear_data_until | ( | double | ts ) |
Remove all data from the history with a timestamp <= ts.
ts | The timestamp through which all data should be removed. |
References sc_history_segment::data, sc_history_segment::data_count, sc_history_segment::first_time, sc_history_segment::last_time, sc_history_segment::next, and sc_history_segment::timestamps.