encoder.js
function encodeArray_PRIM_BULK_PLAIN( encoder, data, properties ) {

	//
	// Bulk Array of Primitives (PRIM_BULK_PLAIN)
	//
	// ........ + Signature ID
	// 01111000     [16-bit]
	//

	// Lookup signature
	var eid = encoder.getSignatureID( properties ), weave = [];
	encoder.counters.arr_prim_bulk_plain+=1;
	encoder.log(LOG.ARR, "array.prim.bulk_plain, len="+data.length+
		", signature="+properties.toString()+
		", eid="+eid+" [");
	encoder.logIndent(1);

	// Put header
	encoder.stream8.write( pack1b( ARR_OP.PRIM_BULK_PLAIN ) );
	encoder.stream16.write( pack2b( eid, false ) );
	encoder.counters.arr_hdr+=3;

	// Write bulked properties
	var weaveArrays = [];
	for (var i=0, pl=properties.length; i<pl; ++i) {

		// Read property of all entries
		var prop = [], p = properties[i];
		for (var j=0, el=data.length; j<el; ++j) {
			weaveArrays.push( data[j][p] );
		}

	}

	// Encode cmpact weaved array
	encodeArray( encoder, weaveArrays );

	// Close log group
	encoder.logIndent(-1);
	encoder.log(LOG.ARR, "]");

}
function encodeArray_PRIM_BULK_PLAIN( encoder, data, properties ) {

	//
	// Bulk Array of Primitives (PRIM_BULK_PLAIN)
	//
	// ........ + Signature ID
	// 01111000     [16-bit]
	//

	// Lookup signature
	var eid = encoder.getSignatureID( properties ), weave = [];
	encoder.counters.arr_prim_bulk_plain+=1;
	encoder.log(LOG.ARR, "array.prim.bulk_plain, len="+data.length+
		", signature="+properties.toString()+
		", eid="+eid+" [");
	encoder.logIndent(1);

	// Put header
	encoder.stream8.write( pack1b( ARR_OP.PRIM_BULK_PLAIN ) );
	encoder.stream16.write( pack2b( eid, false ) );
	encoder.counters.arr_hdr+=3;

	// Write bulked properties
	var weaveArrays = [];
	for (var i=0, pl=properties.length; i<pl; ++i) {

		// Read property of all entries
		var prop = [], p = properties[i];
		for (var j=0, el=data.length; j<el; ++j) {
			weaveArrays.push( data[j][p] );
		}

	}

	// Encode cmpact weaved array
	encodeArray( encoder, weaveArrays );

	// Close log group
	encoder.logIndent(-1);
	encoder.log(LOG.ARR, "]");

}
function encodeArray_PRIM_BULK_PLAIN ( encoder , data , properties ) { // // Bulk Array of Primitives (PRIM_BULK_PLAIN) // // ........ + Signature ID // 01111000     [16-bit] // // Lookup signature var eid = encoder . getSignatureID ( properties ) , weave = [ ] ; encoder . counters . arr_prim_bulk_plain += 1 ; encoder . log ( LOG . ARR , "array.prim.bulk_plain, len=" + data . length + ", signature=" + properties . toString ( ) + ", eid=" + eid + " [" ) ; encoder . logIndent ( 1 ) ; // Put header encoder . stream8 . write ( pack1b ( ARR_OP . PRIM_BULK_PLAIN ) ) ; encoder . stream16 . write ( pack2b ( eid , false ) ) ; encoder . counters . arr_hdr += 3 ; // Write bulked properties var weaveArrays = [ ] ; for ( var i = 0 , pl = properties . length ; i < pl ; ++ i ) { // Read property of all entries var prop = [ ] , p = properties [ i ] ; for ( var j = 0 , el = data . length ; j < el ; ++ j ) { weaveArrays . push ( data [ j ] [ p ] ) ; } } // Encode cmpact weaved array encodeArray ( encoder , weaveArrays ) ; // Close log group encoder . logIndent ( - 1 ) ; encoder . log ( LOG . ARR , "]" ) ; }
Encode array data as bulk of plain objects
Encode array data as bulk of plain objects