Class BufferPool
- 命名空间
- easyar
BufferPool 实现了一个内存池,可用于自定义摄像头接入等需要反复分配相同大小内存的功能,降低内存分配耗时。
BufferPool
构造函数
BufferPool
void easyar_BufferPool__ctor(int block_size, int capacity, easyar_BufferPool * * Return)
BufferPool(int block_size, int capacity)
public BufferPool(int block_size, int capacity)
constructor(block_size: Int, capacity: Int)
+ (easyar_BufferPool *) create:(int)block_size capacity:(int)capacity
public convenience init(_ block_size: Int32, _ capacity: Int32)
public BufferPool(int block_size, int capacity)
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| block_size | Int32 | |
| capacity | Int32 |
方法
block_size
每个 Buffer 的字节大小。
int easyar_BufferPool_block_size(const easyar_BufferPool * This)
int block_size()
public int block_size()
fun block_size(): Int
- (int)block_size
public func block_size() -> Int32
public virtual int block_size()
返回
| 类型 | 描述 |
|---|---|
| Int32 |
capacity
最大 Buffer 数量。
int easyar_BufferPool_capacity(const easyar_BufferPool * This)
int capacity()
public int capacity()
fun capacity(): Int
- (int)capacity
public func capacity() -> Int32
public virtual int capacity()
返回
| 类型 | 描述 |
|---|---|
| Int32 |
size
当前外部获得的 Buffer 数量。
int easyar_BufferPool_size(const easyar_BufferPool * This)
int size()
public int size()
fun size(): Int
- (int)size
public func size() -> Int32
public virtual int size()
返回
| 类型 | 描述 |
|---|---|
| Int32 |
tryAcquire
void easyar_BufferPool_tryAcquire(easyar_BufferPool * This, easyar_OptionalOfBuffer * Return)
std::optional<std::shared_ptr<Buffer>> tryAcquire()
public @Nullable Buffer tryAcquire()
fun tryAcquire(): Buffer?
- (easyar_Buffer *)tryAcquire
public func tryAcquire() -> Buffer?
public virtual Optional<Buffer> tryAcquire()
返回
| 类型 | 描述 |
|---|---|
| Optional<Buffer> |