Class AlignedStructurePacker

  • Direct Known Subclasses:

    public class AlignedStructurePacker
    extends java.lang.Object
    AlignedStructurePacker provides support for performing aligned packing of Structure components.

    NOTE: We currently have no way of conveying or supporting explicit bitfield component pragmas supported by some compilers (e.g., bit_field_size, bit_field_align, bit_packing).

    • Constructor Detail

      • AlignedStructurePacker

        protected AlignedStructurePacker​(Structure structure,
                                         java.util.List<? extends InternalDataTypeComponent> components)
        structure - structure whose components need to be packed and updated during packing (ordinal, offset, length and bit-field datatypes may be modified)
        components - list of mutable component
    • Method Detail

      • packComponents

        public static AlignedStructurePacker.StructurePackResult packComponents​(Structure structure,
                                                                                java.util.List<? extends InternalDataTypeComponent> components)
        Perform structure component packing. Specified components may be updated to reflect packing (ordinal, offset, length and bit-field datatypes may be modified). The caller is responsible for updating structure length and component count based upon returned result. Component count is should only change if component list includes DEFAULT members which will be ignored.
        structure - structure whose members are to be aligned/packed.
        components - structure components (excludes any trailing flexible array).
        aligned packing result