Class HostedBitDefSeg

  • All Implemented Interfaces:
    java.lang.Comparable<PathSegment>

    public class HostedBitDefSeg
    extends DataDefinitionSeg
    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.
    • Field Detail

      • hostBit

        public int hostBit
    • Constructor Detail

      • HostedBitDefSeg

        public HostedBitDefSeg()
      • HostedBitDefSeg

        public HostedBitDefSeg​(java.lang.String host,
                               int bit)
      • HostedBitDefSeg

        public HostedBitDefSeg​(PathSegment host,
                               int bit)
    • Method Detail

      • getHostString

        public java.lang.String getHostString()
      • getSizeImpl

        public int getSizeImpl​(DataContext ctx)
        Description copied from class: DataDefinitionSeg
        Return the number of bytes occupied by a single instance of the given data type. When the data is indirect, size is zero. When the data is variable length, size is -1;
        Specified by:
        getSizeImpl in class DataDefinitionSeg
        Returns:
        Number of bytes.
      • construct

        protected BaseDataType<?> construct​(int[] dimensions,
                                            DataContext ctx)
        Hosted Bits are only constructed when accessed individually, when they behave as a solo boolean. The default is to construct a standard 8-bit boolean, but can be changed per-instance to accommodate other platform implementations (like Omron).
        Specified by:
        construct in class DataDefinitionSeg
        Parameters:
        dimensions -
        ctx -
        Returns:
      • simpleString

        public java.lang.String simpleString()
        Description copied from class: PathSegment
        Supply s simple descriptive name usable when browsing a hierarchy. A simple type name for elementary types, a non-detailed description for complex types.
        Specified by:
        simpleString in class PathSegment
        Returns:
      • 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 class PathSegment
        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 class PathSegment
        Parameters:
        dest - The buffer receiving the complete encoded instance.
        padded - Alternate format selection. Packed format when false.
      • 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 class PathSegment
        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 class PathSegment
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class PathSegment
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object