27 if (buffer.
size() <
sizeof(header)) {
28 log_error(
"multigpu: dropping a", buffer.
size(),
"byte command shorter than its header");
31 std::memcpy(&header, buffer.
data(),
sizeof(header));
32 const std::size_t available = buffer.
size() -
sizeof(header);
33 if (header.
size > available) {
34 log_error(
"multigpu: dropping command",
static_cast<uint32_t
>(header.
id),
"declaring",
35 header.
size,
"payload bytes in a message holding", available);
38 if (header.
size < available) {
39 log_warning(
"multigpu: command",
static_cast<uint32_t
>(header.
id),
"has",
40 available - header.
size,
"trailing bytes; ignored");
const value_type * data() const noexcept
Direct access to the allocated memory or nullptr if no memory is allocated.
size_type size() const noexcept
std::function< void(MultiGPUCommand, carla::Buffer)> callback_type
void set_secondary(std::shared_ptr< Secondary > secondary)
void process_command(Buffer buffer)
std::shared_ptr< Secondary > _secondary
void set_callback(callback_type callback)
This file contains definitions of common data structures used in traffic manager.
static void log_error(Args &&... args)
static void log_warning(Args &&... args)