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
메모리 블록을 획득하려고 시도합니다. 만약 현재 외부에서 획득한 Buffer 개수가 최대 Buffer 개수에 도달하지 않았다면, 새로운 Buffer를 할당하거나 가져오고, 그렇지 않으면 null을 반환합니다.
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> |