Package com.automation_pros.odva.omron
Class OmronProbeContext.OmTypeCache
- java.lang.Object
-
- com.automation_pros.odva.omron.OmronProbeContext.OmTypeCache
-
- Enclosing class:
- OmronProbeContext
public class OmronProbeContext.OmTypeCache extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected StructDef
cachedDefinition
java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedMember>
instanceMap
java.lang.String
key
java.util.Map<java.lang.String,OmronProbeReport.OmProbedMember>
memberMap
protected boolean
sizeMatch
OmronProbeReport.OmProbedType
type
-
Constructor Summary
Constructors Constructor Description OmTypeCache(OmronProbeReport.OmProbedType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StructDef
getDefinition()
Obtain a usable Omron-format template definition from this reported type's members.OmronProbeReport.OmProbedMember
getNamedMember(java.lang.String key)
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.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.java.lang.String
toString()
-
-
-
Field Detail
-
type
public final OmronProbeReport.OmProbedType type
-
key
public final java.lang.String key
-
cachedDefinition
protected StructDef cachedDefinition
-
sizeMatch
protected boolean sizeMatch
-
memberMap
public final java.util.Map<java.lang.String,OmronProbeReport.OmProbedMember> memberMap
-
instanceMap
public final java.util.Map<java.lang.Integer,OmronProbeReport.OmProbedMember> instanceMap
-
-
Constructor Detail
-
OmTypeCache
public OmTypeCache(OmronProbeReport.OmProbedType type)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getNamedMember
public OmronProbeReport.OmProbedMember getNamedMember(java.lang.String key)
-
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.
-
-