Class StructMember

  • Direct Known Subclasses:
    PermStructMbr

    public class StructMember
    extends java.lang.Object
    • 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
      • 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
      • unusedParasiteBits

        protected java.lang.Long unusedParasiteBits
      • innerstruct

        protected final StructDef innerstruct
      • 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.
    • Method Detail

      • 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()
      • 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.
      • 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 class java.lang.Object