コード例 #1
0
        new public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = base.getMarshalledSize();
            marshalSize = marshalSize + _minefieldID.getMarshalledSize();        // _minefieldID
            marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID
            marshalSize = marshalSize + 1;                                       // _requestID
            marshalSize = marshalSize + 1;                                       // _numberOfPerimeterPoints
            marshalSize = marshalSize + 1;                                       // _pad2
            marshalSize = marshalSize + 1;                                       // _numberOfSensorTypes
            marshalSize = marshalSize + 4;                                       // _dataFilter
            marshalSize = marshalSize + _requestedMineType.getMarshalledSize();  // _requestedMineType
            for (int idx = 0; idx < _requestedPerimeterPoints.Count; idx++)
            {
                Point listElement = (Point)_requestedPerimeterPoints[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }
            for (int idx = 0; idx < _sensorTypes.Count; idx++)
            {
                TwoByteChunk listElement = (TwoByteChunk)_sensorTypes[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
コード例 #2
0
        } // end of unmarshal method

        ///<summary>
        ///This allows for a quick display of PDU data.  The current format is unacceptable and only used for debugging.
        ///This will be modified in the future to provide a better display.  Usage:
        ///pdu.GetType().InvokeMember("reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb });
        ///where pdu is an object representing a single pdu and sb is a StringBuilder.
        ///Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality
        ///</summary>
        new public void reflection(StringBuilder sb)
        {
            sb.Append("<GridAxisRecordRepresentation1>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<fieldScale type=\"float\">" + _fieldScale.ToString() + "</fieldScale> " + System.Environment.NewLine);
                sb.Append("<fieldOffset type=\"float\">" + _fieldOffset.ToString() + "</fieldOffset> " + System.Environment.NewLine);
                sb.Append("<dataValues type=\"ushort\">" + _dataValues.Count.ToString() + "</dataValues> " + System.Environment.NewLine);

                for (int idx = 0; idx < _dataValues.Count; idx++)
                {
                    sb.Append("<dataValues" + idx.ToString() + " type=\"TwoByteChunk\">" + System.Environment.NewLine);
                    TwoByteChunk aTwoByteChunk = (TwoByteChunk)_dataValues[idx];
                    aTwoByteChunk.reflection(sb);
                    sb.Append("</dataValues" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("</GridAxisRecordRepresentation1>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of reflection method
コード例 #3
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(GridAxisRecordRepresentation1 rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            if (!(_fieldScale == rhs._fieldScale))
            {
                ivarsEqual = false;
            }
            if (!(_fieldOffset == rhs._fieldOffset))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfValues == rhs._numberOfValues))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _dataValues.Count; idx++)
            {
                TwoByteChunk x = (TwoByteChunk)_dataValues[idx];
                if (!(_dataValues[idx].Equals(rhs._dataValues[idx])))
                {
                    ivarsEqual = false;
                }
            }


            return(ivarsEqual);
        }
コード例 #4
0
        new public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = base.getMarshalledSize();
            marshalSize = marshalSize + _minefieldID.getMarshalledSize();        // _minefieldID
            marshalSize = marshalSize + _requestingEntityID.getMarshalledSize(); // _requestingEntityID
            marshalSize = marshalSize + 2;                                       // _minefieldSequenceNumbeer
            marshalSize = marshalSize + 1;                                       // _requestID
            marshalSize = marshalSize + 1;                                       // _pduSequenceNumber
            marshalSize = marshalSize + 1;                                       // _numberOfPdus
            marshalSize = marshalSize + 1;                                       // _numberOfMinesInThisPdu
            marshalSize = marshalSize + 1;                                       // _numberOfSensorTypes
            marshalSize = marshalSize + 1;                                       // _pad2
            marshalSize = marshalSize + 4;                                       // _dataFilter
            marshalSize = marshalSize + _mineType.getMarshalledSize();           // _mineType
            for (int idx = 0; idx < _sensorTypes.Count; idx++)
            {
                TwoByteChunk listElement = (TwoByteChunk)_sensorTypes[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }
            marshalSize = marshalSize + 1;  // _pad3
            for (int idx = 0; idx < _mineLocation.Count; idx++)
            {
                Vector3Float listElement = (Vector3Float)_mineLocation[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
コード例 #5
0
        ///<summary>
        ///Marshal the data to the DataOutputStream.  Note: Length needs to be set before calling this method
        ///</summary>
        new public void marshal(DataOutputStream dos)
        {
            base.marshal(dos);
            try
            {
                _minefieldID.marshal(dos);
                _requestingEntityID.marshal(dos);
                dos.writeByte((byte)_requestID);
                dos.writeByte((byte)_requestedPerimeterPoints.Count);
                dos.writeByte((byte)_pad2);
                dos.writeByte((byte)_sensorTypes.Count);
                dos.writeUint((uint)_dataFilter);
                _requestedMineType.marshal(dos);

                for (int idx = 0; idx < _requestedPerimeterPoints.Count; idx++)
                {
                    Point aPoint = (Point)_requestedPerimeterPoints[idx];
                    aPoint.marshal(dos);
                } // end of list marshalling


                for (int idx = 0; idx < _sensorTypes.Count; idx++)
                {
                    TwoByteChunk aTwoByteChunk = (TwoByteChunk)_sensorTypes[idx];
                    aTwoByteChunk.marshal(dos);
                } // end of list marshalling
            }     // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
コード例 #6
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(TwoByteChunk rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }



            if (!(rhs._otherParameters.Length == 2))
            {
                ivarsEqual = false;
            }
            if (ivarsEqual)
            {
                for (int idx = 0; idx < 2; idx++)
                {
                    if (!(_otherParameters[idx] == rhs._otherParameters[idx]))
                    {
                        ivarsEqual = false;
                    }
                }
            }


            return(ivarsEqual);
        }
コード例 #7
0
        /// <summary>
        /// Method to convert a byte Array into Two tByte Chunks
        /// </summary>
        /// <param name="data">Byte array that contains data to convert</param>
        /// <returns>List containing TwoByteChunks</returns>
        public List <DIS1998net.TwoByteChunk> ArrayToTwoByteChunks(Array data)
        {
            if (data.Length == 0)
            {
                return(null);
            }

            int result = 0;

            DIS1998net.TwoByteChunk byteChunkData = new DIS1998net.TwoByteChunk();
            int lengthByteChunkData = byteChunkData.OtherParameters.Length;

            int maxSize = Math.DivRem(data.Length, lengthByteChunkData, out result);

            if (result != 0)
            {
                maxSize++;
            }

            byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData];
            Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length);

            List <DIS1998net.TwoByteChunk> byteChunkList = new List <DIS1998net.TwoByteChunk>();

            for (int i = 0; i < maxSize; i++)
            {
                byteChunkData = new DIS1998net.TwoByteChunk();
                Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData);

                byteChunkList.Add(byteChunkData);
            }

            return(byteChunkList);
        }
コード例 #8
0
        /// <summary>
        /// Method to convert a byte Array into Two tByte Chunks
        /// </summary>
        /// <param name="data">Byte array that contains data to convert</param>
        /// <returns>List containing TwoByteChunks</returns>
        public List <DIS1998net.TwoByteChunk> ArrayToTwoByteChunks(Array data)
        {
            if (data.Length == 0)
            {
                return(null);
            }

            DIS1998net.TwoByteChunk byteChunkData = new DIS1998net.TwoByteChunk();
            int lengthByteChunkData = byteChunkData.OtherParameters.Length;

            int maxSize = System.Convert.ToInt32(Math.Ceiling((double)data.Length / (double)lengthByteChunkData));//PES09182009 Modified so it would also work on Mobile

            byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData];
            Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length);

            List <DIS1998net.TwoByteChunk> byteChunkList = new List <DIS1998net.TwoByteChunk>();

            for (int i = 0; i < maxSize; i++)
            {
                byteChunkData = new DIS1998net.TwoByteChunk();
                Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData);

                byteChunkList.Add(byteChunkData);
            }

            return(byteChunkList);
        }
コード例 #9
0
        } // end of unmarshal method

        ///<summary>
        ///This allows for a quick display of PDU data.  The current format is unacceptable and only used for debugging.
        ///This will be modified in the future to provide a better display.  Usage:
        ///pdu.GetType().InvokeMember("reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb });
        ///where pdu is an object representing a single pdu and sb is a StringBuilder.
        ///Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality
        ///</summary>
        new public void reflection(StringBuilder sb)
        {
            sb.Append("<MinefieldDataPdu>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<minefieldID>" + System.Environment.NewLine);
                _minefieldID.reflection(sb);
                sb.Append("</minefieldID>" + System.Environment.NewLine);
                sb.Append("<requestingEntityID>" + System.Environment.NewLine);
                _requestingEntityID.reflection(sb);
                sb.Append("</requestingEntityID>" + System.Environment.NewLine);
                sb.Append("<minefieldSequenceNumbeer type=\"ushort\">" + _minefieldSequenceNumbeer.ToString() + "</minefieldSequenceNumbeer> " + System.Environment.NewLine);
                sb.Append("<requestID type=\"byte\">" + _requestID.ToString() + "</requestID> " + System.Environment.NewLine);
                sb.Append("<pduSequenceNumber type=\"byte\">" + _pduSequenceNumber.ToString() + "</pduSequenceNumber> " + System.Environment.NewLine);
                sb.Append("<numberOfPdus type=\"byte\">" + _numberOfPdus.ToString() + "</numberOfPdus> " + System.Environment.NewLine);
                sb.Append("<mineLocation type=\"byte\">" + _mineLocation.Count.ToString() + "</mineLocation> " + System.Environment.NewLine);
                sb.Append("<sensorTypes type=\"byte\">" + _sensorTypes.Count.ToString() + "</sensorTypes> " + System.Environment.NewLine);
                sb.Append("<pad2 type=\"byte\">" + _pad2.ToString() + "</pad2> " + System.Environment.NewLine);
                sb.Append("<dataFilter type=\"uint\">" + _dataFilter.ToString() + "</dataFilter> " + System.Environment.NewLine);
                sb.Append("<mineType>" + System.Environment.NewLine);
                _mineType.reflection(sb);
                sb.Append("</mineType>" + System.Environment.NewLine);

                for (int idx = 0; idx < _sensorTypes.Count; idx++)
                {
                    sb.Append("<sensorTypes" + idx.ToString() + " type=\"TwoByteChunk\">" + System.Environment.NewLine);
                    TwoByteChunk aTwoByteChunk = (TwoByteChunk)_sensorTypes[idx];
                    aTwoByteChunk.reflection(sb);
                    sb.Append("</sensorTypes" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("<pad3 type=\"byte\">" + _pad3.ToString() + "</pad3> " + System.Environment.NewLine);

                for (int idx = 0; idx < _mineLocation.Count; idx++)
                {
                    sb.Append("<mineLocation" + idx.ToString() + " type=\"Vector3Float\">" + System.Environment.NewLine);
                    Vector3Float aVector3Float = (Vector3Float)_mineLocation[idx];
                    aVector3Float.reflection(sb);
                    sb.Append("</mineLocation" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("</MinefieldDataPdu>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of reflection method
コード例 #10
0
        new public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = base.getMarshalledSize();
            marshalSize = marshalSize + 4;  // _fieldScale
            marshalSize = marshalSize + 4;  // _fieldOffset
            marshalSize = marshalSize + 2;  // _numberOfValues
            for (int idx = 0; idx < _dataValues.Count; idx++)
            {
                TwoByteChunk listElement = (TwoByteChunk)_dataValues[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
コード例 #11
0
        } // end of unmarshal method

        ///<summary>
        ///This allows for a quick display of PDU data.  The current format is unacceptable and only used for debugging.
        ///This will be modified in the future to provide a better display.  Usage:
        ///pdu.GetType().InvokeMember("reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb });
        ///where pdu is an object representing a single pdu and sb is a StringBuilder.
        ///Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality
        ///</summary>
        new public void reflection(StringBuilder sb)
        {
            sb.Append("<MinefieldQueryPdu>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<minefieldID>" + System.Environment.NewLine);
                _minefieldID.reflection(sb);
                sb.Append("</minefieldID>" + System.Environment.NewLine);
                sb.Append("<requestingEntityID>" + System.Environment.NewLine);
                _requestingEntityID.reflection(sb);
                sb.Append("</requestingEntityID>" + System.Environment.NewLine);
                sb.Append("<requestID type=\"byte\">" + _requestID.ToString() + "</requestID> " + System.Environment.NewLine);
                sb.Append("<requestedPerimeterPoints type=\"byte\">" + _requestedPerimeterPoints.Count.ToString() + "</requestedPerimeterPoints> " + System.Environment.NewLine);
                sb.Append("<pad2 type=\"byte\">" + _pad2.ToString() + "</pad2> " + System.Environment.NewLine);
                sb.Append("<sensorTypes type=\"byte\">" + _sensorTypes.Count.ToString() + "</sensorTypes> " + System.Environment.NewLine);
                sb.Append("<dataFilter type=\"uint\">" + _dataFilter.ToString() + "</dataFilter> " + System.Environment.NewLine);
                sb.Append("<requestedMineType>" + System.Environment.NewLine);
                _requestedMineType.reflection(sb);
                sb.Append("</requestedMineType>" + System.Environment.NewLine);

                for (int idx = 0; idx < _requestedPerimeterPoints.Count; idx++)
                {
                    sb.Append("<requestedPerimeterPoints" + idx.ToString() + " type=\"Point\">" + System.Environment.NewLine);
                    Point aPoint = (Point)_requestedPerimeterPoints[idx];
                    aPoint.reflection(sb);
                    sb.Append("</requestedPerimeterPoints" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling


                for (int idx = 0; idx < _sensorTypes.Count; idx++)
                {
                    sb.Append("<sensorTypes" + idx.ToString() + " type=\"TwoByteChunk\">" + System.Environment.NewLine);
                    TwoByteChunk aTwoByteChunk = (TwoByteChunk)_sensorTypes[idx];
                    aTwoByteChunk.reflection(sb);
                    sb.Append("</sensorTypes" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("</MinefieldQueryPdu>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of reflection method
コード例 #12
0
        /// <summary>
        /// Method to convert Two Byte Chunks into an Array
        /// </summary>
        /// <param name="chunkList">List that holds the TwoByteChunks</param>
        /// <returns>Byte array</returns>
        public Array TwoByteChunksToArray(List <DIS1998net.TwoByteChunk> chunkList)
        {
            DIS1998net.TwoByteChunk byteChunkData = new DIS1998net.TwoByteChunk();
            int lengthByteChunkData = byteChunkData.OtherParameters.Length;

            //Data passed in does not exist.
            if (chunkList.Count == 0)
            {
                return(null);
            }

            byte[] chunkBuffer = new byte[chunkList.Count * lengthByteChunkData];

            for (int i = 0; i < chunkList.Count; i++)
            {
                Buffer.BlockCopy(chunkList[i].OtherParameters, 0, chunkBuffer, i * lengthByteChunkData, lengthByteChunkData);
            }

            return((Array)chunkBuffer);
        }
コード例 #13
0
        ///<summary>
        ///Marshal the data to the DataOutputStream.  Note: Length needs to be set before calling this method
        ///</summary>
        new public void marshal(DataOutputStream dos)
        {
            base.marshal(dos);
            try
            {
                dos.writeFloat((float)_fieldScale);
                dos.writeFloat((float)_fieldOffset);
                dos.writeUshort((ushort)_dataValues.Count);

                for (int idx = 0; idx < _dataValues.Count; idx++)
                {
                    TwoByteChunk aTwoByteChunk = (TwoByteChunk)_dataValues[idx];
                    aTwoByteChunk.marshal(dos);
                } // end of list marshalling
            }     // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
コード例 #14
0
        } // end of marshal method

        new public void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _minefieldID.unmarshal(dis);
                _requestingEntityID.unmarshal(dis);
                _minefieldSequenceNumbeer = dis.readUshort();
                _requestID              = dis.readByte();
                _pduSequenceNumber      = dis.readByte();
                _numberOfPdus           = dis.readByte();
                _numberOfMinesInThisPdu = dis.readByte();
                _numberOfSensorTypes    = dis.readByte();
                _pad2       = dis.readByte();
                _dataFilter = dis.readUint();
                _mineType.unmarshal(dis);
                for (int idx = 0; idx < _numberOfSensorTypes; idx++)
                {
                    TwoByteChunk anX = new TwoByteChunk();
                    anX.unmarshal(dis);
                    _sensorTypes.Add(anX);
                }
                ;

                _pad3 = dis.readByte();
                for (int idx = 0; idx < _numberOfMinesInThisPdu; idx++)
                {
                    Vector3Float anX = new Vector3Float();
                    anX.unmarshal(dis);
                    _mineLocation.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
コード例 #15
0
        } // end of marshal method

        new public void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _fieldScale     = dis.readFloat();
                _fieldOffset    = dis.readFloat();
                _numberOfValues = dis.readUshort();
                for (int idx = 0; idx < _numberOfValues; idx++)
                {
                    TwoByteChunk anX = new TwoByteChunk();
                    anX.unmarshal(dis);
                    _dataValues.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
コード例 #16
0
        ///<summary>
        ///Marshal the data to the DataOutputStream.  Note: Length needs to be set before calling this method
        ///</summary>
        new public void marshal(DataOutputStream dos)
        {
            base.marshal(dos);
            try
            {
                _minefieldID.marshal(dos);
                _requestingEntityID.marshal(dos);
                dos.writeUshort((ushort)_minefieldSequenceNumbeer);
                dos.writeByte((byte)_requestID);
                dos.writeByte((byte)_pduSequenceNumber);
                dos.writeByte((byte)_numberOfPdus);
                dos.writeByte((byte)_mineLocation.Count);
                dos.writeByte((byte)_sensorTypes.Count);
                dos.writeByte((byte)_pad2);
                dos.writeUint((uint)_dataFilter);
                _mineType.marshal(dos);

                for (int idx = 0; idx < _sensorTypes.Count; idx++)
                {
                    TwoByteChunk aTwoByteChunk = (TwoByteChunk)_sensorTypes[idx];
                    aTwoByteChunk.marshal(dos);
                } // end of list marshalling

                dos.writeByte((byte)_pad3);

                for (int idx = 0; idx < _mineLocation.Count; idx++)
                {
                    Vector3Float aVector3Float = (Vector3Float)_mineLocation[idx];
                    aVector3Float.marshal(dos);
                } // end of list marshalling
            }     // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
コード例 #17
0
        } // end of marshal method

        new public void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _minefieldID.unmarshal(dis);
                _requestingEntityID.unmarshal(dis);
                _requestID = dis.readByte();
                _numberOfPerimeterPoints = dis.readByte();
                _pad2 = dis.readByte();
                _numberOfSensorTypes = dis.readByte();
                _dataFilter          = dis.readUint();
                _requestedMineType.unmarshal(dis);
                for (int idx = 0; idx < _numberOfPerimeterPoints; idx++)
                {
                    Point anX = new Point();
                    anX.unmarshal(dis);
                    _requestedPerimeterPoints.Add(anX);
                }
                ;

                for (int idx = 0; idx < _numberOfSensorTypes; idx++)
                {
                    TwoByteChunk anX = new TwoByteChunk();
                    anX.unmarshal(dis);
                    _sensorTypes.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
コード例 #18
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(TwoByteChunk rhs)
        {
            bool ivarsEqual = true;

            if(rhs.GetType() != this.GetType())
                return false;

            if( ! (rhs._otherParameters.Length == 2)) ivarsEqual = false;
            if(ivarsEqual)
            {

                for(int idx = 0; idx < 2; idx++)
                {
                    if(!(_otherParameters[idx] == rhs._otherParameters[idx])) ivarsEqual = false;
                }
            }

            return ivarsEqual;
        }
コード例 #19
0
        public new void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _fieldScale = dis.readFloat();
                _fieldOffset = dis.readFloat();
                _numberOfValues = dis.readUshort();
                for(int idx = 0; idx < _numberOfValues; idx++)
                {
                    TwoByteChunk anX = new TwoByteChunk();
                    anX.unmarshal(dis);
                    _dataValues.Add(anX);
                };

            } // end try
            catch(Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        }
コード例 #20
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(MinefieldDataPdu rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            if (!(_minefieldID.Equals(rhs._minefieldID)))
            {
                ivarsEqual = false;
            }
            if (!(_requestingEntityID.Equals(rhs._requestingEntityID)))
            {
                ivarsEqual = false;
            }
            if (!(_minefieldSequenceNumbeer == rhs._minefieldSequenceNumbeer))
            {
                ivarsEqual = false;
            }
            if (!(_requestID == rhs._requestID))
            {
                ivarsEqual = false;
            }
            if (!(_pduSequenceNumber == rhs._pduSequenceNumber))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfPdus == rhs._numberOfPdus))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfMinesInThisPdu == rhs._numberOfMinesInThisPdu))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSensorTypes == rhs._numberOfSensorTypes))
            {
                ivarsEqual = false;
            }
            if (!(_pad2 == rhs._pad2))
            {
                ivarsEqual = false;
            }
            if (!(_dataFilter == rhs._dataFilter))
            {
                ivarsEqual = false;
            }
            if (!(_mineType.Equals(rhs._mineType)))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _sensorTypes.Count; idx++)
            {
                TwoByteChunk x = (TwoByteChunk)_sensorTypes[idx];
                if (!(_sensorTypes[idx].Equals(rhs._sensorTypes[idx])))
                {
                    ivarsEqual = false;
                }
            }

            if (!(_pad3 == rhs._pad3))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _mineLocation.Count; idx++)
            {
                Vector3Float x = (Vector3Float)_mineLocation[idx];
                if (!(_mineLocation[idx].Equals(rhs._mineLocation[idx])))
                {
                    ivarsEqual = false;
                }
            }


            return(ivarsEqual);
        }
コード例 #21
0
        /// <summary>
        /// Method to convert a byte Array into Two tByte Chunks
        /// </summary>
        /// <param name="data">Byte array that contains data to convert</param>
        /// <returns>List containing TwoByteChunks</returns>
        public List<DIS1998net.TwoByteChunk> ArrayToTwoByteChunks(Array data)
        {
            if (data.Length == 0)
                return null;

            int result = 0;

            DIS1998net.TwoByteChunk byteChunkData = new DIS1998net.TwoByteChunk();
            int lengthByteChunkData = byteChunkData.OtherParameters.Length;

            int maxSize = Math.DivRem(data.Length, lengthByteChunkData, out result);
            if (result != 0) maxSize++;

            byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData];
            Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length);

            List<DIS1998net.TwoByteChunk> byteChunkList = new List<DIS1998net.TwoByteChunk>();

            for (int i = 0; i < maxSize; i++)
            {
                byteChunkData = new DIS1998net.TwoByteChunk();
                Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData);

                byteChunkList.Add(byteChunkData);
            }

            return byteChunkList;
        }
コード例 #22
0
        /// <summary>
        /// Method to convert Two Byte Chunks into an Array
        /// </summary>
        /// <param name="chunkList">List that holds the TwoByteChunks</param>
        /// <returns>Byte array</returns>
        public Array TwoByteChunksToArray(List<DIS1998net.TwoByteChunk> chunkList)
        {
            DIS1998net.TwoByteChunk byteChunkData = new DIS1998net.TwoByteChunk();
            int lengthByteChunkData = byteChunkData.OtherParameters.Length;

            //Data passed in does not exist.
            if (chunkList.Count == 0)
                return null;

            byte[] chunkBuffer = new byte[chunkList.Count * lengthByteChunkData];

            for (int i = 0; i < chunkList.Count; i++)
            {
                Buffer.BlockCopy(chunkList[i].OtherParameters, 0, chunkBuffer, i * lengthByteChunkData, lengthByteChunkData);
            }

            return (Array)chunkBuffer;
        }
コード例 #23
0
        public new void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _minefieldID.unmarshal(dis);
                _requestingEntityID.unmarshal(dis);
                _requestID = dis.readByte();
                _numberOfPerimeterPoints = dis.readByte();
                _pad2 = dis.readByte();
                _numberOfSensorTypes = dis.readByte();
                _dataFilter = dis.readUint();
                _requestedMineType.unmarshal(dis);
                for(int idx = 0; idx < _numberOfPerimeterPoints; idx++)
                {
                    Point anX = new Point();
                    anX.unmarshal(dis);
                    _requestedPerimeterPoints.Add(anX);
                };

                for(int idx = 0; idx < _numberOfSensorTypes; idx++)
                {
                    TwoByteChunk anX = new TwoByteChunk();
                    anX.unmarshal(dis);
                    _sensorTypes.Add(anX);
                };

            } // end try
            catch(Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        }
コード例 #24
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(MinefieldQueryPdu rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            if (!(_minefieldID.Equals(rhs._minefieldID)))
            {
                ivarsEqual = false;
            }
            if (!(_requestingEntityID.Equals(rhs._requestingEntityID)))
            {
                ivarsEqual = false;
            }
            if (!(_requestID == rhs._requestID))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfPerimeterPoints == rhs._numberOfPerimeterPoints))
            {
                ivarsEqual = false;
            }
            if (!(_pad2 == rhs._pad2))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSensorTypes == rhs._numberOfSensorTypes))
            {
                ivarsEqual = false;
            }
            if (!(_dataFilter == rhs._dataFilter))
            {
                ivarsEqual = false;
            }
            if (!(_requestedMineType.Equals(rhs._requestedMineType)))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _requestedPerimeterPoints.Count; idx++)
            {
                Point x = (Point)_requestedPerimeterPoints[idx];
                if (!(_requestedPerimeterPoints[idx].Equals(rhs._requestedPerimeterPoints[idx])))
                {
                    ivarsEqual = false;
                }
            }


            for (int idx = 0; idx < _sensorTypes.Count; idx++)
            {
                TwoByteChunk x = (TwoByteChunk)_sensorTypes[idx];
                if (!(_sensorTypes[idx].Equals(rhs._sensorTypes[idx])))
                {
                    ivarsEqual = false;
                }
            }


            return(ivarsEqual);
        }
コード例 #25
0
        public new void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _minefieldID.unmarshal(dis);
                _requestingEntityID.unmarshal(dis);
                _minefieldSequenceNumbeer = dis.readUshort();
                _requestID = dis.readByte();
                _pduSequenceNumber = dis.readByte();
                _numberOfPdus = dis.readByte();
                _numberOfMinesInThisPdu = dis.readByte();
                _numberOfSensorTypes = dis.readByte();
                _pad2 = dis.readByte();
                _dataFilter = dis.readUint();
                _mineType.unmarshal(dis);
                for(int idx = 0; idx < _numberOfSensorTypes; idx++)
                {
                    TwoByteChunk anX = new TwoByteChunk();
                    anX.unmarshal(dis);
                    _sensorTypes.Add(anX);
                };

                _pad3 = dis.readByte();
                for(int idx = 0; idx < _numberOfMinesInThisPdu; idx++)
                {
                    Vector3Float anX = new Vector3Float();
                    anX.unmarshal(dis);
                    _mineLocation.Add(anX);
                };

            } // end try
            catch(Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        }
コード例 #26
0
        /// <summary>
        /// Method to convert a byte Array into Two tByte Chunks
        /// </summary>
        /// <param name="data">Byte array that contains data to convert</param>
        /// <returns>List containing TwoByteChunks</returns>
        public List<DIS1998net.TwoByteChunk> ArrayToTwoByteChunks(Array data)
        {
            if (data.Length == 0)
                return null;

            DIS1998net.TwoByteChunk byteChunkData = new DIS1998net.TwoByteChunk();
            int lengthByteChunkData = byteChunkData.OtherParameters.Length;

            int maxSize = System.Convert.ToInt32(Math.Ceiling((double)data.Length / (double)lengthByteChunkData));//PES09182009 Modified so it would also work on Mobile

            byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData];
            Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length);

            List<DIS1998net.TwoByteChunk> byteChunkList = new List<DIS1998net.TwoByteChunk>();

            for (int i = 0; i < maxSize; i++)
            {
                byteChunkData = new DIS1998net.TwoByteChunk();
                Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData);

                byteChunkList.Add(byteChunkData);
            }

            return byteChunkList;
        }