public final class StructLayout extends Type
| Modifier and Type | Class and Description |
|---|---|
static class |
StructLayout.ArrayField |
private static class |
StructLayout.ArrayFieldAllocator |
(package private) static class |
StructLayout.ArrayFieldIO |
static class |
StructLayout.ArrayProxy |
static class |
StructLayout.CharArrayProxy |
(package private) static class |
StructLayout.DefaultFieldIO |
static class |
StructLayout.EnumField |
private static class |
StructLayout.EnumFieldAllocator |
(package private) static class |
StructLayout.EnumFieldIO
Enum (maps :foo => 1, :bar => 2, etc)
|
static class |
StructLayout.Field |
private static class |
StructLayout.FieldAllocator |
(package private) static interface |
StructLayout.FieldIO |
static class |
StructLayout.FunctionField |
private static class |
StructLayout.FunctionFieldAllocator |
(package private) static class |
StructLayout.FunctionFieldIO |
static class |
StructLayout.InnerStructField |
private static class |
StructLayout.InnerStructFieldAllocator |
(package private) static class |
StructLayout.InnerStructFieldIO |
static class |
StructLayout.MappedField |
private static class |
StructLayout.MappedFieldAllocator |
(package private) static class |
StructLayout.MappedFieldIO |
static class |
StructLayout.Member
A struct member.
|
(package private) static class |
StructLayout.MultiDimensionArrayOp |
(package private) static class |
StructLayout.NullStorage |
static class |
StructLayout.NumberField |
private static class |
StructLayout.NumberFieldAllocator |
(package private) static class |
StructLayout.NumberFieldIO
Primitive (byte, short, int, long, float, double) types are all handled by
a PrimitiveMember type.
|
static class |
StructLayout.PointerField |
private static class |
StructLayout.PointerFieldAllocator |
(package private) static class |
StructLayout.PointerFieldIO |
static interface |
StructLayout.Storage |
(package private) static class |
StructLayout.StringField |
private static class |
StructLayout.StringFieldAllocator |
(package private) static class |
StructLayout.StringFieldIO |
Type.Array, Type.BuiltinRubyObject.DataRubyBasicObject.Finalizer| Modifier and Type | Field and Description |
|---|---|
private int |
cacheableFieldCount
The number of cacheable fields in this struct
|
(package private) static java.lang.String |
CLASS_NAME
The name to use to register this class in the JRuby runtime
|
private java.util.List<IRubyObject> |
fieldNames
The ordered list of field names (as symbols)
|
private java.util.List<StructLayout.Field> |
fields
The ordered list of fields
|
private StructLayout.Member[] |
identityLookupTable |
private boolean |
isUnion |
private java.util.Map<IRubyObject,StructLayout.Member> |
memberMap
The name:offset map for this struct
|
private java.util.Collection<StructLayout.Member> |
members
The ordered list of fields
|
(package private) static StructLayout.Storage |
nullStorage |
private int |
referenceFieldCount
The number of reference fields in this struct
|
alignment, nativeType, sizeFIELD_ALLOCATED_CLASSES, FIELD_ALLOCATORS, IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, OBJECT_VAR0_ALLOCATOR, OBJECT_VAR1_ALLOCATOR, OBJECT_VAR2_ALLOCATOR, OBJECT_VAR3_ALLOCATOR, OBJECT_VAR4_ALLOCATOR, OBJECT_VAR5_ALLOCATOR, OBJECT_VAR6_ALLOCATOR, OBJECT_VAR7_ALLOCATOR, OBJECT_VAR8_ALLOCATOR, OBJECT_VAR9_ALLOCATOR, REIFYING_OBJECT_ALLOCATORALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, STAMP_OFFSET, TAINTED_F, UNDEF, UNTRUSTED_F, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, VAR_TABLE_OFFSET, varTable, varTableStampNULL_ARRAY| Modifier | Constructor and Description |
|---|---|
private |
StructLayout(Ruby runtime,
RubyClass klass,
java.util.Collection<IRubyObject> fields,
int size,
int alignment)
Creates a new StructLayout instance.
|
| Modifier and Type | Method and Description |
|---|---|
IRubyObject |
aref(ThreadContext context,
IRubyObject fieldName) |
static RubyClass |
createStructLayoutClass(Ruby runtime,
RubyModule module)
Registers the StructLayout class in the JRuby runtime.
|
boolean |
equals(java.lang.Object o)
This method is just a wrapper around the Ruby "==" method,
provided so that RubyObjects can be used as keys in the Java
HashMap object underlying RubyHash.
|
IRubyObject |
fields(ThreadContext context) |
IRubyObject |
get(ThreadContext context,
IRubyObject ptr,
IRubyObject name)
Gets the value of the struct member corresponding to name.
|
private static MemoryOp |
getArrayComponentMemoryOp(Type.Array arrayType) |
(package private) int |
getCacheableFieldCount() |
(package private) int |
getCacheableFieldIndex(StructLayout.Member member) |
(package private) StructLayout.Field |
getField(Ruby runtime,
IRubyObject name)
Returns a
StructLayout.Field descriptor for a struct field. |
int |
getFieldCount() |
java.util.Collection<StructLayout.Field> |
getFields() |
(package private) StructLayout.Member |
getMember(Ruby runtime,
IRubyObject name)
Returns a
StructLayout.Member descriptor for a struct field. |
java.util.Collection<StructLayout.Member> |
getMembers() |
(package private) int |
getReferenceFieldCount() |
(package private) int |
getReferenceFieldIndex(StructLayout.Member member) |
int |
getSize() |
(package private) IRubyObject |
getValue(ThreadContext context,
IRubyObject name,
StructLayout.Storage cache,
IRubyObject ptr) |
int |
hashCode()
Override the Object#hashCode method to make sure that the Ruby
hash is actually used as the hashcode for Ruby objects.
|
boolean |
isUnion() |
IRubyObject |
members(ThreadContext context)
Gets a ruby array of the names of all members of this struct.
|
static IRubyObject |
newStructLayout(ThreadContext context,
IRubyObject klass,
IRubyObject[] args) |
private static int |
nextIndex(int idx,
int length) |
IRubyObject |
offset_of(ThreadContext context,
IRubyObject fieldName) |
IRubyObject |
offsets(ThreadContext context)
Gets a ruby array of the offsets of all members of this struct.
|
IRubyObject |
put(ThreadContext context,
IRubyObject ptr,
IRubyObject name,
IRubyObject value)
Sets the native value of the struct member corresponding to name.
|
(package private) void |
putValue(ThreadContext context,
IRubyObject name,
StructLayout.Storage cache,
IRubyObject ptr,
IRubyObject value) |
private static int |
symbolIndex(IRubyObject name,
int length) |
alignment, createTypeClass, getNativeAlignment, getNativeSize, getNativeType, getTypeClass, sizeattachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, createObjectClass, eqlInternal, equalInternal, getNativeTypeIndex, initialize, initialize, inspect, op_eqq, puts, specificEval, toStringaddFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkFrozen, checkStringType, checkStringType19, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, createBasicObjectClass, dataGetStruct, dataGetStructChecked, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, eql, equal_p, equal_p19, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMetaClass, getNativeHandle, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize_copy, initialize19, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval19, instance_eval19, instance_eval19, instance_eval19, instance_exec, instance_exec19, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, instance_variables19, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, method_missing19, method, method19, methods, methods, methods19, nil_p, op_cmp, op_equal_19, op_equal, op_match, op_match19, op_not_equal, op_not_match, op_not, private_methods, private_methods19, protected_methods, protected_methods19, public_methods, public_methods19, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respond_to_p19, respond_to_p19, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, send19, send19, send19, send19, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method_added19, singleton_method_removed19, singleton_method_undefined19, singleton_methods, singleton_methods19, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_s, toJava, trust, type_deprecated, type, untaint, untrust, untrusted_p, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnderstatic final StructLayout.Storage nullStorage
static final java.lang.String CLASS_NAME
private final StructLayout.Member[] identityLookupTable
private final java.util.Map<IRubyObject,StructLayout.Member> memberMap
private final java.util.List<IRubyObject> fieldNames
private final java.util.List<StructLayout.Field> fields
private final java.util.Collection<StructLayout.Member> members
private final int cacheableFieldCount
private final int referenceFieldCount
private final boolean isUnion
private StructLayout(Ruby runtime, RubyClass klass, java.util.Collection<IRubyObject> fields, int size, int alignment)
runtime - The runtime for the StructLayout.fields - The fields map for this struct.size - the total size of the struct.alignment - The minimum alignment required when allocating memory.public static RubyClass createStructLayoutClass(Ruby runtime, RubyModule module)
runtime - The JRuby runtime to register the new class in.public static final IRubyObject newStructLayout(ThreadContext context, IRubyObject klass, IRubyObject[] args)
public IRubyObject get(ThreadContext context, IRubyObject ptr, IRubyObject name)
ptr - The address of the structure in memory.name - The name of the member.public IRubyObject put(ThreadContext context, IRubyObject ptr, IRubyObject name, IRubyObject value)
ptr - The address of the structure in memory.name - The name of the member.public IRubyObject members(ThreadContext context)
public IRubyObject offsets(ThreadContext context)
public IRubyObject offset_of(ThreadContext context, IRubyObject fieldName)
public IRubyObject aref(ThreadContext context, IRubyObject fieldName)
public IRubyObject fields(ThreadContext context)
final IRubyObject getValue(ThreadContext context, IRubyObject name, StructLayout.Storage cache, IRubyObject ptr)
final void putValue(ThreadContext context, IRubyObject name, StructLayout.Storage cache, IRubyObject ptr, IRubyObject value)
public boolean equals(java.lang.Object o)
RubyObjectequals in class RubyObjectpublic int hashCode()
RubyObjecthashCode in class RubyObjectprivate static int symbolIndex(IRubyObject name, int length)
private static int nextIndex(int idx,
int length)
final StructLayout.Member getMember(Ruby runtime, IRubyObject name)
StructLayout.Member descriptor for a struct field.name - The name of the struct field.final StructLayout.Field getField(Ruby runtime, IRubyObject name)
StructLayout.Field descriptor for a struct field.name - The name of the struct field.public final int getSize()
final int getReferenceFieldCount()
final int getReferenceFieldIndex(StructLayout.Member member)
final int getCacheableFieldCount()
final int getCacheableFieldIndex(StructLayout.Member member)
public final int getFieldCount()
public final java.util.Collection<StructLayout.Field> getFields()
public final java.util.Collection<StructLayout.Member> getMembers()
public final boolean isUnion()
private static MemoryOp getArrayComponentMemoryOp(Type.Array arrayType)