///<summary> Reads this HLAupdateAttributeValuesMessage from the specified stream.</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the object</returns>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            HLAupdateAttributeValuesMessage decodedValue;

            if (!(msg is HLAupdateAttributeValuesMessage))
            {
                decodedValue = new HLAupdateAttributeValuesMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.CopyTo(baseMsg);
                //decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                //decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                //decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAupdateAttributeValuesMessage;
            }
            object tmp = decodedValue;

            try
            {
                decodedValue = base.Deserialize(reader, ref tmp) as HLAupdateAttributeValuesMessage;

                decodedValue.ObjectInstanceHandle         = reader.ReadHLAinteger64BE();
                decodedValue.AttributeHandleValuePairList = new HLAattributeHandleValuePair[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < decodedValue.AttributeHandleValuePairList.Length; i++)
                {
                    tmp = BaseInteractionMessage.NullBaseInteractionMessage;
                    decodedValue.AttributeHandleValuePairList[i] = (HLAattributeHandleValuePair)hlaAttributeHandleValuePairXrtiSerializer.Deserialize(reader, ref tmp);
                }
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }
Exemple #2
0
        protected void ProcessHLAupdateAttributeValuesMetafederation(HLAupdateAttributeValuesMessage msg)
        {
            Lrc.ReflectAttributeValuesExtCallback callback =
                new Lrc.ReflectAttributeValuesExtCallback(this.parent.MetaFederateAmbassador,
                                                          new XRTIObjectInstanceHandle(msg.ObjectInstanceHandle),
                                                          msg.AttributeHandleValuePairList, msg.UserSuppliedTag);

            callback.Call();

            ObjectInstanceDescriptor oid = parent.descriptorManager.GetObjectInstanceDescriptor(new XRTIObjectInstanceHandle(msg.ObjectInstanceHandle));
            ObjectClassDescriptor    ocd = parent.descriptorManager.GetObjectClassDescriptor("Sxtafederate");

            bool timePropertyFound = false;

            if (oid.ClassHandle.Equals(ocd.Handle))
            {
                if (msg.AttributeHandleValuePairList.Length > 0)
                {
                    for (int i = 0; i < msg.AttributeHandleValuePairList.Length && !timePropertyFound; i++)
                    {
                        HLAattributeHandleValuePair pair = msg.AttributeHandleValuePairList[i];
                        string propertyName = ocd.GetAttributeDescriptor(new XRTIAttributeHandle(pair.AttributeHandle)).Name;
                        if (propertyName.Equals("HLAlogicalTime") || propertyName.Equals("HLAlookahead") ||
                            propertyName.Equals("HLApendingTime") || propertyName.Equals("HLALITS") || propertyName.Equals("HLAtimeManagerState") ||
                            propertyName.Equals("HLAtimeConstrained") || propertyName.Equals("HLAtimeRegulating"))
                        {
                            timePropertyFound = true;
                        }
                    }

                    if (timePropertyFound)
                    {
                        parent.UpdateFederate();
                    }
                }
            }
        }
        protected void ProcessHLAupdateAttributeValuesMetafederation(HLAupdateAttributeValuesMessage msg)
        {
            Lrc.ReflectAttributeValuesExtCallback callback =
                new Lrc.ReflectAttributeValuesExtCallback(this.parent.MetaFederateAmbassador,
                    new XRTIObjectInstanceHandle(msg.ObjectInstanceHandle),
                        msg.AttributeHandleValuePairList, msg.UserSuppliedTag);

            callback.Call();

            ObjectInstanceDescriptor oid = parent.descriptorManager.GetObjectInstanceDescriptor(new XRTIObjectInstanceHandle(msg.ObjectInstanceHandle));
            ObjectClassDescriptor ocd = parent.descriptorManager.GetObjectClassDescriptor("Sxtafederate");

            bool timePropertyFound = false;
            if (oid.ClassHandle.Equals(ocd.Handle))
            {
                if (msg.AttributeHandleValuePairList.Length > 0)
                {
                    for (int i = 0; i < msg.AttributeHandleValuePairList.Length && !timePropertyFound; i++)
                    {
                        HLAattributeHandleValuePair pair = msg.AttributeHandleValuePairList[i];
                        string propertyName = ocd.GetAttributeDescriptor(new XRTIAttributeHandle(pair.AttributeHandle)).Name;
                        if (propertyName.Equals("HLAlogicalTime") || propertyName.Equals("HLAlookahead")
                            || propertyName.Equals("HLApendingTime") || propertyName.Equals("HLALITS") || propertyName.Equals("HLAtimeManagerState")
                                    || propertyName.Equals("HLAtimeConstrained") || propertyName.Equals("HLAtimeRegulating"))
                        {
                            timePropertyFound = true;
                        }
                    }

                    if (timePropertyFound)
                    {
                        parent.UpdateFederate();
                    }
                }
            }
        }
        ///<summary> Reads this HLAupdateAttributeValuesMessage from the specified stream.</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the object</returns>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            HLAupdateAttributeValuesMessage decodedValue;
            if (!(msg is HLAupdateAttributeValuesMessage))
            {
                decodedValue = new HLAupdateAttributeValuesMessage();
                BaseInteractionMessage baseMsg = msg as BaseInteractionMessage;
                decodedValue.CopyTo(baseMsg);
                //decodedValue.InteractionClassHandle = baseMsg.InteractionClassHandle;
                //decodedValue.FederationExecutionHandle = baseMsg.FederationExecutionHandle;
                //decodedValue.UserSuppliedTag = baseMsg.UserSuppliedTag;
            }
            else
            {
                decodedValue = msg as HLAupdateAttributeValuesMessage;
            }
            object tmp = decodedValue;

            try
            {
                decodedValue = base.Deserialize(reader, ref tmp) as HLAupdateAttributeValuesMessage;

                decodedValue.ObjectInstanceHandle = reader.ReadHLAinteger64BE();
                decodedValue.AttributeHandleValuePairList = new HLAattributeHandleValuePair[reader.ReadHLAinteger32BE()];

                for (int i = 0; i < decodedValue.AttributeHandleValuePairList.Length; i++)
                {
                    tmp = BaseInteractionMessage.NullBaseInteractionMessage;
                    decodedValue.AttributeHandleValuePairList[i] = (HLAattributeHandleValuePair)hlaAttributeHandleValuePairXrtiSerializer.Deserialize(reader, ref tmp);
                }
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return decodedValue;
        }
        protected void ProcessHLAupdateAttributeValues(HLAupdateAttributeValuesMessage msg)
        {
            // Metafederation RO message
            if (msg.FederationExecutionHandle == HLAobjectRoot.METAFEDERATION_EXECUTION_HANDLE)
            {
                ObjectInstanceDescriptor oid = parent.descriptorManager.GetObjectInstanceDescriptor(new XRTIObjectInstanceHandle(msg.ObjectInstanceHandle));
                ObjectClassDescriptor ocd = parent.descriptorManager.GetObjectClassDescriptor("Sxtafederate");

                bool timePropertyFound = false;
                if (oid.ClassHandle.Equals(ocd.Handle))
                {
                    if (msg.AttributeHandleValuePairList.Length > 0)
                    {
                        for (int i = 0; i < msg.AttributeHandleValuePairList.Length && !timePropertyFound; i++)
                        {
                            HLAattributeHandleValuePair pair = msg.AttributeHandleValuePairList[i];
                            string propertyName = ocd.GetAttributeDescriptor(new XRTIAttributeHandle(pair.AttributeHandle)).Name;
                            if (propertyName.Equals("HLAlogicalTime") || propertyName.Equals("HLAlookahead")
                                || propertyName.Equals("HLApendingTime") || propertyName.Equals("HLALITS"))
                                    // propertyName.Equals("HLAtimeManagerState") || propertyName.Equals("HLAtimeConstrained") || propertyName.Equals("HLAtimeRegulating"))
                            {
                                timePropertyFound = true;
                            }
                        }

                        if (timePropertyFound)
                        {
                            form.UpdateTimeManagementValueLabels();
                        }
                    }
                }
            }
        }