Class AlignedStructurePacker

  • Direct Known Subclasses:
    AlignedStructureInspector

    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)
        Constructor.
        Parameters:
        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.
        Parameters:
        structure - structure whose members are to be aligned/packed.
        components - structure components (excludes any trailing flexible array).
        Returns:
        aligned packing result