private void encodePointerRelative(Encoder encoder, TypeDef type, long offset,
			AddressSpace space) throws IOException {
		Pointer pointer = (Pointer) type.getBaseDataType();
		encoder.openElement(ELEM_TYPE);
		encoder.writeString(ATTRIB_METATYPE, "ptrrel");
		encodeNameIdAttributes(encoder, type);
		encoder.writeSignedInteger(ATTRIB_SIZE, pointer.getLength());
		if (pointerWordSize != 1) {
			encoder.writeUnsignedInteger(ATTRIB_WORDSIZE, pointerWordSize);
		}
		if (space != null) {
			encoder.writeSpace(ATTRIB_SPACE, space);
		}
		DataType parent = pointer.getDataType();
		DataType ptrto = findPointerRelativeInner(parent, (int) offset);
		encodeTypeRef(encoder, ptrto, 1);
		encodeTypeRef(encoder, parent, 1);
		encoder.openElement(ELEM_OFF);
		encoder.writeSignedInteger(ATTRIB_CONTENT, offset);
		encoder.closeElement(ELEM_OFF);
		encoder.closeElement(ELEM_TYPE);
	}
Encode a pointer with an associated offset relative to a base data-type to stream.
The pointer is encoded as a TypeDef (of a Pointer). The "pointed to" object is the base data-type,
the relative offset is passed in, and other properties come from the TypeDef.
@param encoder is the stream encoder
@param type is the TypeDef encoding the relative pointer
@param offset is the relative offset (already extracted from the TypeDef)
@param space if non-null, is a specific address space associated with the pointer
@throws IOException for errors in the underlying stream
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/pcode/PcodeDataTypeManager.java