CARLA
secondaryCommands.cpp
Go to the documentation of this file.
1 // Copyright (c) 2022 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 // #include "carla/Logging.h"
9 // #include "carla/streaming/detail/tcp/Message.h"
10 
11 namespace carla {
12 namespace multigpu {
13 
14 void SecondaryCommands::set_secondary(std::shared_ptr<Secondary> secondary) {
15  _secondary = secondary;
16 }
17 
19  _callback = callback;
20 }
21 
23  // get the header
24  CommandHeader *header;
25  header = reinterpret_cast<CommandHeader *>(buffer.data());
26 
27  // send only data to the callback
28  Buffer data(buffer.data() + sizeof(CommandHeader), header->size);
29  _callback(header->id, std::move(data));
30 
31  // log_info("Secondary got a command to process");
32 }
33 
34 
35 } // namespace multigpu
36 } // namespace carla
const value_type * data() const noexcept
Direct access to the allocated memory or nullptr if no memory is allocated.
Definition: carla/Buffer.h:156
std::shared_ptr< Secondary > _secondary
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
std::function< void(MultiGPUCommand, carla::Buffer)> callback_type
void set_secondary(std::shared_ptr< Secondary > secondary)
A piece of raw data.
Definition: carla/Buffer.h:42
void set_callback(callback_type callback)