Class OmronProbeContext.OmTypeCache

  • Enclosing class:
    OmronProbeContext

    public class OmronProbeContext.OmTypeCache
    extends java.lang.Object
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getDefinition

        public StructDef getDefinition()
        Obtain a usable Omron-format template definition from this reported type's members. This operation will simultaneously lay out the type using NJ format and CJ format, delivering the one that yields the proper total size.

        NJ format uses maxAlign=8 and individual instances of CipBOOL16.

        CJ format uses maxAlign=2 and hosts consecutive booleans in a CipWORD as needed.

        Omron's probe format does not expose any information about user layouts so those will be incorrect or throw an exception for an invalid total size.

        Returns:
      • setDefinition

        public void setDefinition​(PermStructDef userDef)
        When a type with user alignment is known to be present, the correct structure definition can be supplied if known by other means. This routine verifies that the supplied StructDef does in fact have the correct size, and that it has a member for each of the probed member names. Member types are deliberately not required to match.
        Parameters:
        userDef - The substitute structure definition to use instead of the automatically constructed definition for this type.
      • isSizeMatch

        public boolean isSizeMatch()
        Omron's type and member instances do not expose enough information to support the user alignment type, and can only distinguish NJ format from CJ format by checking the allocation (size) value. If neither NJ nor CJ match the specified allocation, then the placement of members in the type is ambiguous and the full structure cannot be used as a decoder.

        Note that a user type can be created that follows neither NJ nor CJ alignment, but happens to match one or the other sizes. This cannot be detected by the probe algorithm. Do not expect User alignment to work without supplying a substitute structure.

        Returns:
        True if the StructDef for this type matches the probed size.