Class DataPathResolver


  • public class DataPathResolver
    extends java.lang.Object
    • Field Detail

      • dims

        public int[] dims
      • indices

        public int[] indices
      • bit

        public int bit
      • totalBytes

        public int totalBytes
      • priorBytes

        public int priorBytes
      • indirects

        protected int[] indirects
    • Method Detail

      • follow

        public static CipObject follow​(CipObject appContext,
                                       CipPath path,
                                       int nesting)
        Follow a given CIP path chain from a root element, usually a CipDevice or CipDeviceMirror, to the specific CipObject.

        If a segment is encountered that cannot be followed directly, a CipPathFollowException is thrown with the details, including the last CipObject lookup and the index in the path of the failed segment.

        The first segment of the path may be a Port Segment targeting another slot in the virtual backplane, as long as the root element is a CipDevice instance.

        Parameters:
        appContext - The root element of the search
        path - The list of path segments to follow
        nesting - The number of path segments to skip
        Returns:
        The selected CipObject
      • resolve

        public static DataPathResolver resolve​(CipObject appContext,
                                               CipPath path,
                                               int nesting)
        Follow a CIP Path chain from a root element, usually a CipDevice or CipDeviceMirror, to a specific data element. The last followed CipObject must implement the DataWrapper interface.
        Parameters:
        appContext - The root element of the search
        path - The list of path segments to follow
        nesting - The number of path segments to skip
        Returns:
        The resolver object identifying the specific Cip Data Object and its subscripts.
      • newSubscript

        public boolean newSubscript()
        Determine if any indirect subscript has changed in the path to the data.
        Returns:
        True if callers need to re-resolve the path.
      • incrementIndex

        public boolean incrementIndex()
        Increment the final indices, rolling over inner dimensions. Indicate if the outermost dimension overflows.
        Returns:
        True if an overflow or if not applicable
      • getOffset

        public int getOffset()
        Obtain the resolved element's byte offset within the outermost data object's complete payload. Not valid when variable-length elements are prior to the resolved element, nor when accessing individual bits.
        Returns:
        Byte offset or -1 when invalid.
      • asSubscripted

        public BaseDataType<?> asSubscripted()
        Obtain the data with the resolved indices encapsulated. Needed to properly support assemblies containing elements of arrays or structures.
        Returns:
        A data item that is a view into the final resolved data item. If no indices are present, then this will be the same object as returned in .data.
      • toString

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