Class DataDefinitionSeg

    • Field Detail

      • sLogger

        public static final org.slf4j.Logger sLogger
    • Constructor Detail

      • DataDefinitionSeg

        protected DataDefinitionSeg​(byte segtype)
    • Method Detail

      • fromClass

        public static DataDefinitionSeg fromClass​(java.lang.Class<?> element)
      • getSizeImpl

        protected abstract int getSizeImpl​(DataContext ctx)
        Return the number of bytes occupied by a single instance of the given data type. When the data is indirect, size is zero. When the data is variable length, size is -1;
        Returns:
        Number of bytes.
      • nestedSizeImpl

        protected int nestedSizeImpl​(DataContext ctx)
        Certain types (Omron strings and booleans) can have different encodings when packed into structures.
      • minSize

        public int minSize​(DataContext ctx)
        Some data types need to offer a range of sizes for the encoded form of their data. The common case is fixed.
        Returns:
      • nestedMinSize

        public int nestedMinSize​(DataContext ctx)
        Certain types (Omron strings and booleans) can have different encodings when packed into structures.
      • maxSize

        public int maxSize​(DataContext ctx)
        Some data types need to offer a range of sizes for the encoded form of their data. The common case is fixed.
        Returns:
      • nestedMaxSize

        public int nestedMaxSize​(DataContext ctx)
        Certain types (Omron strings and booleans) can have different encodings when packed into structures.
      • alignment

        public int alignment​(DataContext ctx)
        Alignment is normally the natural size of a primitive element. Structured types and variable length types must override this method.
        Returns:
      • getSize

        public int getSize​(DataContext ctx,
                           int... dims)
        Return the number of bytes occupied by the given data type. When the data is indirect (hosted elsewhere), or variable length, size is -1.

        When dimensions are provided, compute the bytes the complete array will occupy. Otherwise report the size of a singleton.

        Returns:
        Number of bytes.
      • nestedSize

        public int nestedSize​(DataContext ctx,
                              int... dims)
        Certain types (Omron strings and booleans) can have different encodings when packed into structures.
      • isBoolHost

        public boolean isBoolHost()
        Some elementary data types (the integer and word types) can be hosts for named bits within structures. This method is overridden in the necessary places to support this. It corresponds to subclasses of BaseDataType that implement the BoolHost interface.
        Returns:
      • isBoolImpl

        public boolean isBoolImpl()
        Size calculations for boolean min and max must defer to .getSize() to get the right answer for boolean arrays.
        Returns:
      • isStringData

        public boolean isStringData()
        Mark string implementations for special handling.
        Returns:
      • construct

        public BaseDataType<?> construct​(DataContext ctx)
        Construct an instance of the type represented by this definition. Use the provided context to look up any ambiguous data types.
        Parameters:
        ctx -
        Returns:
      • construct

        protected abstract BaseDataType<?> construct​(int[] dimensions,
                                                     DataContext ctx)
        Construct an instance of the type represented by this definition, using the given dimensions. This is an implementation detail that permits a DecoratedDefSeg to create arrays.

        Use the provided context to look up any ambiguous data types.

        Parameters:
        dimensions -
        ctx -
        Returns:
      • getPermItem

        public PermissionedItem getPermItem()
        Support permissions tracking as a general feature. This is overridden where appropriate.
        Returns:
      • follow

        public DecoratedDefSeg follow​(PathSegment seg,
                                      DataContext ctx)
        Step into this type definition by the given selector, returning the inner type definition. Look up inner types with the given context.
        Parameters:
        seg -
        ctx -
        Returns:
      • followOffsets

        public DataDefinitionSeg.DataDefinitionFragment followOffsets​(java.lang.Integer outerByteOffset,
                                                                      PathSegment seg,
                                                                      DataContext ctx)
        Step into this type definition by the given selector, returning the inner type definition. Look up inner types with the given context. Deliver a null byteOffset if unknowable.
        Parameters:
        outerByteOffset -
        seg -
        ctx -
        Returns: