Class BufferPool
- Espace de noms
- easyar
BufferPool implémente un pool de mémoire. Il peut être utilisé pour des fonctions qui allouent à plusieurs reprises de la mémoire de même taille, comme l’accès caméra personnalisé, afin de réduire le temps d’allocation mémoire.
BufferPool
Constructeurs
BufferPool
block_size est la taille en octets de chaque Buffer. capacity est le nombre maximal d’objets 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)
Paramètres
| Nom | Type | Description |
|---|---|---|
| block_size | Int32 | |
| capacity | Int32 |
Méthodes
block_size
Taille en octets de chaque 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()
Retours
| Type | Description |
|---|---|
| Int32 |
capacity
Nombre maximal d’objets 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()
Retours
| Type | Description |
|---|---|
| Int32 |
size
Nombre actuel d’objets Buffer obtenus en externe.
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()
Retours
| Type | Description |
|---|---|
| Int32 |
tryAcquire
Tente d’obtenir un bloc de mémoire. Si le nombre actuel d’objets Buffer obtenus en externe n’a pas atteint le nombre maximal d’objets Buffer, il récupère ou alloue un nouveau Buffer ; sinon, il retourne vide.
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()
Retours
| Type | Description |
|---|---|
| Optional<Buffer> |