Package one.microstream.memory
Class MemoryAccessorGeneric
- java.lang.Object
-
- one.microstream.memory.MemoryAccessorGeneric
-
- All Implemented Interfaces:
MemoryAccessor
public final class MemoryAccessorGeneric extends Object implements MemoryAccessor
-
-
Constructor Summary
Constructors Constructor Description MemoryAccessorGeneric()
-
Method Summary
Modifier and Type Method Description longallocateMemory(long bytes)voidcopyArrayToAddress(boolean[] array, long targetAddress)voidcopyArrayToAddress(byte[] array, long targetAddress)voidcopyArrayToAddress(char[] array, long targetAddress)voidcopyArrayToAddress(double[] array, long targetAddress)voidcopyArrayToAddress(float[] array, long targetAddress)voidcopyArrayToAddress(int[] array, long targetAddress)voidcopyArrayToAddress(long[] array, long targetAddress)voidcopyArrayToAddress(short[] array, long targetAddress)voidcopyRange(long sourceAddress, long targetAddress, long length)voidcopyRangeToArray(long sourceAddress, boolean[] target)voidcopyRangeToArray(long sourceAddress, byte[] target)voidcopyRangeToArray(long sourceAddress, char[] target)voidcopyRangeToArray(long sourceAddress, double[] target)voidcopyRangeToArray(long sourceAddress, float[] target)voidcopyRangeToArray(long sourceAddress, int[] target)voidcopyRangeToArray(long sourceAddress, long[] target)voidcopyRangeToArray(long sourceAddress, short[] target)booleandeallocateDirectByteBuffer(ByteBuffer directBuffer)static Class<?>determineMostSpecificDeclaringClass(Field[] fields)voidensureClassInitialized(Class<?> c)voidensureClassInitialized(Class<?> c, Iterable<Field> usedFields)Uses the passed fields if required by the implementation.voidfillMemory(long targetAddress, long length, byte value)voidfreeMemory(long address)booleanget_boolean(long address)booleanget_boolean(Object instance, long offset)byteget_byte(long address)byteget_byte(Object instance, long offset)charget_char(long address)charget_char(Object instance, long offset)doubleget_double(long address)doubleget_double(Object instance, long offset)floatget_float(long address)floatget_float(Object instance, long offset)intget_int(long address)intget_int(Object instance, long offset)longget_long(long address)longget_long(Object instance, long offset)shortget_short(long address)shortget_short(Object instance, long offset)longgetDirectByteBufferAddress(ByteBuffer directBuffer)ObjectgetObject(Object instance, long offset)ByteBufferguaranteeDirectByteBuffer(ByteBuffer directBuffer)voidguaranteeUsability()Guarantees the full usability of this class by validating if all functionality is usable.<T> TinstantiateBlank(Class<T> c)booleanisDirectByteBuffer(ByteBuffer byteBuffer)ByteBuffer[]lookupChain(int chunkSizeIndex)ByteBuffer[]lookupChainNonNull(int chunkSizeIndex, int chainIndex)static MemoryAccessorGenericNew()static MemoryAccessorGenericNew(DefaultInstantiator defaultInstantiator)static MemoryAccessorGenericNew(DefaultInstantiator defaultInstantiator, DirectBufferDeallocator directBufferDeallocator)static MemoryAccessorGenericNew(DirectBufferDeallocator directBufferDeallocator)longobjectFieldOffset(Class<?> objectClass, Field field)Similar toMemoryAccessor.objectFieldOffset(Field), but with the specific object class.
The difference is that the actual object's class is not the declaring class of its fields if it only extends another class but does not declare an object field itself.longobjectFieldOffset(Field field)Returns an unspecified, abstract "offset" of the passedFieldto specify a generic access of the field's value for an instance of its declaring class that can be used with object-based methods likeset_int(Object,long,int).long[]objectFieldOffsets(Class<?> objectClass, Field... fields)Array alias vor #objectFieldOffset(Class, Field).long[]objectFieldOffsets(Field... fields)Array alias vor #objectFieldOffset(Field).longreallocateMemory(long address, long bytes)voidset_boolean(long address, boolean value)voidset_boolean(Object instance, long offset, boolean value)voidset_booleanInBytes(byte[] bytes, int index, boolean value)voidset_byte(long address, byte value)voidset_byte(Object instance, long offset, byte value)voidset_byteInBytes(byte[] bytes, int index, byte value)voidset_char(long address, char value)voidset_char(Object instance, long offset, char value)voidset_charInBytes(byte[] bytes, int index, char value)voidset_double(long address, double value)voidset_double(Object instance, long offset, double value)voidset_doubleInBytes(byte[] bytes, int index, double value)voidset_float(long address, float value)voidset_float(Object instance, long offset, float value)voidset_floatInBytes(byte[] bytes, int index, float value)voidset_int(long address, int value)voidset_int(Object instance, long offset, int value)voidset_intInBytes(byte[] bytes, int index, int value)voidset_long(long address, long value)voidset_long(Object instance, long offset, long value)voidset_longInBytes(byte[] bytes, int index, long value)voidset_short(long address, short value)voidset_short(Object instance, long offset, short value)voidset_shortInBytes(byte[] bytes, int index, short value)voidsetObject(Object instance, long offset, Object value)booleansystemDeallocateDirectByteBuffer(ByteBuffer directByteBuffer)MemoryAccessortoReversing()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface one.microstream.memory.MemoryAccessor
asByteArray, asByteArray, isReversing, objectFieldOffsets, objectFieldOffsets
-
-
-
-
Method Detail
-
New
public static MemoryAccessorGeneric New()
-
New
public static MemoryAccessorGeneric New(DefaultInstantiator defaultInstantiator)
-
New
public static MemoryAccessorGeneric New(DirectBufferDeallocator directBufferDeallocator)
-
New
public static MemoryAccessorGeneric New(DefaultInstantiator defaultInstantiator, DirectBufferDeallocator directBufferDeallocator)
-
systemDeallocateDirectByteBuffer
public final boolean systemDeallocateDirectByteBuffer(ByteBuffer directByteBuffer)
-
guaranteeUsability
public final void guaranteeUsability()
Description copied from interface:MemoryAccessorGuarantees the full usability of this class by validating if all functionality is usable.- Specified by:
guaranteeUsabilityin interfaceMemoryAccessor
-
getDirectByteBufferAddress
public final long getDirectByteBufferAddress(ByteBuffer directBuffer)
- Specified by:
getDirectByteBufferAddressin interfaceMemoryAccessor
-
deallocateDirectByteBuffer
public final boolean deallocateDirectByteBuffer(ByteBuffer directBuffer)
- Specified by:
deallocateDirectByteBufferin interfaceMemoryAccessor
-
isDirectByteBuffer
public final boolean isDirectByteBuffer(ByteBuffer byteBuffer)
- Specified by:
isDirectByteBufferin interfaceMemoryAccessor
-
guaranteeDirectByteBuffer
public final ByteBuffer guaranteeDirectByteBuffer(ByteBuffer directBuffer)
- Specified by:
guaranteeDirectByteBufferin interfaceMemoryAccessor
-
allocateMemory
public final long allocateMemory(long bytes)
- Specified by:
allocateMemoryin interfaceMemoryAccessor
-
reallocateMemory
public final long reallocateMemory(long address, long bytes)- Specified by:
reallocateMemoryin interfaceMemoryAccessor
-
freeMemory
public final void freeMemory(long address)
- Specified by:
freeMemoryin interfaceMemoryAccessor
-
lookupChainNonNull
public ByteBuffer[] lookupChainNonNull(int chunkSizeIndex, int chainIndex)
-
lookupChain
public ByteBuffer[] lookupChain(int chunkSizeIndex)
-
fillMemory
public final void fillMemory(long targetAddress, long length, byte value)- Specified by:
fillMemoryin interfaceMemoryAccessor
-
get_byte
public final byte get_byte(long address)
- Specified by:
get_bytein interfaceMemoryAccessor
-
get_boolean
public final boolean get_boolean(long address)
- Specified by:
get_booleanin interfaceMemoryAccessor
-
get_short
public final short get_short(long address)
- Specified by:
get_shortin interfaceMemoryAccessor
-
get_char
public final char get_char(long address)
- Specified by:
get_charin interfaceMemoryAccessor
-
get_int
public final int get_int(long address)
- Specified by:
get_intin interfaceMemoryAccessor
-
get_float
public final float get_float(long address)
- Specified by:
get_floatin interfaceMemoryAccessor
-
get_long
public final long get_long(long address)
- Specified by:
get_longin interfaceMemoryAccessor
-
get_double
public final double get_double(long address)
- Specified by:
get_doublein interfaceMemoryAccessor
-
get_byte
public final byte get_byte(Object instance, long offset)
- Specified by:
get_bytein interfaceMemoryAccessor
-
get_boolean
public final boolean get_boolean(Object instance, long offset)
- Specified by:
get_booleanin interfaceMemoryAccessor
-
get_short
public final short get_short(Object instance, long offset)
- Specified by:
get_shortin interfaceMemoryAccessor
-
get_char
public final char get_char(Object instance, long offset)
- Specified by:
get_charin interfaceMemoryAccessor
-
get_int
public final int get_int(Object instance, long offset)
- Specified by:
get_intin interfaceMemoryAccessor
-
get_float
public final float get_float(Object instance, long offset)
- Specified by:
get_floatin interfaceMemoryAccessor
-
get_long
public final long get_long(Object instance, long offset)
- Specified by:
get_longin interfaceMemoryAccessor
-
get_double
public final double get_double(Object instance, long offset)
- Specified by:
get_doublein interfaceMemoryAccessor
-
getObject
public final Object getObject(Object instance, long offset)
- Specified by:
getObjectin interfaceMemoryAccessor
-
set_byte
public final void set_byte(long address, byte value)- Specified by:
set_bytein interfaceMemoryAccessor
-
set_boolean
public final void set_boolean(long address, boolean value)- Specified by:
set_booleanin interfaceMemoryAccessor
-
set_short
public final void set_short(long address, short value)- Specified by:
set_shortin interfaceMemoryAccessor
-
set_char
public final void set_char(long address, char value)- Specified by:
set_charin interfaceMemoryAccessor
-
set_int
public final void set_int(long address, int value)- Specified by:
set_intin interfaceMemoryAccessor
-
set_float
public final void set_float(long address, float value)- Specified by:
set_floatin interfaceMemoryAccessor
-
set_long
public final void set_long(long address, long value)- Specified by:
set_longin interfaceMemoryAccessor
-
set_double
public final void set_double(long address, double value)- Specified by:
set_doublein interfaceMemoryAccessor
-
set_byte
public final void set_byte(Object instance, long offset, byte value)
- Specified by:
set_bytein interfaceMemoryAccessor
-
set_boolean
public final void set_boolean(Object instance, long offset, boolean value)
- Specified by:
set_booleanin interfaceMemoryAccessor
-
set_short
public final void set_short(Object instance, long offset, short value)
- Specified by:
set_shortin interfaceMemoryAccessor
-
set_char
public final void set_char(Object instance, long offset, char value)
- Specified by:
set_charin interfaceMemoryAccessor
-
set_int
public final void set_int(Object instance, long offset, int value)
- Specified by:
set_intin interfaceMemoryAccessor
-
set_float
public final void set_float(Object instance, long offset, float value)
- Specified by:
set_floatin interfaceMemoryAccessor
-
set_long
public final void set_long(Object instance, long offset, long value)
- Specified by:
set_longin interfaceMemoryAccessor
-
set_double
public final void set_double(Object instance, long offset, double value)
- Specified by:
set_doublein interfaceMemoryAccessor
-
setObject
public final void setObject(Object instance, long offset, Object value)
- Specified by:
setObjectin interfaceMemoryAccessor
-
set_byteInBytes
public final void set_byteInBytes(byte[] bytes, int index, byte value)- Specified by:
set_byteInBytesin interfaceMemoryAccessor
-
set_booleanInBytes
public final void set_booleanInBytes(byte[] bytes, int index, boolean value)- Specified by:
set_booleanInBytesin interfaceMemoryAccessor
-
set_shortInBytes
public final void set_shortInBytes(byte[] bytes, int index, short value)- Specified by:
set_shortInBytesin interfaceMemoryAccessor
-
set_charInBytes
public final void set_charInBytes(byte[] bytes, int index, char value)- Specified by:
set_charInBytesin interfaceMemoryAccessor
-
set_intInBytes
public final void set_intInBytes(byte[] bytes, int index, int value)- Specified by:
set_intInBytesin interfaceMemoryAccessor
-
set_floatInBytes
public final void set_floatInBytes(byte[] bytes, int index, float value)- Specified by:
set_floatInBytesin interfaceMemoryAccessor
-
set_longInBytes
public final void set_longInBytes(byte[] bytes, int index, long value)- Specified by:
set_longInBytesin interfaceMemoryAccessor
-
set_doubleInBytes
public final void set_doubleInBytes(byte[] bytes, int index, double value)- Specified by:
set_doubleInBytesin interfaceMemoryAccessor
-
copyRange
public final void copyRange(long sourceAddress, long targetAddress, long length)- Specified by:
copyRangein interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, byte[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, boolean[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, short[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, char[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, int[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, float[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, long[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyRangeToArray
public final void copyRangeToArray(long sourceAddress, double[] target)- Specified by:
copyRangeToArrayin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(byte[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(boolean[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(short[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(char[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(int[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(float[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(long[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
copyArrayToAddress
public final void copyArrayToAddress(double[] array, long targetAddress)- Specified by:
copyArrayToAddressin interfaceMemoryAccessor
-
objectFieldOffset
public final long objectFieldOffset(Field field)
Returns an unspecified, abstract "offset" of the passedFieldto specify a generic access of the field's value for an instance of its declaring class that can be used with object-based methods likeset_int(Object,long,int). Whether that offset is an actual low-level memory offset relative to an instance' field offset base or simply an index of the passed field in its declaring class' list of fields, is implementation-specific.- Specified by:
objectFieldOffsetin interfaceMemoryAccessor- Parameters:
field- theFieldwhose abstract offset shall be determined.- Returns:
- the passed
Field's abstract offset.
-
determineMostSpecificDeclaringClass
public static final Class<?> determineMostSpecificDeclaringClass(Field[] fields)
-
objectFieldOffsets
public final long[] objectFieldOffsets(Field... fields)
Array alias vor #objectFieldOffset(Field).- Specified by:
objectFieldOffsetsin interfaceMemoryAccessor
-
objectFieldOffset
public final long objectFieldOffset(Class<?> objectClass, Field field)
Description copied from interface:MemoryAccessorSimilar toMemoryAccessor.objectFieldOffset(Field), but with the specific object class.
The difference is that the actual object's class is not the declaring class of its fields if it only extends another class but does not declare an object field itself.- Specified by:
objectFieldOffsetin interfaceMemoryAccessor- Returns:
-
objectFieldOffsets
public final long[] objectFieldOffsets(Class<?> objectClass, Field... fields)
Description copied from interface:MemoryAccessorArray alias vor #objectFieldOffset(Class, Field).- Specified by:
objectFieldOffsetsin interfaceMemoryAccessor
-
ensureClassInitialized
public final void ensureClassInitialized(Class<?> c)
- Specified by:
ensureClassInitializedin interfaceMemoryAccessor
-
ensureClassInitialized
public final void ensureClassInitialized(Class<?> c, Iterable<Field> usedFields)
Description copied from interface:MemoryAccessorUses the passed fields if required by the implementation. If not, this method behaves exactely likeMemoryAccessor.ensureClassInitialized(Class).- Specified by:
ensureClassInitializedin interfaceMemoryAccessor
-
instantiateBlank
public final <T> T instantiateBlank(Class<T> c) throws InstantiationRuntimeException
- Specified by:
instantiateBlankin interfaceMemoryAccessor- Throws:
InstantiationRuntimeException
-
toReversing
public final MemoryAccessor toReversing()
- Specified by:
toReversingin interfaceMemoryAccessor
-
-