Template Class CpuBufferImpl

Inheritance Relationships

Base Type

Class Documentation

template<typename T, typename Allocator = std::allocator<T>>
class CpuBufferImpl : public rosidl::BufferImplBase<T>

CPU buffer implementation wrapping std::vector. Provides the reference implementation for CPU memory buffers.

Public Functions

CpuBufferImpl() = default
inline std::vector<T, Allocator> &get_storage()

Get mutable reference to underlying std::vector.

inline const std::vector<T, Allocator> &get_storage() const

Get const reference to underlying std::vector.

inline virtual std::string get_backend_type() const override

Get the backend type identifier (e.g., “cpu”, “cuda”, “demo”). Each concrete implementation returns its own fixed identifier.

inline virtual size_t size() const override

Get the number of elements in the buffer. Required by the serialization layer for all backends.

inline virtual std::unique_ptr<BufferImplBase<T>> to_cpu() const override

Create a CPU copy of this buffer. If already on CPU, may return a copy or the same instance.

Returns:

New BufferImplBase instance on CPU

inline virtual std::unique_ptr<BufferImplBase<T>> clone() const override

Create a deep copy of this buffer.

Returns:

New BufferImplBase instance with copied data