composeStructureArray static method
DC
composeStructureArray(
- List<
Structure> ? structures, - DistributedConnection connection, [
- bool prependLength = false
Implementation
static DC composeStructureArray(
List<Structure>? structures, DistributedConnection connection,
[bool prependLength = false]) {
if (structures == null || structures.length == 0)
return prependLength ? new DC(4) : new DC(0);
var rt = new BinaryList();
var comparsion = StructureComparisonResult.Structure;
rt
..addUint8(comparsion)
..addDC(composeStructure(structures[0], connection, true, true, true));
for (var i = 1; i < structures.length; i++) {
comparsion =
compareStructures(structures[i - 1], structures[i], connection);
rt.addUint8(comparsion);
if (comparsion == StructureComparisonResult.Structure)
rt.addDC(composeStructure(structures[i], connection, true, true, true));
else if (comparsion == StructureComparisonResult.StructureSameKeys)
rt.addDC(
composeStructure(structures[i], connection, false, true, true));
else if (comparsion == StructureComparisonResult.StructureSameTypes)
rt.addDC(
composeStructure(structures[i], connection, false, false, true));
}
if (prependLength) rt.insertInt32(0, rt.length);
return rt.toDC();
}