A piece of raw data. 更多...
#include <Buffer.h>
Public 类型 | |
Member types | |
using | value_type = unsigned char |
using | size_type = uint32_t |
using | iterator = value_type * |
using | const_iterator = const value_type * |
Public 成员函数 | |
Construction and destruction | |
Buffer ()=default | |
Create an empty buffer. | |
Buffer (size_type size) | |
Create a buffer with size bytes allocated. | |
Buffer (uint64_t size) | |
Create a buffer with size bytes allocated. | |
template<typename T > | |
Buffer (const T &source) | |
Copy source into this buffer. Allocates the necessary memory. | |
Buffer (const value_type *data, size_type size) | |
Buffer (const value_type *data, uint64_t size) | |
Create a buffer with size bytes allocated. | |
Buffer (const Buffer &)=delete | |
Buffer (Buffer &&rhs) noexcept | |
~Buffer () | |
Assignment | |
Buffer & | operator= (const Buffer &)=delete |
Buffer & | operator= (Buffer &&rhs) noexcept |
Data access | |
const value_type & | operator[] (size_t i) const |
Access the byte at position i. | |
value_type & | operator[] (size_t i) |
Access the byte at position i. | |
const value_type * | data () const noexcept |
Direct access to the allocated memory or nullptr if no memory is allocated. | |
value_type * | data () noexcept |
Direct access to the allocated memory or nullptr if no memory is allocated. | |
boost::asio::const_buffer | cbuffer () const noexcept |
Make a boost::asio::buffer from this buffer. | |
boost::asio::const_buffer | buffer () const noexcept |
Make a boost::asio::buffer from this buffer. | |
boost::asio::mutable_buffer | buffer () noexcept |
Make a boost::asio::buffer from this buffer. | |
Iterators | |
const_iterator | cbegin () const noexcept |
const_iterator | begin () const noexcept |
iterator | begin () noexcept |
const_iterator | cend () const noexcept |
const_iterator | end () const noexcept |
iterator | end () noexcept |
Modifiers | |
void | reset (size_type size) |
Reset the size of this buffer. | |
void | reset (uint64_t size) |
Reset the size of this buffer. | |
void | resize (uint64_t size) |
Resize the buffer, a new block of size size is allocated if the capacity is not enough and the data is copied. | |
std::unique_ptr< value_type[]> | pop () noexcept |
Release the contents of this buffer and set its size and capacity to zero. | |
void | clear () noexcept |
Clear the contents of this buffer and set its size and capacity to zero. | |
copy_from | |
template<typename T > | |
void | copy_from (const T &source) |
Copy source into this buffer. Allocates memory if necessary. | |
void | copy_from (const value_type *data, size_type size) |
Copy size bytes of the memory pointed by data into this buffer. | |
void | copy_from (size_type offset, const Buffer &rhs) |
Copy source into this buffer leaving at the front an offset of offset bytes uninitialized. | |
template<typename T > | |
std::enable_if< boost::asio::is_const_buffer_sequence< T >::value >::type | copy_from (size_type offset, const T &source) |
Copy source into this buffer leaving at the front an offset of offset bytes uninitialized. | |
template<typename T > | |
std::enable_if<!boost::asio::is_const_buffer_sequence< T >::value >::type | copy_from (size_type offset, const T &source) |
Copy source into this buffer leaving at the front an offset of offset bytes uninitialized. | |
void | copy_from (size_type offset, const value_type *data, size_type size) |
Copy size bytes of the memory pointed by data into this buffer, leaving at the front an offset of offset bytes uninitialized. | |
Private 成员函数 | |
void | ReuseThisBuffer () |
Private 属性 | |
size_type | _capacity = 0u |
std::unique_ptr< value_type[]> | _data = nullptr |
std::weak_ptr< BufferPool > | _parent_pool |
size_type | _size = 0u |
友元 | |
class | BufferPool |
class | BufferView |
Capacity | |
bool | empty () const noexcept |
size_type | size () const noexcept |
size_type | capacity () const noexcept |
static constexpr size_type | max_size () noexcept |
A piece of raw data.
Note that if more capacity is needed, a new memory block is allocated and the old one is deleted. This means that by default the buffer can only grow. To release the memory use clear
or pop
.
This is a move-only type, meant to be cheap to pass by value. If the buffer is retrieved from a BufferPool, the memory is automatically pushed back to the pool on destruction.
在文件 carla/Buffer.h 第 42 行定义.
using carla::Buffer::const_iterator = const value_type * |
在文件 carla/Buffer.h 第 57 行定义.
using carla::Buffer::iterator = value_type * |
在文件 carla/Buffer.h 第 55 行定义.
using carla::Buffer::size_type = uint32_t |
在文件 carla/Buffer.h 第 53 行定义.
using carla::Buffer::value_type = unsigned char |
在文件 carla/Buffer.h 第 51 行定义.
|
default |
Create an empty buffer.
|
inlineexplicit |
Create a buffer with size bytes allocated.
在文件 carla/Buffer.h 第 71 行定义.
|
inlineexplicit |
Create a buffer with size bytes allocated.
在文件 carla/Buffer.h 第 77 行定义.
引用了 max_size(), size() , 以及 carla::throw_exception().
|
inlineexplicit |
Copy source into this buffer. Allocates the necessary memory.
在文件 carla/Buffer.h 第 87 行定义.
引用了 copy_from().
|
inlineexplicit |
|
inlineexplicit |
Create a buffer with size bytes allocated.
在文件 carla/Buffer.h 第 96 行定义.
引用了 max_size(), size() , 以及 carla::throw_exception().
|
delete |
|
inlinenoexcept |
在文件 carla/Buffer.h 第 106 行定义.
|
inline |
|
inlinenoexcept |
在文件 carla/Buffer.h 第 221 行定义.
引用了 cbegin().
被这些函数引用 carla::sensor::RawData::begin(), carla::sensor::RawData::begin(), end() , 以及 carla::operator==().
|
inlinenoexcept |
在文件 carla/Buffer.h 第 225 行定义.
引用了 _data.
|
inlinenoexcept |
Make a boost::asio::buffer from this buffer.
在文件 carla/Buffer.h 第 176 行定义.
引用了 cbuffer().
被这些函数引用 carla::multigpu::IncomingMessage::buffer(), carla::streaming::detail::tcp::IncomingMessage::buffer(), copy_from() , 以及 copy_from().
|
inlinenoexcept |
Make a boost::asio::buffer from this buffer.
在文件 carla/Buffer.h 第 181 行定义.
|
inlinenoexcept |
|
inlinenoexcept |
在文件 carla/Buffer.h 第 217 行定义.
引用了 _data.
被这些函数引用 begin(), carla::BufferView::begin(), cend() , 以及 carla::BufferView::cend().
|
inlinenoexcept |
Make a boost::asio::buffer from this buffer.
在文件 carla/Buffer.h 第 171 行定义.
被这些函数引用 buffer().
|
inlinenoexcept |
|
inlinenoexcept |
Clear the contents of this buffer and set its size and capacity to zero.
Deletes allocated memory.
在文件 carla/Buffer.h 第 291 行定义.
引用了 pop().
|
inline |
Copy source into this buffer. Allocates memory if necessary.
在文件 carla/Buffer.h 第 305 行定义.
引用了 copy_from().
被这些函数引用 Buffer(), Buffer(), copy_from(), copy_from(), copy_from(), copy_from(), copy_from(), resize(), carla::sensor::s11n::CAMDataSerializer::Serialize(), carla::sensor::s11n::CustomV2XDataSerializer::Serialize(), carla::sensor::s11n::LidarSerializer::Serialize(), carla::sensor::s11n::RadarSerializer::Serialize(), carla::sensor::s11n::SemanticLidarSerializer::Serialize(), TEST() , 以及 TEST().
|
inline |
Copy size bytes of the memory pointed by data into this buffer.
Allocates memory if necessary.
在文件 carla/Buffer.h 第 311 行定义.
引用了 copy_from(), data() , 以及 size().
Copy source into this buffer leaving at the front an offset of offset bytes uninitialized.
Allocates memory if necessary.
在文件 carla/Buffer.h 第 317 行定义.
引用了 buffer() , 以及 copy_from().
|
inline |
Copy source into this buffer leaving at the front an offset of offset bytes uninitialized.
Allocates memory if necessary.
在文件 carla/Buffer.h 第 324 行定义.
引用了 buffer(), DEBUG_ASSERT, DEBUG_ONLY, reset() , 以及 size().
|
inline |
Copy source into this buffer leaving at the front an offset of offset bytes uninitialized.
Allocates memory if necessary.
在文件 carla/Buffer.h 第 335 行定义.
引用了 copy_from().
|
inline |
Copy size bytes of the memory pointed by data into this buffer, leaving at the front an offset of offset bytes uninitialized.
Allocates memory if necessary.
在文件 carla/Buffer.h 第 353 行定义.
引用了 copy_from(), data() , 以及 size().
|
inlinenoexcept |
Direct access to the allocated memory or nullptr if no memory is allocated.
在文件 carla/Buffer.h 第 156 行定义.
引用了 _data.
被这些函数引用 util::buffer::as_string(), buffer(), Buffer(), carla::BufferView::cbegin(), cbuffer(), carla::BufferView::cbuffer(), copy_from(), copy_from(), carla::BufferView::data(), carla::sensor::s11n::SensorHeaderSerializer::Deserialize(), FAsyncDataStreamTmpl< T >::GetSensorTransform(), FAsyncDataStreamTmpl< T >::GetSensorType(), carla::BufferView::operator[](), carla::multigpu::SecondaryCommands::process_command(), resize(), FAsyncDataStreamTmpl< T >::SetFrameNumber(), TEST(), TEST(), util::buffer::to_hex_string() , 以及 carla::MsgPack::UnPack().
|
inlinenoexcept |
Direct access to the allocated memory or nullptr if no memory is allocated.
在文件 carla/Buffer.h 第 162 行定义.
引用了 _data.
|
inlinenoexcept |
在文件 carla/Buffer.h 第 193 行定义.
引用了 _size.
|
inlinenoexcept |
在文件 carla/Buffer.h 第 233 行定义.
引用了 cend().
被这些函数引用 carla::sensor::RawData::end(), carla::sensor::RawData::end() , 以及 carla::operator==().
|
inlinenoexcept |
|
inlinestaticconstexprnoexcept |
在文件 carla/Buffer.h 第 128 行定义.
引用了 _capacity, _data, _parent_pool , 以及 _size.
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
Reset the size of this buffer.
If the capacity is not enough, the current memory is discarded and a new block of size size is allocated.
在文件 carla/Buffer.h 第 252 行定义.
引用了 _capacity, _data, _size, carla::log_debug() , 以及 size().
被这些函数引用 carla::multigpu::IncomingMessage::buffer(), carla::streaming::detail::tcp::IncomingMessage::buffer(), copy_from(), reset(), resize() , 以及 TEST().
|
inline |
Reset the size of this buffer.
If the capacity is not enough, the current memory is discarded and a new block of size size is allocated.
在文件 carla/Buffer.h 第 262 行定义.
引用了 max_size(), reset(), size() , 以及 carla::throw_exception().
|
inline |
Resize the buffer, a new block of size size is allocated if the capacity is not enough and the data is copied.
在文件 carla/Buffer.h 第 271 行定义.
引用了 _capacity, _data, _size, copy_from(), data(), reset() , 以及 size().
|
private |
|
inlinenoexcept |
在文件 carla/Buffer.h 第 197 行定义.
引用了 _size.
被这些函数引用 util::buffer::as_string(), buffer(), Buffer(), Buffer(), Buffer(), cbuffer(), carla::BufferView::cbuffer(), cend(), carla::BufferView::cend(), copy_from(), copy_from(), copy_from(), carla::BufferView::empty(), end(), make_special_message(), carla::operator<<(), carla::operator==(), reset(), reset(), resize(), carla::BufferView::size(), TEST(), TEST(), TEST(), util::buffer::to_hex_string() , 以及 carla::MsgPack::UnPack().
|
friend |
在文件 carla/Buffer.h 第 363 行定义.
|
friend |
在文件 carla/Buffer.h 第 364 行定义.
|
private |
在文件 carla/Buffer.h 第 370 行定义.
被这些函数引用 capacity(), operator=(), pop(), reset(), resize() , 以及 ~Buffer().
|
private |
在文件 carla/Buffer.h 第 372 行定义.
被这些函数引用 begin(), cbegin(), data(), data(), operator=(), operator[](), operator[](), pop(), reset() , 以及 resize().
|
private |
在文件 carla/Buffer.h 第 366 行定义.
被这些函数引用 operator=(), carla::BufferPool::Pop() , 以及 ReuseThisBuffer().
|
private |
在文件 carla/Buffer.h 第 368 行定义.
被这些函数引用 empty(), operator=(), pop(), reset(), resize() , 以及 size().