Struct CustomWriter¶
Defined in File mcap.hpp
Struct Documentation¶
-
struct CustomWriter¶
Custom writer for writing MCAP data to arbitrary destinations.
This provides a simple function pointer interface that matches the C API. Users are responsible for managing the lifetime of user_data and ensuring thread safety if needed.
Public Members
-
std::function<size_t(const uint8_t *data, size_t len, int *error)> write¶
Write function: write data to the custom destination.
- Param data:
Pointer to data to write
- Param len:
Number of bytes to write
- Param error:
Pointer to error code (set to an error number defined in errno.h if write fails)
- Return:
Number of bytes actually written
-
std::function<int()> flush¶
Flush function: ensure all buffered data is written.
- Return:
0 on success, an error number defined in errno.h if flush fails
-
std::function<int(int64_t pos, int whence, uint64_t *new_pos)> seek¶
Seek function: change the current position in the stream.
- Param pos:
Position offset
- Param whence:
Seek origin (0=SEEK_SET, 1=SEEK_CUR, 2=SEEK_END)
- Param new_pos:
Pointer to store the new absolute position
- Return:
0 on success, an error number defined in errno.h if seek fails
-
std::function<size_t(const uint8_t *data, size_t len, int *error)> write¶