Class AnonStructSeg
- java.lang.Object
-
- com.automation_pros.odva.cip.path.PathSegment
-
- com.automation_pros.odva.cip.path.DataDefinitionSeg
-
- com.automation_pros.odva.cip.path.StructDefSeg
-
- com.automation_pros.odva.cip.path.AnonStructSeg
-
- All Implemented Interfaces:
PathSegment.HasAlternateHex
,java.lang.Comparable<PathSegment>
public class AnonStructSeg extends StructDefSeg implements PathSegment.HasAlternateHex
Encapsulates an elementary data type annotation within a CIP Path definition. Type annotations are generally not passed on the wire, but delimit the path fragment that will go on the wire (before the data type) from the path fragment that will be applied to the payload on the wire.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AnonStructSeg.Decoder
Decode bytes expected to contain one encoded path segment.-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.path.StructDefSeg
StructDefSeg.Parser
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.path.DataDefinitionSeg
DataDefinitionSeg.DataDefinitionFragment
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.path.PathSegment
PathSegment.HasAlternateHex
-
-
Field Summary
Fields Modifier and Type Field Description protected int
alignment
static java.util.List<java.lang.Integer>
alignmentCodes
static java.util.List<java.lang.String>
alignmentTexts
static java.util.List<java.lang.String>
alignmentTokens
protected boolean
anyNamed
protected java.lang.Integer
cachedCRC
protected java.util.WeakHashMap<DataContext,StructDef>
cachedDefs
protected java.lang.Integer
CRC
protected int
memberBytes
protected java.util.List<DataDefinitionSeg>
members
protected java.lang.String
typeName
-
Fields inherited from class com.automation_pros.odva.cip.path.DataDefinitionSeg
sLogger
-
Fields inherited from class com.automation_pros.odva.cip.path.PathSegment
identifierChars, segtype
-
-
Constructor Summary
Constructors Constructor Description AnonStructSeg(int alignment)
AnonStructSeg(int alignment, java.util.List<? extends PathSegment> inner)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(DataDefinitionSeg member)
void
addAll(java.util.List<? extends PathSegment> inner)
java.lang.String
alternateHex(boolean padded)
int
compareTo(PathSegment o)
protected BaseDataType<?>
construct(int[] dimensions, DataContext ctx)
Construct an instance of the type represented by this definition, using the given dimensions.boolean
equals(java.lang.Object o)
int
getAlignment()
int
getBytes()
Obtain the number of bytes needed to encode this segment instance in packed format.java.lang.Integer
getCRC()
An anonymous structure definition will always have a CRC.StructDef
getDef(DataContext ctx)
static java.lang.String
getMemberName(DataDefinitionSeg member)
java.util.List<DataDefinitionSeg>
getMembers()
java.util.List<java.lang.String>
getTokens()
java.lang.String
getTypeName()
int
hashCode()
static void
main(java.lang.String[] args)
void
put(java.nio.ByteBuffer dest, boolean padded)
Encode the current instance to the given destination.PathSegment
set(java.nio.ByteBuffer source, boolean padded)
Replace the current instance content with the decoded source bytes.void
setAlignment(int alignment)
void
setCRC(int CRC)
void
setTypeName(java.lang.String typeName)
static java.lang.String
textForAlignment(int alignment)
static java.lang.String
tokenForAlignment(int alignment)
protected void
updateSegType()
-
Methods inherited from class com.automation_pros.odva.cip.path.StructDefSeg
alignment, browseInner, follow, followMember, followOffsets, getSizeImpl, maxSize, minSize, simpleString
-
Methods inherited from class com.automation_pros.odva.cip.path.DataDefinitionSeg
construct, fromClass, fromData, getPermItem, getSize, isBoolHost, isBoolImpl, isStringData, nestedMaxSize, nestedMinSize, nestedSize, nestedSizeImpl
-
Methods inherited from class com.automation_pros.odva.cip.path.PathSegment
decode, decodeAll, getSegtype, getWords, hexString, mergeTokens, registerHandler, setSegtype, toString
-
-
-
-
Field Detail
-
alignmentTokens
public static final java.util.List<java.lang.String> alignmentTokens
-
alignmentTexts
public static final java.util.List<java.lang.String> alignmentTexts
-
alignmentCodes
public static final java.util.List<java.lang.Integer> alignmentCodes
-
CRC
protected java.lang.Integer CRC
-
typeName
protected java.lang.String typeName
-
members
protected java.util.List<DataDefinitionSeg> members
-
alignment
protected int alignment
-
memberBytes
protected int memberBytes
-
anyNamed
protected boolean anyNamed
-
cachedCRC
protected java.lang.Integer cachedCRC
-
cachedDefs
protected java.util.WeakHashMap<DataContext,StructDef> cachedDefs
-
-
Constructor Detail
-
AnonStructSeg
public AnonStructSeg(int alignment)
-
AnonStructSeg
public AnonStructSeg(int alignment, java.util.List<? extends PathSegment> inner)
-
-
Method Detail
-
tokenForAlignment
public static java.lang.String tokenForAlignment(int alignment)
-
textForAlignment
public static java.lang.String textForAlignment(int alignment)
-
getMemberName
public static java.lang.String getMemberName(DataDefinitionSeg member)
-
add
public void add(DataDefinitionSeg member)
-
addAll
public void addAll(java.util.List<? extends PathSegment> inner)
-
getMembers
public java.util.List<DataDefinitionSeg> getMembers()
-
getAlignment
public int getAlignment()
-
setAlignment
public void setAlignment(int alignment)
-
getDef
public StructDef getDef(DataContext ctx)
- Specified by:
getDef
in classStructDefSeg
-
getCRC
public java.lang.Integer getCRC()
An anonymous structure definition will always have a CRC. The formal one from- Specified by:
getCRC
in classStructDefSeg
- Returns:
-
setCRC
public void setCRC(int CRC)
- Specified by:
setCRC
in classStructDefSeg
-
getTypeName
public java.lang.String getTypeName()
- Specified by:
getTypeName
in classStructDefSeg
-
setTypeName
public void setTypeName(java.lang.String typeName)
- Specified by:
setTypeName
in classStructDefSeg
-
construct
protected BaseDataType<?> construct(int[] dimensions, DataContext ctx)
Description copied from class:DataDefinitionSeg
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.
- Specified by:
construct
in classDataDefinitionSeg
- Returns:
-
compareTo
public int compareTo(PathSegment o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<PathSegment>
- Overrides:
compareTo
in classPathSegment
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classPathSegment
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
updateSegType
protected void updateSegType()
-
set
public PathSegment set(java.nio.ByteBuffer source, boolean padded)
Description copied from class:PathSegment
Replace the current instance content with the decoded source bytes.The caller must ensure that the instance is appropriate for the bytes supplied. This permits instance re-use in optimized applications.
- Specified by:
set
in classPathSegment
- Parameters:
source
- The bytes to be decoded. The position will be left after the last byte of the decoded segment.padded
- Alternate format selection. Packed format when false.- Returns:
- The same instance.
-
put
public void put(java.nio.ByteBuffer dest, boolean padded)
Description copied from class:PathSegment
Encode the current instance to the given destination.- Specified by:
put
in classPathSegment
- Parameters:
dest
- The buffer receiving the complete encoded instance.padded
- Alternate format selection. Packed format when false.
-
alternateHex
public java.lang.String alternateHex(boolean padded)
- Specified by:
alternateHex
in interfacePathSegment.HasAlternateHex
-
getBytes
public int getBytes()
Description copied from class:PathSegment
Obtain the number of bytes needed to encode this segment instance in packed format.- Specified by:
getBytes
in classPathSegment
- Returns:
- Number of bytes, assuming put() will be called with padded false.
-
getTokens
public java.util.List<java.lang.String> getTokens()
- Specified by:
getTokens
in classPathSegment
-
main
public static void main(java.lang.String[] args)
-
-