CARLA
 
载入中...
搜索中...
未找到
Private 成员函数 | Private 属性 | 友元 | 所有成员列表
carla::Buffer类 参考

A piece of raw data. 更多...

#include <Buffer.h>

+ carla::Buffer 的协作图:

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
Bufferoperator= (const Buffer &)=delete
 
Bufferoperator= (Buffer &&rhs) noexcept
 
Data access
const value_typeoperator[] (size_t i) const
 Access the byte at position i.
 
value_typeoperator[] (size_t i)
 Access the byte at position i.
 
const value_typedata () const noexcept
 Direct access to the allocated memory or nullptr if no memory is allocated.
 
value_typedata () 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.

警告
Creating a buffer bigger than max_size() is undefined.

在文件 carla/Buffer.h42 行定义.

成员类型定义说明

◆ const_iterator

在文件 carla/Buffer.h57 行定义.

◆ iterator

在文件 carla/Buffer.h55 行定义.

◆ size_type

using carla::Buffer::size_type = uint32_t

在文件 carla/Buffer.h53 行定义.

◆ value_type

using carla::Buffer::value_type = unsigned char

在文件 carla/Buffer.h51 行定义.

构造及析构函数说明

◆ Buffer() [1/8]

carla::Buffer::Buffer ( )
default

Create an empty buffer.

◆ Buffer() [2/8]

carla::Buffer::Buffer ( size_type size)
inlineexplicit

Create a buffer with size bytes allocated.

在文件 carla/Buffer.h71 行定义.

◆ Buffer() [3/8]

carla::Buffer::Buffer ( uint64_t size)
inlineexplicit

Create a buffer with size bytes allocated.

在文件 carla/Buffer.h77 行定义.

引用了 max_size(), size() , 以及 carla::throw_exception().

+ 函数调用图:

◆ Buffer() [4/8]

template<typename T >
carla::Buffer::Buffer ( const T & source)
inlineexplicit

Copy source into this buffer. Allocates the necessary memory.

在文件 carla/Buffer.h87 行定义.

引用了 copy_from().

+ 函数调用图:

◆ Buffer() [5/8]

carla::Buffer::Buffer ( const value_type * data,
size_type size )
inlineexplicit

在文件 carla/Buffer.h91 行定义.

引用了 copy_from(), data() , 以及 size().

+ 函数调用图:

◆ Buffer() [6/8]

carla::Buffer::Buffer ( const value_type * data,
uint64_t size )
inlineexplicit

Create a buffer with size bytes allocated.

在文件 carla/Buffer.h96 行定义.

引用了 max_size(), size() , 以及 carla::throw_exception().

+ 函数调用图:

◆ Buffer() [7/8]

carla::Buffer::Buffer ( const Buffer & )
delete

◆ Buffer() [8/8]

carla::Buffer::Buffer ( Buffer && rhs)
inlinenoexcept

在文件 carla/Buffer.h106 行定义.

◆ ~Buffer()

carla::Buffer::~Buffer ( )
inline

在文件 carla/Buffer.h112 行定义.

引用了 _capacity , 以及 ReuseThisBuffer().

+ 函数调用图:

成员函数说明

◆ begin() [1/2]

const_iterator carla::Buffer::begin ( ) const
inlinenoexcept

在文件 carla/Buffer.h221 行定义.

引用了 cbegin().

被这些函数引用 carla::sensor::RawData::begin(), carla::sensor::RawData::begin(), end() , 以及 carla::operator==().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ begin() [2/2]

iterator carla::Buffer::begin ( )
inlinenoexcept

在文件 carla/Buffer.h225 行定义.

引用了 _data.

◆ buffer() [1/2]

boost::asio::const_buffer carla::Buffer::buffer ( ) const
inlinenoexcept

Make a boost::asio::buffer from this buffer.

警告
Boost.Asio buffers do not own the data, it's up to the caller to not delete the memory that this buffer holds until the asio buffer is no longer used.

在文件 carla/Buffer.h176 行定义.

引用了 cbuffer().

被这些函数引用 carla::multigpu::IncomingMessage::buffer(), carla::streaming::detail::tcp::IncomingMessage::buffer(), copy_from() , 以及 copy_from().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ buffer() [2/2]

boost::asio::mutable_buffer carla::Buffer::buffer ( )
inlinenoexcept

Make a boost::asio::buffer from this buffer.

警告
Boost.Asio buffers do not own the data, it's up to the caller to not delete the memory that this buffer holds until the asio buffer is no longer used.

在文件 carla/Buffer.h181 行定义.

引用了 data() , 以及 size().

+ 函数调用图:

◆ capacity()

size_type carla::Buffer::capacity ( ) const
inlinenoexcept

在文件 carla/Buffer.h205 行定义.

引用了 _capacity.

被这些函数引用 carla::BufferView::capacity().

+ 这是这个函数的调用关系图:

◆ cbegin()

const_iterator carla::Buffer::cbegin ( ) const
inlinenoexcept

在文件 carla/Buffer.h217 行定义.

引用了 _data.

被这些函数引用 begin(), carla::BufferView::begin(), cend() , 以及 carla::BufferView::cend().

+ 这是这个函数的调用关系图:

◆ cbuffer()

boost::asio::const_buffer carla::Buffer::cbuffer ( ) const
inlinenoexcept

Make a boost::asio::buffer from this buffer.

警告
Boost.Asio buffers do not own the data, it's up to the caller to not delete the memory that this buffer holds until the asio buffer is no longer used.

在文件 carla/Buffer.h171 行定义.

引用了 data() , 以及 size().

被这些函数引用 buffer().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ cend()

const_iterator carla::Buffer::cend ( ) const
inlinenoexcept

在文件 carla/Buffer.h229 行定义.

引用了 cbegin() , 以及 size().

被这些函数引用 end() , 以及 carla::BufferView::end().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ clear()

void carla::Buffer::clear ( )
inlinenoexcept

Clear the contents of this buffer and set its size and capacity to zero.

Deletes allocated memory.

在文件 carla/Buffer.h291 行定义.

引用了 pop().

+ 函数调用图:

◆ copy_from() [1/6]

template<typename T >
void carla::Buffer::copy_from ( const T & source)
inline

Copy source into this buffer. Allocates memory if necessary.

在文件 carla/Buffer.h305 行定义.

引用了 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().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ copy_from() [2/6]

void carla::Buffer::copy_from ( const value_type * data,
size_type size )
inline

Copy size bytes of the memory pointed by data into this buffer.

Allocates memory if necessary.

在文件 carla/Buffer.h311 行定义.

引用了 copy_from(), data() , 以及 size().

+ 函数调用图:

◆ copy_from() [3/6]

void carla::Buffer::copy_from ( size_type offset,
const Buffer & rhs )
inline

Copy source into this buffer leaving at the front an offset of offset bytes uninitialized.

Allocates memory if necessary.

在文件 carla/Buffer.h317 行定义.

引用了 buffer() , 以及 copy_from().

+ 函数调用图:

◆ copy_from() [4/6]

template<typename T >
std::enable_if< boost::asio::is_const_buffer_sequence< T >::value >::type carla::Buffer::copy_from ( size_type offset,
const T & source )
inline

Copy source into this buffer leaving at the front an offset of offset bytes uninitialized.

Allocates memory if necessary.

在文件 carla/Buffer.h324 行定义.

引用了 buffer(), DEBUG_ASSERT, DEBUG_ONLY, reset() , 以及 size().

+ 函数调用图:

◆ copy_from() [5/6]

template<typename T >
std::enable_if<!boost::asio::is_const_buffer_sequence< T >::value >::type carla::Buffer::copy_from ( size_type offset,
const T & source )
inline

Copy source into this buffer leaving at the front an offset of offset bytes uninitialized.

Allocates memory if necessary.

在文件 carla/Buffer.h335 行定义.

引用了 copy_from().

+ 函数调用图:

◆ copy_from() [6/6]

void carla::Buffer::copy_from ( size_type offset,
const value_type * data,
size_type size )
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.h353 行定义.

引用了 copy_from(), data() , 以及 size().

+ 函数调用图:

◆ data() [1/2]

const value_type * carla::Buffer::data ( ) const
inlinenoexcept

◆ data() [2/2]

value_type * carla::Buffer::data ( )
inlinenoexcept

Direct access to the allocated memory or nullptr if no memory is allocated.

在文件 carla/Buffer.h162 行定义.

引用了 _data.

◆ empty()

bool carla::Buffer::empty ( ) const
inlinenoexcept

在文件 carla/Buffer.h193 行定义.

引用了 _size.

◆ end() [1/2]

const_iterator carla::Buffer::end ( ) const
inlinenoexcept

在文件 carla/Buffer.h233 行定义.

引用了 cend().

被这些函数引用 carla::sensor::RawData::end(), carla::sensor::RawData::end() , 以及 carla::operator==().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ end() [2/2]

iterator carla::Buffer::end ( )
inlinenoexcept

在文件 carla/Buffer.h237 行定义.

引用了 begin() , 以及 size().

+ 函数调用图:

◆ max_size()

static constexpr size_type carla::Buffer::max_size ( )
inlinestaticconstexprnoexcept

在文件 carla/Buffer.h201 行定义.

被这些函数引用 Buffer(), Buffer() , 以及 reset().

+ 这是这个函数的调用关系图:

◆ operator=() [1/2]

Buffer & carla::Buffer::operator= ( Buffer && rhs)
inlinenoexcept

在文件 carla/Buffer.h128 行定义.

引用了 _capacity, _data, _parent_pool , 以及 _size.

◆ operator=() [2/2]

Buffer & carla::Buffer::operator= ( const Buffer & )
delete

◆ operator[]() [1/2]

value_type & carla::Buffer::operator[] ( size_t i)
inline

Access the byte at position i.

在文件 carla/Buffer.h150 行定义.

引用了 _data.

◆ operator[]() [2/2]

const value_type & carla::Buffer::operator[] ( size_t i) const
inline

Access the byte at position i.

在文件 carla/Buffer.h145 行定义.

引用了 _data.

◆ pop()

std::unique_ptr< value_type[]> carla::Buffer::pop ( )
inlinenoexcept

Release the contents of this buffer and set its size and capacity to zero.

在文件 carla/Buffer.h283 行定义.

引用了 _capacity, _data , 以及 _size.

被这些函数引用 clear().

+ 这是这个函数的调用关系图:

◆ reset() [1/2]

void carla::Buffer::reset ( size_type size)
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.h252 行定义.

引用了 _capacity, _data, _size, carla::log_debug() , 以及 size().

被这些函数引用 carla::multigpu::IncomingMessage::buffer(), carla::streaming::detail::tcp::IncomingMessage::buffer(), copy_from(), reset(), resize() , 以及 TEST().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ reset() [2/2]

void carla::Buffer::reset ( uint64_t size)
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.h262 行定义.

引用了 max_size(), reset(), size() , 以及 carla::throw_exception().

+ 函数调用图:

◆ resize()

void carla::Buffer::resize ( uint64_t size)
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.h271 行定义.

引用了 _capacity, _data, _size, copy_from(), data(), reset() , 以及 size().

+ 函数调用图:

◆ ReuseThisBuffer()

void carla::Buffer::ReuseThisBuffer ( )
private

在文件 carla/Buffer.cpp7 行定义.

引用了 _parent_pool.

被这些函数引用 ~Buffer().

+ 这是这个函数的调用关系图:

◆ size()

size_type carla::Buffer::size ( ) const
inlinenoexcept

友元及相关函数文档

◆ BufferPool

friend class BufferPool
friend

在文件 carla/Buffer.h363 行定义.

◆ BufferView

friend class BufferView
friend

在文件 carla/Buffer.h364 行定义.

类成员变量说明

◆ _capacity

size_type carla::Buffer::_capacity = 0u
private

在文件 carla/Buffer.h370 行定义.

被这些函数引用 capacity(), operator=(), pop(), reset(), resize() , 以及 ~Buffer().

◆ _data

std::unique_ptr<value_type[]> carla::Buffer::_data = nullptr
private

在文件 carla/Buffer.h372 行定义.

被这些函数引用 begin(), cbegin(), data(), data(), operator=(), operator[](), operator[](), pop(), reset() , 以及 resize().

◆ _parent_pool

std::weak_ptr<BufferPool> carla::Buffer::_parent_pool
private

在文件 carla/Buffer.h366 行定义.

被这些函数引用 operator=(), carla::BufferPool::Pop() , 以及 ReuseThisBuffer().

◆ _size

size_type carla::Buffer::_size = 0u
private

在文件 carla/Buffer.h368 行定义.

被这些函数引用 empty(), operator=(), pop(), reset(), resize() , 以及 size().


该类的文档由以下文件生成: