/** * Writes float to specific location in pipe * @param pipe to be written to * @param loc location to write * @param value float to be written * @param places to write values in */ public static void writeFloat(Pipe pipe, int loc, float value, int places) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); Pipe.setValues(Pipe.slab(pipe), pipe.slabMask, structuredPositionForLOC(pipe, loc), -places, (long)Math.rint(value*powd[64+places])); }
/** * Writes double to specific location in pipe * @param pipe to be written to * @param loc location to write * @param value double to be written * @param places to write values in */ public static void writeDouble(Pipe pipe, int loc, double value, int places) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); Pipe.setValues(Pipe.slab(pipe), pipe.slabMask, structuredPositionForLOC(pipe, loc), -places, (long)Math.rint(value*powd[64+places])); }
/** * Writes float to specific location in pipe * @param pipe to be written to * @param loc location to write * @param value float to be written * @param places to write values in */ public static void writeFloat(Pipe pipe, int loc, float value, int places) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); Pipe.setValues(Pipe.slab(pipe), pipe.slabMask, structuredPositionForLOC(pipe, loc), -places, (long)Math.rint(value*powd[64+places])); }
/** * Writes double to specific location in pipe * @param pipe to be written to * @param loc location to write * @param value double to be written * @param places to write values in */ public static void writeDouble(Pipe pipe, int loc, double value, int places) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); Pipe.setValues(Pipe.slab(pipe), pipe.slabMask, structuredPositionForLOC(pipe, loc), -places, (long)Math.rint(value*powd[64+places])); }
/** * Writes float to specific location in pipe * @param pipe to be written to * @param loc location to write * @param value float to be written * @param places to write values in */ public static void writeFloat(Pipe pipe, int loc, float value, int places) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); Pipe.setValues(Pipe.slab(pipe), pipe.slabMask, structuredPositionForLOC(pipe, loc), -places, (long)Math.rint(value*powd[64+places])); }
/** * Writes double to specific location in pipe * @param pipe to be written to * @param loc location to write * @param value double to be written * @param places to write values in */ public static void writeDouble(Pipe pipe, int loc, double value, int places) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); Pipe.setValues(Pipe.slab(pipe), pipe.slabMask, structuredPositionForLOC(pipe, loc), -places, (long)Math.rint(value*powd[64+places])); }
/** * Writes decimal to specified pipe * @param pipe to be written to * @param loc location to write to */ public static void writeDecimal(Pipe pipe, int loc, int exponent, long mantissa) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); int[] buffer = Pipe.slab(pipe); int rbMask = pipe.slabMask; long p = structuredPositionForLOC(pipe, loc); assert(p+2L <= pipe.ringWalker.nextWorkingHead-1L) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe); buffer[rbMask & (int)p++] = exponent; buffer[rbMask & (int)p++] = (int) (mantissa >>> 32); buffer[rbMask & (int)p] = (int)mantissa & 0xFFFFFFFF; }
/** * Writes decimal to specified pipe * @param pipe to be written to * @param loc location to write to */ public static void writeDecimal(Pipe pipe, int loc, int exponent, long mantissa) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); int[] buffer = Pipe.slab(pipe); int rbMask = pipe.slabMask; long p = structuredPositionForLOC(pipe, loc); assert(p+2L <= pipe.ringWalker.nextWorkingHead-1L) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe); buffer[rbMask & (int)p++] = exponent; buffer[rbMask & (int)p++] = (int) (mantissa >>> 32); buffer[rbMask & (int)p] = (int)mantissa & 0xFFFFFFFF; }
/** * Writes decimal to specified pipe * @param pipe to be written to * @param loc location to write to */ public static void writeDecimal(Pipe pipe, int loc, int exponent, long mantissa) { assert((loc&0x1E<<OFF_BITS)==(0x0C<<OFF_BITS)) : "Expected to write some type of decimal but found "+TypeMask.toString((loc>>OFF_BITS)&TokenBuilder.MASK_TYPE); int[] buffer = Pipe.slab(pipe); int rbMask = pipe.slabMask; long p = structuredPositionForLOC(pipe, loc); assert(p+2L <= pipe.ringWalker.nextWorkingHead-1L) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe); buffer[rbMask & (int)p++] = exponent; buffer[rbMask & (int)p++] = (int) (mantissa >>> 32); buffer[rbMask & (int)p] = (int)mantissa & 0xFFFFFFFF; }
/** * Writes int to specified pipe * @param pipe pipe to be written to * @param loc location to write int * @param value int value to be written */ public static void writeInt(Pipe pipe, int loc, int value) { //allow for all types of int and for length assert(LOCUtil.isLocOfAnyType(loc, TypeMask.IntegerSigned, TypeMask.IntegerSignedOptional, TypeMask.IntegerUnsigned, TypeMask.IntegerUnsignedOptional, TypeMask.GroupLength)): "Value found "+LOCUtil.typeAsString(loc); long p = structuredPositionForLOC(pipe, loc); assert(p < pipe.ringWalker.nextWorkingHead-1L) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe); Pipe.slab(pipe)[pipe.slabMask & (int)p] = value; }
/** * Writes int to specified pipe * @param pipe pipe to be written to * @param loc location to write int * @param value int value to be written */ public static void writeInt(Pipe pipe, int loc, int value) { //allow for all types of int and for length assert(LOCUtil.isLocOfAnyType(loc, TypeMask.IntegerSigned, TypeMask.IntegerSignedOptional, TypeMask.IntegerUnsigned, TypeMask.IntegerUnsignedOptional, TypeMask.GroupLength)): "Value found "+LOCUtil.typeAsString(loc); long p = structuredPositionForLOC(pipe, loc); assert(p < pipe.ringWalker.nextWorkingHead-1L) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe); Pipe.slab(pipe)[pipe.slabMask & (int)p] = value; }
/** * Writes int to specified pipe * @param pipe pipe to be written to * @param loc location to write int * @param value int value to be written */ public static void writeInt(Pipe pipe, int loc, int value) { //allow for all types of int and for length assert(LOCUtil.isLocOfAnyType(loc, TypeMask.IntegerSigned, TypeMask.IntegerSignedOptional, TypeMask.IntegerUnsigned, TypeMask.IntegerUnsignedOptional, TypeMask.GroupLength)): "Value found "+LOCUtil.typeAsString(loc); long p = structuredPositionForLOC(pipe, loc); assert(p < pipe.ringWalker.nextWorkingHead-1L) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe); Pipe.slab(pipe)[pipe.slabMask & (int)p] = value; }
/** * Writes long to specified pipe * @param pipe to be updated * @param loc for the field to be updated * @param value long to write to specified location */ public static void writeLong(Pipe pipe, int loc, long value) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.LongSigned, TypeMask.LongSignedOptional, TypeMask.LongUnsigned, TypeMask.LongUnsignedOptional)): "Value found "+LOCUtil.typeAsString(loc); long p = structuredPositionForLOC(pipe, loc); assert(p+1L < pipe.ringWalker.nextWorkingHead) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe)+" Or message? "+ "\n next write position is "+p+" next limit is "+pipe.ringWalker.nextWorkingHead+ "\n Pipe "+pipe+ "\n loc "+loc; int[] buffer = Pipe.slab(pipe); int rbMask = pipe.slabMask; buffer[rbMask & (int)p] = (int)(value >>> 32); buffer[rbMask & (int)(p+1)] = (int)(value & 0xFFFFFFFF); }
/** * Writes long to specified pipe * @param pipe to be updated * @param loc for the field to be updated * @param value long to write to specified location */ public static void writeLong(Pipe pipe, int loc, long value) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.LongSigned, TypeMask.LongSignedOptional, TypeMask.LongUnsigned, TypeMask.LongUnsignedOptional)): "Value found "+LOCUtil.typeAsString(loc); long p = structuredPositionForLOC(pipe, loc); assert(p+1L < pipe.ringWalker.nextWorkingHead) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe)+" Or message? "+ "\n next write position is "+p+" next limit is "+pipe.ringWalker.nextWorkingHead+ "\n Pipe "+pipe+ "\n loc "+loc; int[] buffer = Pipe.slab(pipe); int rbMask = pipe.slabMask; buffer[rbMask & (int)p] = (int)(value >>> 32); buffer[rbMask & (int)(p+1)] = (int)(value & 0xFFFFFFFF); }
/** * Writes long to specified pipe * @param pipe to be updated * @param loc for the field to be updated * @param value long to write to specified location */ public static void writeLong(Pipe pipe, int loc, long value) { assert(LOCUtil.isLocOfAnyType(loc, TypeMask.LongSigned, TypeMask.LongSignedOptional, TypeMask.LongUnsigned, TypeMask.LongUnsignedOptional)): "Value found "+LOCUtil.typeAsString(loc); long p = structuredPositionForLOC(pipe, loc); assert(p+1L < pipe.ringWalker.nextWorkingHead) : "Is this field applicable for the this pipes schema? "+pipe.schemaName(pipe)+" Or message? "+ "\n next write position is "+p+" next limit is "+pipe.ringWalker.nextWorkingHead+ "\n Pipe "+pipe+ "\n loc "+loc; int[] buffer = Pipe.slab(pipe); int rbMask = pipe.slabMask; buffer[rbMask & (int)p] = (int)(value >>> 32); buffer[rbMask & (int)(p+1)] = (int)(value & 0xFFFFFFFF); }