/** Set the memory used by this structure. This method is used to * indicate the given structure is nested within another or otherwise * overlaid on some other memory block and thus does not own its own * memory. * @param m Memory to with which to back this {@link Structure}. */ protected void useMemory(Pointer m) { useMemory(m, 0); }
/** Set the memory used by this structure. This method is used to * indicate the given structure is based on natively-allocated data, * nested within another, or otherwise overlaid on existing memory and * thus does not own its own memory allocation. * @param m Base memory to use to back this structure. * @param offset offset into provided memory where structure mapping * should start. */ protected void useMemory(Pointer m, int offset) { useMemory(m, offset, false); }
protected Structure(Pointer p, int alignType, TypeMapper mapper) { setAlignType(alignType); setStringEncoding(Native.getStringEncoding(getClass())); initializeTypeMapper(mapper); validateFields(); if (p != null) { useMemory(p, 0, true); } else { allocateMemory(CALCULATE_SIZE); } initializeFields(); }
s.useMemory(this, (int)offset, true); s.write();
int requiredSize = array.length * size(); if (m.size() < requiredSize) { useMemory(autoAllocate(requiredSize));
/** Set the memory used by this structure. This method is used to * indicate the given structure is nested within another or otherwise * overlaid on some other memory block and thus does not own its own * memory. * @param m Memory to with which to back this {@link Structure}. */ protected void useMemory(Pointer m) { useMemory(m, 0); }
s = Structure.updateStructureByReference((Class<Structure>) type, s, getPointer(offset)); } else { s.useMemory(this, (int)offset, true); s.read();
/** Set the memory used by this structure. This method is used to * indicate the given structure is based on natively-allocated data, * nested within another, or otherwise overlaid on existing memory and * thus does not own its own memory allocation. * @param m Base memory to use to back this structure. * @param offset offset into provided memory where structure mapping * should start. */ protected void useMemory(Pointer m, int offset) { useMemory(m, offset, false); }
private static class MemberOrder { public int first; public int middle; public int last; }
protected Structure(Pointer p, int alignType, TypeMapper mapper) { setAlignType(alignType); setStringEncoding(Native.getStringEncoding(getClass())); initializeTypeMapper(mapper); validateFields(); if (p != null) { useMemory(p, 0, true); } else { allocateMemory(CALCULATE_SIZE); } initializeFields(); }
s.useMemory(this, (int)offset, true); s.write();
int requiredSize = array.length * size(); if (m.size() < requiredSize) { useMemory(autoAllocate(requiredSize));
s = Structure.updateStructureByReference(type, s, getPointer(offset)); } else { s.useMemory(this, (int)offset, true); s.read();