/** * Indirect this reference. This method determines the appropriate reference when using a * pointer-decayed type. For arrays and functions, it simly returns this reference. For all other * types, it returns an indirect reference, with this reference as the base. * * @param type The reference's declared type (before pointer decay). */ public Reference indirect(Type type) { Type resolved = type.resolve(); if (resolved.isArray() || resolved.isFunction()) { return this; } else { return new IndirectReference(this); } }
/** * Create a new reference. Note that this constructor resolves the specified type and strips any * arrays. * * @param type The type. */ public Reference(Type type) { type = type.resolve(); while (type.isArray()) { type = type.toArray().getType().resolve(); } this.type = type; }
protected HostAPI(ByteBuffer data) { defaultInputDevice = data.get(); defaultOutputDevice = data.get(); deviceCount = data.get(); id = data.get(); type = Type.resolve(data.get()); final byte[] bytes = new byte[data.get()]; data.get(bytes); this.name = new String(bytes); }