Table of Contents

Class BufferPool

Espaço de nomes
easyar

BufferPool implementa um pool de memória. Pode ser usado para recursos que alocam repetidamente memória do mesmo tamanho, como acesso personalizado à câmera, reduzindo o tempo gasto na alocação de memória.

BufferPool

Construtores

BufferPool

block_size é o tamanho em bytes de cada Buffer. capacity é o número máximo de objetos Buffer.

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)

Parâmetros

Nome Tipo Descrição
block_size Int32
capacity Int32

Métodos

block_size

Tamanho em bytes de cada 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()

Retorna

Tipo Descrição
Int32

capacity

Número máximo de objetos 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()

Retorna

Tipo Descrição
Int32

size

Número atual de objetos Buffer obtidos externamente.

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()

Retorna

Tipo Descrição
Int32

tryAcquire

Tenta obter um bloco de memória. Se o número atual de objetos Buffer obtidos externamente não atingiu o número máximo de objetos Buffer, recupera ou aloca um novo Buffer; caso contrário, retorna vazio.

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()

Retorna

Tipo Descrição
Optional<Buffer>