22 #ifndef LELY_CAN_BUF_HPP_
23 #define LELY_CAN_BUF_HPP_
26 #error "include <lely/can/buf.h> for the C interface"
70 size()
const noexcept {
75 capacity()
const noexcept {
80 reserve(::std::size_t n) noexcept {
85 peek(
can_msg* ptr, ::std::size_t n) noexcept {
91 return !!peek(&msg, 1);
95 read(
can_msg* ptr, ::std::size_t n) noexcept {
101 return !!read(&msg, 1);
105 write(
const can_msg* ptr, ::std::size_t n) noexcept {
110 write(
const can_msg& msg) noexcept {
111 return !!write(&msg, 1);
116 ::std::size_t m_size;
117 ::std::size_t m_begin;
This header file is part of the CAN library; it contains the CAN frame buffer declarations.
LELY_CAN_BUF_INLINE void can_buf_init(struct can_buf *buf, struct can_msg *ptr, size_t size)
Initializes a CAN frame buffer.
LELY_CAN_BUF_INLINE size_t can_buf_peek(struct can_buf *buf, struct can_msg *ptr, size_t n)
Reads, but does not remove, frames from a CAN frame buffer.
LELY_CAN_BUF_INLINE size_t can_buf_write(struct can_buf *buf, const struct can_msg *ptr, size_t n)
Writes frames to a CAN frame buffer.
LELY_CAN_BUF_INLINE size_t can_buf_capacity(const struct can_buf *buf)
Returns the number of frames available for writing in a CAN buffer.
size_t can_buf_reserve(struct can_buf *buf, size_t n)
Resizes a CAN frame buffer, if necessary, to make room for at least n additional frames.
LELY_CAN_BUF_INLINE size_t can_buf_size(const struct can_buf *buf)
Returns the number of frames available for reading in a CAN buffer.
LELY_CAN_BUF_INLINE size_t can_buf_read(struct can_buf *buf, struct can_msg *ptr, size_t n)
Reads, and removes, frames from a CAN frame buffer.
LELY_CAN_BUF_INLINE void can_buf_clear(struct can_buf *buf)
Clears a CAN frame buffer.
void can_buf_fini(struct can_buf *buf)
Finalizes a CAN frame buffer.
This header file is part of the utilities library; it contains the C to C++ interface declarations.
The base class for a C++ interface to a standard layout C type.
A CAN or CAN FD format frame.
A class template supplying a uniform interface to certain attributes of C types.