} // 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>
        public void reflection(StringBuilder sb)
        {
            sb.Append("<AcousticEmitterSystemData>" + System.Environment.NewLine);
            try
            {
                sb.Append("<emitterSystemDataLength type=\"byte\">" + _emitterSystemDataLength.ToString() + "</emitterSystemDataLength> " + System.Environment.NewLine);
                sb.Append("<beamRecords type=\"byte\">" + _beamRecords.Count.ToString() + "</beamRecords> " + System.Environment.NewLine);
                sb.Append("<pad2 type=\"ushort\">" + _pad2.ToString() + "</pad2> " + System.Environment.NewLine);
                sb.Append("<acousticEmitterSystem>" + System.Environment.NewLine);
                _acousticEmitterSystem.reflection(sb);
                sb.Append("</acousticEmitterSystem>" + System.Environment.NewLine);
                sb.Append("<emitterLocation>" + System.Environment.NewLine);
                _emitterLocation.reflection(sb);
                sb.Append("</emitterLocation>" + System.Environment.NewLine);

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

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

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

            if (!(_beamDataLength == rhs._beamDataLength))
            {
                ivarsEqual = false;
            }
            if (!(_beamIDNumber == rhs._beamIDNumber))
            {
                ivarsEqual = false;
            }
            if (!(_pad2 == rhs._pad2))
            {
                ivarsEqual = false;
            }
            if (!(_fundamentalDataParameters.Equals(rhs._fundamentalDataParameters)))
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }
        public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = marshalSize + 1;                                          // _emitterSystemDataLength
            marshalSize = marshalSize + 1;                                          // _numberOfBeams
            marshalSize = marshalSize + 2;                                          // _pad2
            marshalSize = marshalSize + _acousticEmitterSystem.getMarshalledSize(); // _acousticEmitterSystem
            marshalSize = marshalSize + _emitterLocation.getMarshalledSize();       // _emitterLocation
            for (int idx = 0; idx < _beamRecords.Count; idx++)
            {
                AcousticBeamData listElement = (AcousticBeamData)_beamRecords[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(AcousticEmitterSystemData rhs)
        {
            bool ivarsEqual = true;

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

            if (!(_emitterSystemDataLength == rhs._emitterSystemDataLength))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfBeams == rhs._numberOfBeams))
            {
                ivarsEqual = false;
            }
            if (!(_pad2 == rhs._pad2))
            {
                ivarsEqual = false;
            }
            if (!(_acousticEmitterSystem.Equals(rhs._acousticEmitterSystem)))
            {
                ivarsEqual = false;
            }
            if (!(_emitterLocation.Equals(rhs._emitterLocation)))
            {
                ivarsEqual = false;
            }

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


            return(ivarsEqual);
        }
///<summary>
///Marshal the data to the DataOutputStream.  Note: Length needs to be set before calling this method
///</summary>
        public void marshal(DataOutputStream dos)
        {
            try
            {
                dos.writeByte((byte)_emitterSystemDataLength);
                dos.writeByte((byte)_beamRecords.Count);
                dos.writeUshort((ushort)_pad2);
                _acousticEmitterSystem.marshal(dos);
                _emitterLocation.marshal(dos);

                for (int idx = 0; idx < _beamRecords.Count; idx++)
                {
                    AcousticBeamData aAcousticBeamData = (AcousticBeamData)_beamRecords[idx];
                    aAcousticBeamData.marshal(dos);
                } // end of list marshalling
            }     // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
        } // end of marshal method

        public void unmarshal(DataInputStream dis)
        {
            try
            {
                _emitterSystemDataLength = dis.readByte();
                _numberOfBeams           = dis.readByte();
                _pad2 = dis.readUshort();
                _acousticEmitterSystem.unmarshal(dis);
                _emitterLocation.unmarshal(dis);
                for (int idx = 0; idx < _numberOfBeams; idx++)
                {
                    AcousticBeamData anX = new AcousticBeamData();
                    anX.unmarshal(dis);
                    _beamRecords.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
        /**
          * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
          */
        public bool equals(AcousticBeamData rhs)
        {
            bool ivarsEqual = true;

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

             if( ! (_beamDataLength == rhs._beamDataLength)) ivarsEqual = false;
             if( ! (_beamIDNumber == rhs._beamIDNumber)) ivarsEqual = false;
             if( ! (_pad2 == rhs._pad2)) ivarsEqual = false;
             if( ! (_fundamentalDataParameters.Equals( rhs._fundamentalDataParameters) )) ivarsEqual = false;

            return ivarsEqual;
        }
        public void unmarshal(DataInputStream dis)
        {
            try
            {
               _emitterSystemDataLength = dis.readByte();
               _numberOfBeams = dis.readByte();
               _pad2 = dis.readUshort();
               _acousticEmitterSystem.unmarshal(dis);
               _emitterLocation.unmarshal(dis);
            for(int idx = 0; idx < _numberOfBeams; idx++)
            {
               AcousticBeamData anX = new AcousticBeamData();
            anX.unmarshal(dis);
            _beamRecords.Add(anX);
            };

            } // end try
               catch(Exception e)
            {
              Trace.WriteLine(e);
              Trace.Flush();
            }
        }