LCM
Classes | Functions
lcm_eventlog_t

Read and write LCM log files. More...

Classes

struct  lcm_eventlog_t
 
struct  lcm_eventlog_event_t
 

Functions

lcm_eventlog_t * lcm_eventlog_create (const char *path, const char *mode)
 
lcm_eventlog_event_t * lcm_eventlog_read_next_event (lcm_eventlog_t *eventlog)
 
void lcm_eventlog_free_event (lcm_eventlog_event_t *event)
 
int lcm_eventlog_seek_to_timestamp (lcm_eventlog_t *eventlog, int64_t ts)
 
int lcm_eventlog_write_event (lcm_eventlog_t *eventlog, lcm_eventlog_event_t *event)
 
void lcm_eventlog_destroy (lcm_eventlog_t *eventlog)
 

Detailed Description

Read and write LCM log files.

#include <lcm/lcm.h>

Linking: pkg-config --libs lcm

Function Documentation

lcm_eventlog_t* lcm_eventlog_create ( const char *  path,
const char *  mode 
)

Open a log file for reading or writing.

Parameters
pathLog 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.
void lcm_eventlog_destroy ( lcm_eventlog_t *  eventlog)

Close a log file and release allocated resources.

Parameters
eventlogThe log file object
void lcm_eventlog_free_event ( lcm_eventlog_event_t *  event)

Free a structure returned by lcm_eventlog_read_next_event().

Parameters
eventA structure returned by 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
eventlogThe 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.
int lcm_eventlog_seek_to_timestamp ( lcm_eventlog_t *  eventlog,
int64_t  ts 
)

Seek (approximately) to a particular timestamp.

Parameters
eventlogThe log file object
tsTimestamp of the target event in the log file.
Returns
0 on success, -1 on failure
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
eventlogThe log file object
eventThe event to write to the file. On return, the eventnum field will be filled in for you.
Returns
0 on success, -1 on failure.