Package org.lwjgl.util.lmdb
Class MDBVal
- java.lang.Object
-
- org.lwjgl.system.Pointer.Default
-
- org.lwjgl.system.Struct
-
- org.lwjgl.util.lmdb.MDBVal
-
- All Implemented Interfaces:
- java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer
public class MDBVal extends org.lwjgl.system.Struct implements org.lwjgl.system.NativeResourceGeneric structure used for passing keys and data in and out of the database.Values returned from the database are valid only until a subsequent update operation, or the end of the transaction. Do not modify or free them, they commonly point into the database itself.
Key sizes must be between 1 and
env_get_maxkeysizeinclusive. The same applies to data sizes in databases with theDUPSORTflag. Other data items can in theory be from 0 to0xffffffffbytes long.Member documentation
mv_size– Size of the data item.mv_data– Address of the data item.
Layout
struct MDB_val { size_t mv_size; void * mv_data; }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classMDBVal.BufferAn array ofMDBValstructs.
-
Field Summary
Fields Modifier and Type Field and Description static intSIZEOFThe struct size in bytes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static MDBValcalloc()Returns a newMDBValinstance allocated withmemCalloc.static MDBVal.Buffercalloc(int capacity)Returns a newMDBVal.Bufferinstance allocated withmemCalloc.static MDBValcallocStack()Returns a newMDBValinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static MDBVal.BuffercallocStack(int capacity)Returns a newMDBVal.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.static MDBVal.BuffercallocStack(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newMDBVal.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static MDBValcallocStack(org.lwjgl.system.MemoryStack stack)Returns a newMDBValinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.static MDBValcreate()Returns a newMDBValinstance allocated withBufferUtils.static MDBVal.Buffercreate(int capacity)Returns a newMDBVal.Bufferinstance allocated withBufferUtils.static MDBValcreate(long address)static MDBVal.Buffercreate(long address, int capacity)Create aMDBVal.Bufferinstance at the specified memory.static MDBValmalloc()Returns a newMDBValinstance allocated withmemAlloc.static MDBVal.Buffermalloc(int capacity)Returns a newMDBVal.Bufferinstance allocated withmemAlloc.static MDBValmallocStack()Returns a newMDBValinstance allocated on the thread-localMemoryStack.static MDBVal.BuffermallocStack(int capacity)Returns a newMDBVal.Bufferinstance allocated on the thread-localMemoryStack.static MDBVal.BuffermallocStack(int capacity, org.lwjgl.system.MemoryStack stack)Returns a newMDBVal.Bufferinstance allocated on the specifiedMemoryStack.static MDBValmallocStack(org.lwjgl.system.MemoryStack stack)Returns a newMDBValinstance allocated on the specifiedMemoryStack.java.nio.ByteBuffermv_data()Returns aByteBufferview of the data pointed to by themv_datafield.MDBValmv_data(java.nio.ByteBuffer value)Sets the address of the specifiedByteBufferto themv_datafield.longmv_size()Returns the value of themv_sizefield.MDBValmv_size(long value)Sets the specified value to themv_sizefield.MDBValnset(long struct)Unsafe version ofset.MDBValset(long mv_size, java.nio.ByteBuffer mv_data)Initializes this struct with the specified values.MDBValset(MDBVal src)Copies the specified struct data to this struct.intsizeof()Returns thesizeof(struct).
-
-
-
Constructor Detail
-
MDBVal
public MDBVal(java.nio.ByteBuffer container)
Creates aMDBValinstance at the current position of the specifiedByteBuffercontainer. Changes to the buffer's content will be visible to the struct instance and vice versa.The created instance holds a strong reference to the container object.
-
-
Method Detail
-
sizeof
public int sizeof()
Description copied from class:org.lwjgl.system.StructReturns thesizeof(struct).- Specified by:
sizeofin classorg.lwjgl.system.Struct
-
mv_size
public long mv_size()
Returns the value of themv_sizefield.
-
mv_data
public java.nio.ByteBuffer mv_data()
Returns aByteBufferview of the data pointed to by themv_datafield.
-
mv_size
public MDBVal mv_size(long value)
Sets the specified value to themv_sizefield.
-
mv_data
public MDBVal mv_data(java.nio.ByteBuffer value)
Sets the address of the specifiedByteBufferto themv_datafield.
-
set
public MDBVal set(long mv_size, java.nio.ByteBuffer mv_data)
Initializes this struct with the specified values.
-
set
public MDBVal set(MDBVal src)
Copies the specified struct data to this struct.- Parameters:
src- the source struct- Returns:
- this struct
-
malloc
public static MDBVal malloc()
Returns a newMDBValinstance allocated withmemAlloc. The instance must be explicitly freed.
-
calloc
public static MDBVal calloc()
Returns a newMDBValinstance allocated withmemCalloc. The instance must be explicitly freed.
-
create
public static MDBVal create(long address)
-
malloc
public static MDBVal.Buffer malloc(int capacity)
Returns a newMDBVal.Bufferinstance allocated withmemAlloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
calloc
public static MDBVal.Buffer calloc(int capacity)
Returns a newMDBVal.Bufferinstance allocated withmemCalloc. The instance must be explicitly freed.- Parameters:
capacity- the buffer capacity
-
create
public static MDBVal.Buffer create(int capacity)
Returns a newMDBVal.Bufferinstance allocated withBufferUtils.- Parameters:
capacity- the buffer capacity
-
create
public static MDBVal.Buffer create(long address, int capacity)
Create aMDBVal.Bufferinstance at the specified memory.- Parameters:
address- the memory addresscapacity- the buffer capacity
-
mallocStack
public static MDBVal mallocStack()
Returns a newMDBValinstance allocated on the thread-localMemoryStack.
-
callocStack
public static MDBVal callocStack()
Returns a newMDBValinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.
-
mallocStack
public static MDBVal mallocStack(org.lwjgl.system.MemoryStack stack)
Returns a newMDBValinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocate
-
callocStack
public static MDBVal callocStack(org.lwjgl.system.MemoryStack stack)
Returns a newMDBValinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocate
-
mallocStack
public static MDBVal.Buffer mallocStack(int capacity)
Returns a newMDBVal.Bufferinstance allocated on the thread-localMemoryStack.- Parameters:
capacity- the buffer capacity
-
callocStack
public static MDBVal.Buffer callocStack(int capacity)
Returns a newMDBVal.Bufferinstance allocated on the thread-localMemoryStackand initializes all its bits to zero.- Parameters:
capacity- the buffer capacity
-
mallocStack
public static MDBVal.Buffer mallocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newMDBVal.Bufferinstance allocated on the specifiedMemoryStack.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
callocStack
public static MDBVal.Buffer callocStack(int capacity, org.lwjgl.system.MemoryStack stack)
Returns a newMDBVal.Bufferinstance allocated on the specifiedMemoryStackand initializes all its bits to zero.- Parameters:
stack- the stack from which to allocatecapacity- the buffer capacity
-
-