Class StructMember
- java.lang.Object
-
- com.automation_pros.odva.cip.data.StructMember
-
- Direct Known Subclasses:
PermStructMbr
public class StructMember extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StructMember.MemberTypeSegment
Implement a decorated type segment for members that is implicitly tied to the StructMember (see the beginning of the ultimate private StructMember constructor).
-
Field Summary
Fields Modifier and Type Field Description int
align
DataDefinitionSeg
bareSegment
java.lang.String
CRCstring
protected java.lang.String
documentation
boolean
hidden
boolean
hosted
protected StructMember
hostref
protected int
index
protected StructDef
innerstruct
protected int
maxOffset
int
maxSize
protected int
minOffset
int
minSize
java.lang.String
name
protected int
offset
protected BaseDataType<?>
singleton
int
size
protected int
typeCode
protected java.lang.String
typeName
StructMember.MemberTypeSegment
typeSegment
protected java.lang.Long
unusedParasiteBits
-
Constructor Summary
Constructors Modifier Constructor Description StructMember(DataDefinitionSeg seg, DataContext ctx)
Construct a StructMember given a type definition segment and a context with which to construct a nested structure if necessary.protected
StructMember(DecoratedDefSeg seg, StructDef inner, BaseDataType<?> singleton)
StructMember(java.lang.String name, BaseDataType<?> data)
Construct a StructMember from a Singleton data item.StructMember(java.lang.String name, StructDef innerstruct, int[] innerdim)
Construct a StructMember that will be a nested structure.StructMember(java.lang.String name, java.lang.Class<? extends BaseDataType<?>> element, int... innerdim)
Construct a StructMember using an elementary or constructed data type, or a subclass thereof.StructMember(java.lang.String name, java.lang.String host, int bitnum)
Construct a boolean StructMember that points at a specific bit in another (named) StructMember.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkCircular(java.lang.String[] excludes)
protected void
checkParasite(int parasiteBit, int qty)
java.lang.String
docString(boolean fullDoc)
StructMember
duplicate()
int
getBitOffset()
int
getDepth()
int[]
getDimensions()
java.lang.String
getDocumentation()
StructMember
getHostref()
int
getIndex()
short
getInfo()
Where the member datatype permits, support Logix-style type discovery for this member's type.int[]
getInnerOffsets()
StructDef
getInnerStruct()
BaseDataType<?>
getInstance(DataContext ctx)
Provide a method for CipStruct to assemble its storage array element for this member.BaseDataType<?>
getInstance(DataContext ctx, BaseDataType<?> hostInst)
Provide a method for CipStruct to assemble its storage array element for this hosted member.int
getMaxOffset()
int
getMinOffset()
java.lang.String
getName()
int
getOffset()
StructDef
getOwner()
BaseDataType<?>
getSingleton()
int
getStructByteOffset()
short
getSymbolType()
java.lang.String
getTypeName()
java.lang.Long
getUnusedParasites()
CipPath
getVariant()
void
lock(StructDef owner)
void
setDocumentation(java.lang.String documentation)
void
setHostref(StructMember hostref)
void
setIndex(int index)
void
setInnerOffsets(int[] offsets)
void
setMinMaxOffset(int minOfs, int maxOfs)
void
setOffset(int offset)
void
setVariantDimension(CipPath variantDimension)
java.lang.String
toString()
-
-
-
Field Detail
-
name
public final java.lang.String name
-
typeName
protected final java.lang.String typeName
-
CRCstring
public final java.lang.String CRCstring
-
typeCode
protected final int typeCode
-
typeSegment
public final StructMember.MemberTypeSegment typeSegment
-
bareSegment
public final DataDefinitionSeg bareSegment
-
hosted
public final boolean hosted
-
size
public final int size
-
minSize
public final int minSize
-
maxSize
public final int maxSize
-
align
public final int align
-
hostref
protected StructMember hostref
-
unusedParasiteBits
protected java.lang.Long unusedParasiteBits
-
innerstruct
protected final StructDef innerstruct
-
singleton
protected final BaseDataType<?> singleton
-
index
protected int index
-
offset
protected int offset
-
minOffset
protected int minOffset
-
maxOffset
protected int maxOffset
-
documentation
protected java.lang.String documentation
-
hidden
public boolean hidden
-
-
Constructor Detail
-
StructMember
public StructMember(java.lang.String name, BaseDataType<?> data)
Construct a StructMember from a Singleton data item. All actual CipStruct instances created containing this member will share this same data instance.- Parameters:
name
- The name of this structure field.data
- The singleton to supply for all structure instances.
-
StructMember
public StructMember(java.lang.String name, java.lang.String host, int bitnum)
Construct a boolean StructMember that points at a specific bit in another (named) StructMember. Validation of this relationship occurs when the list of members is assembled into a StructDef.- Parameters:
name
- The name of this structure field.host
- The name of the host field. Must be an integer or word type. Suitable types implement the BoolHost interface.bitnum
- The offset into the host field.
-
StructMember
public StructMember(java.lang.String name, java.lang.Class<? extends BaseDataType<?>> element, int... innerdim)
Construct a StructMember using an elementary or constructed data type, or a subclass thereof.- Parameters:
name
- The name of this structure field.element
- The class to instantiate in new CipStruct instances. Must not be CipStruct.class.innerdim
- The array dimension(s) for this member in new CipStruct instances. May not have more than one dimension if to be exposed to Logix-style tag/type browse operations.
-
StructMember
public StructMember(java.lang.String name, StructDef innerstruct, int[] innerdim)
Construct a StructMember that will be a nested structure. Circular references will be detected and rejected when the list of members is assembled into a StructDef.- Parameters:
name
- The name of this structure field.innerstruct
- The structure definition to nest. Must have MaxAlign 4 or 8 to be exposed to Logix-style tag/type browse operations.innerdim
- The array dimension(s) for this member in new CipStruct instances. May not have more than one dimension if to be exposed to Logix-style tag/type browse operations.
-
StructMember
public StructMember(DataDefinitionSeg seg, DataContext ctx)
Construct a StructMember given a type definition segment and a context with which to construct a nested structure if necessary. May also be decorated to have a member name.- Parameters:
seg
- Member data type, possibly decorated.ctx
- Construction context if seg is, or contains, a StructDefSeg.
-
StructMember
protected StructMember(DecoratedDefSeg seg, StructDef inner, BaseDataType<?> singleton)
-
-
Method Detail
-
duplicate
public StructMember duplicate()
-
getDocumentation
public java.lang.String getDocumentation()
-
setDocumentation
public void setDocumentation(java.lang.String documentation)
-
getInnerOffsets
public int[] getInnerOffsets()
-
setInnerOffsets
public void setInnerOffsets(int[] offsets)
-
checkCircular
public void checkCircular(java.lang.String[] excludes)
-
getName
public java.lang.String getName()
-
getInnerStruct
public StructDef getInnerStruct()
-
getDimensions
public int[] getDimensions()
-
getOwner
public StructDef getOwner()
-
getHostref
public StructMember getHostref()
-
setHostref
public void setHostref(StructMember hostref)
-
checkParasite
protected void checkParasite(int parasiteBit, int qty)
-
getUnusedParasites
public java.lang.Long getUnusedParasites()
-
getIndex
public int getIndex()
-
getDepth
public int getDepth()
-
setIndex
public void setIndex(int index)
-
getVariant
public CipPath getVariant()
-
setVariantDimension
public void setVariantDimension(CipPath variantDimension)
-
getInfo
public short getInfo()
Where the member datatype permits, support Logix-style type discovery for this member's type. This method provides the 16-bit "Info" field needed to reply to a template read service.- Returns:
-
getInstance
public BaseDataType<?> getInstance(DataContext ctx)
Provide a method for CipStruct to assemble its storage array element for this member. This form is for non-hosted members.- Parameters:
ctx
- Reference for looking up other structure types, if necessary. Actually the enclosing CipStruct, which delegates to its variant context.- Returns:
- A space-occupying member instance, with its variant context set to the given context.
-
getSingleton
public BaseDataType<?> getSingleton()
-
getInstance
public BaseDataType<?> getInstance(DataContext ctx, BaseDataType<?> hostInst)
Provide a method for CipStruct to assemble its storage array element for this hosted member. CipStruct will present the hosting instance to ensure the entire object is tied together correctly.- Parameters:
ctx
- Reference for passing to a DataResolver.hostInst
- The pre-selected host instance for this hosted member.- Returns:
- A hosted member instance, with its variant context set to the given context.
-
getTypeName
public java.lang.String getTypeName()
-
getOffset
public int getOffset()
-
getMinOffset
public int getMinOffset()
-
getMaxOffset
public int getMaxOffset()
-
lock
public void lock(StructDef owner)
-
setOffset
public void setOffset(int offset)
-
setMinMaxOffset
public void setMinMaxOffset(int minOfs, int maxOfs)
-
getBitOffset
public int getBitOffset()
-
getStructByteOffset
public int getStructByteOffset()
-
getSymbolType
public short getSymbolType()
-
docString
public java.lang.String docString(boolean fullDoc)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-