/** Returns the calculated offset of the given field. * @param name field to examine * @return return offset of the given field */ protected int fieldOffset(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); return f.offset; }
/** Write the given field to native memory. The current value in the Java * field will be translated into native memory. * @param name which field to synch * @throws IllegalArgumentException if no field exists with the given name */ public void writeField(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); writeField(f); }
/** Force a read of the given field from native memory. The Java field * will be updated from the current contents of native memory. * @param name field to be read * @return the new field value, after updating * @throws IllegalArgumentException if no field exists with the given name */ public Object readField(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); return readField(f); }
/** Write the given field value to the field and native memory. The * given value will be written both to the Java field and the * corresponding native memory. * @param name field to write * @param value value to write * @throws IllegalArgumentException if no field exists with the given name */ public void writeField(String name, Object value) { ensureAllocated(); StructField structField = fields().get(name); if (structField == null) throw new IllegalArgumentException("No such field: " + name); setFieldValue(structField.field, value); writeField(structField); }
private FFIType(Structure ref) { Pointer[] els; ref.ensureAllocated(true); if (ref instanceof Union) { StructField sf = ((Union)ref).typeInfoField(); els = new Pointer[] { get(ref.getFieldValue(sf.field), sf.type), null, }; } else { els = new Pointer[ref.fields().size() + 1]; int idx = 0; for (StructField sf : ref.fields().values()) { els[idx++] = ref.getFieldTypeInfo(sf); } } init(els); } // Represent fixed-size arrays as structures of N identical elements
try { for (StructField sf : fields().values()) { if (!sf.isVolatile) { writeField(sf);
contents = "...}"; else for (Iterator<StructField> i = fields().values().iterator(); i.hasNext();) { StructField sf = i.next(); Object value = getFieldValue(sf.field);
for (StructField structField : fields().values()) { readField(structField);
/** Returns the calculated offset of the given field. * @param name field to examine * @return return offset of the given field */ protected int fieldOffset(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); return f.offset; }
/** Write the given field to native memory. The current value in the Java * field will be translated into native memory. * @param name which field to synch * @throws IllegalArgumentException if no field exists with the given name */ public void writeField(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); writeField(f); }
/** Force a read of the given field from native memory. The Java field * will be updated from the current contents of native memory. * @param name field to be read * @return the new field value, after updating * @throws IllegalArgumentException if no field exists with the given name */ public Object readField(String name) { ensureAllocated(); StructField f = fields().get(name); if (f == null) throw new IllegalArgumentException("No such field: " + name); return readField(f); }
/** Write the given field value to the field and native memory. The * given value will be written both to the Java field and the * corresponding native memory. * @param name field to write * @param value value to write * @throws IllegalArgumentException if no field exists with the given name */ public void writeField(String name, Object value) { ensureAllocated(); StructField structField = fields().get(name); if (structField == null) throw new IllegalArgumentException("No such field: " + name); setFieldValue(structField.field, value); writeField(structField); }
private FFIType(Structure ref) { Pointer[] els; ref.ensureAllocated(true); if (ref instanceof Union) { StructField sf = ((Union)ref).typeInfoField(); els = new Pointer[] { get(ref.getFieldValue(sf.field), sf.type), null, }; } else { els = new Pointer[ref.fields().size() + 1]; int idx = 0; for (StructField sf : ref.fields().values()) { els[idx++] = ref.getFieldTypeInfo(sf); } } init(els); } // Represent fixed-size arrays as structures of N identical elements
contents = "...}"; else for (Iterator<StructField> i = fields().values().iterator(); i.hasNext();) { StructField sf = i.next(); Object value = getFieldValue(sf.field);
try { for (StructField sf : fields().values()) { if (!sf.isVolatile) { writeField(sf);
for (StructField structField : fields().values()) { readField(structField);