CARLA
 
载入中...
搜索中...
未找到
incomingMessage.h
浏览该文件的文档.
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/BufferPool.h"
8#include "carla/Debug.h"
9#include "carla/Exception.h"
10#include "carla/Logging.h"
12#include "carla/Time.h"
13
14#include <exception>
15
16namespace carla {
17namespace multigpu {
18
19 /// Helper for reading incoming TCP messages. Allocates the whole message in
20 /// a single buffer.
22 public:
23
24 explicit IncomingMessage(Buffer &&buffer) : _buffer(std::move(buffer)) {}
25
26 boost::asio::mutable_buffer size_as_buffer() {
27 return boost::asio::buffer(&_size, sizeof(_size));
28 }
29
30 boost::asio::mutable_buffer buffer() {
31 DEBUG_ASSERT(_size > 0u);
33 return _buffer.buffer();
34 }
35
36 auto size() const {
37 return _size;
38 }
39
40 auto pop() {
41 return std::move(_buffer);
42 }
43
44 private:
45
47
49 };
50
51
52} // namespace multigpu
53} // namespace carla
#define DEBUG_ASSERT(predicate)
Definition Debug.h:66
A piece of raw data.
void reset(size_type size)
Reset the size of this buffer.
boost::asio::const_buffer buffer() const noexcept
Make a boost::asio::buffer from this buffer.
Helper for reading incoming TCP messages.
boost::asio::mutable_buffer buffer()
carla::streaming::detail::message_size_type _size
boost::asio::mutable_buffer size_as_buffer()
uint32_t message_size_type
Definition Types.h:20
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133