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를 가져오거나 할당하고, 그렇지 않으면 비어 있음을 반환합니다.
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> |