public class FSTStructAllocator extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Bytez |
chunk |
protected int |
chunkIndex |
protected int |
chunkSize |
| Modifier | Constructor and Description |
|---|---|
protected |
FSTStructAllocator() |
|
FSTStructAllocator(int chunkSizeBytes)
Create a Heap-Byte Array Structallocator with given chunk size in bytes.
|
|
FSTStructAllocator(int chunkSizeBytes,
BytezAllocator allocator)
optionally uses another allocator (e.g.
|
| Modifier and Type | Method and Description |
|---|---|
protected static <C extends FSTStruct> |
allocInstance(Class<C> clazz) |
static FSTStruct |
createStructPointer(Bytez b,
int index) |
void |
free()
frees associated offheap memory, in case making objects created INVALID (Access violation!).
|
protected FSTStructFactory |
getFactory() |
static FSTStruct |
getVolatileStructPointer(Bytez b,
int index) |
<X extends FSTStruct> |
newArray(int size,
X templ)
create a new struct array of same type as template
|
<X extends FSTStruct> |
newArray(int size,
X templ,
BytezAllocator alloc)
create a new struct array of same type as template
|
static <C extends FSTStruct> |
newPointer(Class<C> clazz) |
<S extends FSTStruct> |
newStruct(S aTemplate)
allocate a Struct instance from an arbitrary template instance.
|
<S extends FSTStruct> |
newStruct(S aTemplate,
BytezAllocator alloc) |
static <T extends FSTStruct> |
toStruct(T onHeapTemplate) |
protected int chunkSize
protected Bytez chunk
protected int chunkIndex
protected FSTStructAllocator()
public FSTStructAllocator(int chunkSizeBytes)
chunkSizeBytes - public FSTStructAllocator(int chunkSizeBytes,
BytezAllocator allocator)
chunkSizeBytes - - set to a reasonable size, memory is allocated in thes chunk sizes. If very small, each
struct alloc will result in its individual chunk being allocated.allocator - public static FSTStruct createStructPointer(Bytez b, int index)
b - index - public static <T extends FSTStruct> T toStruct(T onHeapTemplate)
T - onHeapTemplate - public static FSTStruct getVolatileStructPointer(Bytez b, int index)
b - index - public static <C extends FSTStruct> C newPointer(Class<C> clazz)
C - clazz - protected static <C extends FSTStruct> Object allocInstance(Class<C> clazz) throws Exception
Exceptionpublic <X extends FSTStruct> StructArray<X> newArray(int size, X templ)
size - public <X extends FSTStruct> StructArray<X> newArray(int size, X templ, BytezAllocator alloc)
size - public void free()
public <S extends FSTStruct> S newStruct(S aTemplate)
S - aTemplate - public <S extends FSTStruct> S newStruct(S aTemplate, BytezAllocator alloc)
protected FSTStructFactory getFactory()
Copyright © 2015. All rights reserved.