Thread-safe queue for buffering packet data bytes.
More...
#include <packet_buffer.h>
|
bool | Empty () const noexcept |
| Indicate whether the buffer is empty or not. More...
|
|
bool | TryEnqueue (std::vector< uint8_t > &&packet) |
| Try to insert a packet to the buffer via moving. More...
|
|
bool | TryDequeue (std::vector< uint8_t > &packet) |
| Try to peek a packet from the buffer by removing it. More...
|
|
bool | TryClear () |
| Try to make the buffer empty. More...
|
|
Thread-safe queue for buffering packet data bytes.
◆ Empty()
bool ObdEmulator::PacketBuffer::Empty |
( |
| ) |
const |
|
inlinenoexcept |
Indicate whether the buffer is empty or not.
- Returns
- True if the buffer is empty, otherwise false
◆ TryClear()
bool ObdEmulator::PacketBuffer::TryClear |
( |
| ) |
|
Try to make the buffer empty.
- Returns
- True if the buffer is cleared successfully; otherwise false
◆ TryDequeue()
bool ObdEmulator::PacketBuffer::TryDequeue |
( |
std::vector< uint8_t > & |
packet | ) |
|
Try to peek a packet from the buffer by removing it.
- Parameters
-
[out] | packet | Packet that is moved out from the buffer |
- Returns
- True if the packet is dequeued successfully, otherwise false
◆ TryEnqueue()
bool ObdEmulator::PacketBuffer::TryEnqueue |
( |
std::vector< uint8_t > && |
packet | ) |
|
Try to insert a packet to the buffer via moving.
- Parameters
-
[in] | packet | Packet bytes to be moved into the buffer |
- Returns
- True if the packet is moved to the buffer successfully, otherwise false