Read and write LCM log files.
More...
Read and write LCM log files.
Linking: pkg-config --libs lcm
◆ lcm_eventlog_create()
lcm_eventlog_t* lcm_eventlog_create |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
Open a log file for reading or writing.
- Parameters
-
path | Log file to open |
mode | "r" (read mode), "w" (write mode), or "a" (append mode) |
- Returns
- a newly allocated lcm_eventlog_t, or NULL on failure.
◆ lcm_eventlog_destroy()
void lcm_eventlog_destroy |
( |
lcm_eventlog_t * |
eventlog | ) |
|
Close a log file and release allocated resources.
- Parameters
-
eventlog | The log file object |
◆ lcm_eventlog_free_event()
void lcm_eventlog_free_event |
( |
lcm_eventlog_event_t * |
event | ) |
|
◆ lcm_eventlog_read_next_event()
lcm_eventlog_event_t* lcm_eventlog_read_next_event |
( |
lcm_eventlog_t * |
eventlog | ) |
|
Read the next event in the log file. Valid in read mode only. Free the returned structure with lcm_eventlog_free_event() after use.
- Parameters
-
eventlog | The log file object |
- Returns
- the next event in the log file. Returns NULL when the end of the file has been reached or when invalid data is read.
◆ lcm_eventlog_seek_to_timestamp()
int lcm_eventlog_seek_to_timestamp |
( |
lcm_eventlog_t * |
eventlog, |
|
|
int64_t |
ts |
|
) |
| |
Seek (approximately) to a particular timestamp.
- Parameters
-
eventlog | The log file object |
ts | Timestamp of the target event in the log file. |
- Returns
- 0 on success, -1 on failure
◆ lcm_eventlog_write_event()
int lcm_eventlog_write_event |
( |
lcm_eventlog_t * |
eventlog, |
|
|
lcm_eventlog_event_t * |
event |
|
) |
| |
Write an event into a log file. Valid in write mode only.
- Parameters
-
eventlog | The log file object |
event | The event to write to the file. On return, the eventnum field will be filled in for you. |
- Returns
- 0 on success, -1 on failure.