Class BufferPool
- Namespace
- easyar
BufferPool implementiert einen Speicherpool. Er kann für Funktionen verwendet werden, die wiederholt Speicher gleicher Größe zuweisen, z. B. benutzerdefinierter Kamerazugriff, und reduziert die Zeit für Speicherzuweisungen.
BufferPool
Konstruktoren
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)
Parameter
| Name | Typ | Beschreibung |
|---|---|---|
| block_size | Int32 | |
| capacity | Int32 |
Methoden
block_size
Bytegröße jedes 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()
Rückgabewert
| Typ | Beschreibung |
|---|---|
| Int32 |
capacity
Maximale Anzahl von Buffer-Objekten.
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()
Rückgabewert
| Typ | Beschreibung |
|---|---|
| Int32 |
size
Aktuelle Anzahl extern abgerufener Buffer-Objekte.
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()
Rückgabewert
| Typ | Beschreibung |
|---|---|
| Int32 |
tryAcquire
Versucht, einen Speicherblock abzurufen. Wenn die aktuelle Anzahl extern abgerufener Buffer-Objekte die maximale Anzahl von Buffer-Objekten nicht erreicht hat, wird ein neuer Buffer abgerufen oder zugewiesen; andernfalls wird leer zurückgegeben.
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()
Rückgabewert
| Typ | Beschreibung |
|---|---|
| Optional<Buffer> |