Class DataPathResolver
- java.lang.Object
-
- com.automation_pros.odva.cip.data.DataPathResolver
-
public class DataPathResolver extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description int
bit
BaseDataType<?>
data
BaseDataType<?>
data0
protected BaseDataType<?>
data1
int[]
dims
int[]
indices
protected DataPathResolver[]
indirectdprs
protected int[]
indirects
CipPath
path
int
priorBytes
int
totalBytes
CipObject
wrapper
-
Constructor Summary
Constructors Modifier Constructor Description DataPathResolver(CipObject root)
protected
DataPathResolver(CipObject appContext, BaseDataType<?> root, CipPath path, int nesting)
DataPathResolver(CipObject appContext, CipObject root, CipPath path, int nesting)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseDataType<?>
asSubscripted()
Obtain the data with the resolved indices encapsulated.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.int
getOffset()
Obtain the resolved element's byte offset within the outermost data object's complete payload.boolean
incrementIndex()
Increment the final indices, rolling over inner dimensions.boolean
newSubscript()
Determine if any indirect subscript has changed in the path to the data.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.java.lang.String
toString()
-
-
-
Field Detail
-
wrapper
public CipObject wrapper
-
data0
public BaseDataType<?> data0
-
data
public BaseDataType<?> data
-
data1
protected BaseDataType<?> data1
-
path
public CipPath path
-
dims
public int[] dims
-
indices
public int[] indices
-
bit
public int bit
-
totalBytes
public int totalBytes
-
priorBytes
public int priorBytes
-
indirects
protected int[] indirects
-
indirectdprs
protected DataPathResolver[] indirectdprs
-
-
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 searchpath
- The list of path segments to follownesting
- 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 searchpath
- The list of path segments to follownesting
- 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 classjava.lang.Object
-
-