Template Class BufferImplBase

Inheritance Relationships

Derived Types

Class Documentation

template<typename T>
class BufferImplBase

Abstract base class for all buffer implementations (CPU, CUDA, ROCm, etc.).

This base keeps only what the Buffer<T> pimpl and the serialization layer need. Backend-specific APIs (element access, resize, iterators, descriptor serialization, etc.) are the responsibility of each concrete implementation or the BufferBackend plugin; the CPU path goes through CpuBufferImpl directly.

Subclassed by rosidl::CpuBufferImpl< T, std::allocator< T > >, rosidl::CpuBufferImpl< T, Allocator >

Public Functions

virtual ~BufferImplBase() = default
virtual std::string get_backend_type() const = 0

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

virtual size_t size() const = 0

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

virtual std::unique_ptr<BufferImplBase<T>> to_cpu() const = 0

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

virtual std::unique_ptr<BufferImplBase<T>> clone() const = 0

Create a deep copy of this buffer.

Returns:

New BufferImplBase instance with copied data