/// <summary> 
 /// Constructor.
 /// </summary>
 /// <param name="pName">the name of the interaction class
 /// </param>
 /// <param name="pHandle">the handle of the interaction class
 /// </param>
 /// <param name="pParentDescriptors">the descriptors of the interaction class's parents
 /// </param>
 /// <param name="pDimensions">the dimensions associated with the interaction class
 /// </param>
 /// <param name="pTransportation">the transportation type of the interaction class
 /// </param>
 /// <param name="pOrder">the order type of the interaction class
 /// </param>
 public InteractionClassDescriptor(XmlElement interactionElement, IInteractionClassHandle pHandle, List<InteractionClassDescriptor> pParentDescriptors, IDimensionHandleSet pDimensions, TransportationType pTransportation, Sxta.Rti1516.Reflection.HLAorderType pOrder)
 {
     interactionClass = new Sxta.Rti1516.Reflection.HLAinteractionClass(interactionElement);
     handle = pHandle;
     parentDescriptors = pParentDescriptors;
     dimensions = pDimensions;
     transportation = pTransportation;
     order = pOrder;
 }
 /// <summary> 
 /// Constructor.
 /// </summary>
 /// <param name="interactClass">the info of the interaction class
 /// </param>
 /// <param name="pHandle">the handle of the interaction class
 /// </param>
 /// <param name="pParentDescriptors">the descriptors of the interaction class's parents
 /// </param>
 /// </param>
 public InteractionClassDescriptor(Sxta.Rti1516.Reflection.HLAinteractionClass interactClass, IInteractionClassHandle pHandle)
 {
     interactionClass = interactClass;
     handle = pHandle;
     parentDescriptors = new List<InteractionClassDescriptor>();
     dimensions = new XRTIDimensionHandleSet();
     transportation = "HLAreliable".Equals(interactClass.Transportation) ? TransportationType.HLA_RELIABLE : TransportationType.HLA_BEST_EFFORT;
     order = "Receive".Equals(interactClass.Order) ? Sxta.Rti1516.Reflection.HLAorderType.Receive : Sxta.Rti1516.Reflection.HLAorderType.TimeStamp;
 }
Beispiel #3
0
 // TODO ANGEL: Se añade un método de actualización específico para las propiedades de los objetos.
 //             Es debido a que usaban un IAttributeHandleValueMap que imponía una serie de problemas: implicaba la conversión de los values de object a byte[]
 public virtual void ReflectAttributeValuesExt(IObjectInstanceHandle theObject, HLAattributeHandleValuePair[] theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 public override void ReflectAttributeValuesExt(IObjectInstanceHandle theObject, HLAattributeHandleValuePair[] theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
 {
     // TODO ANGEL: LOCK DUDOSO
     //lock (this)
     //{
     if (objectInstanceHandleProxyMap.ContainsKey(theObject))
     {
         object instance = objectInstanceHandleProxyMap[theObject];
         rti.objectManager.UpdateAttributeValuesProxyObject(instance, theAttributes);
     }
     else
     {
         if (log.IsErrorEnabled)
             log.Error("Object " + theObject + " not found. Attributes to reflect: " + theAttributes);
     }
     //}
 }
Beispiel #5
0
 public virtual void ReceiveInteraction(IInteractionClassHandle interactionClass, IParameterHandleValueMap theParameters, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, ILogicalTime theTime, OrderType receivedOrdering, IMessageRetractionHandle messageRetractionHandle, IRegionHandleSet sentRegions)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #6
0
 public virtual void ReflectAttributeValues(IObjectInstanceHandle theObject, IAttributeHandleValueMap theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport, ILogicalTime theTime, OrderType receivedOrdering, IMessageRetractionHandle retractionHandle, IRegionHandleSet sentRegions)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #7
0
 public virtual void ReceiveInteraction(IInteractionClassHandle interactionClass, IParameterHandleValueMap theParameters, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
 {
     throw new Exception("The method or operation is not implemented.");
 }
        public override void ReflectAttributeValuesExt(IObjectInstanceHandle theObject, HLAattributeHandleValuePair[] theAttributes, byte[] userSuppliedTag, OrderType sentOrdering, TransportationType theTransport)
        {
            // TODO ANGEL: LOCK DUDOSO
            lock (this)
            {
                base.ReflectAttributeValuesExt(theObject, theAttributes, userSuppliedTag, sentOrdering, theTransport);

                if (objectInstanceHandleProxyMap.ContainsKey(theObject))
                {
                    object instance = objectInstanceHandleProxyMap[theObject];

                    // TODO ANGEL: ¿Esto debería estar aquí o dentro de la funcionalidad del objectManager?
                    //             El problema es que si lo hace objectManager debe poder acceder al federationsMap del rti
                    foreach (HLAattributeHandleValuePair entry in theAttributes)
                    {

                        string attributeName = GetAttributeName(instance, entry.AttributeHandle);

                        // Checks if the object created is an instance of HLAfederation and its properties are modificated
                        if (instance is HLAfederation)
                        {

                            if (attributeName == "HLAfederationName")
                            {
                                rti.federationsMap.Add((string)entry.AttributeValue, instance as HLAfederation);
                            }
                            else if (attributeName == "HLAFDDID")
                            {
                                rti.interactionManager.RegisterHelperClass((string)entry.AttributeValue);
                            }
                        }

                        // Checks if the object created is an instance of HLAfederate and its properties are modificated
                        if (instance is HLAfederate)
                        {
                            if (attributeName == "HLAfederateHandle")
                            {
                                if (instance is Sxtafederate)
                                {
                                    Sxtafederate federate = instance as Sxtafederate;

                                    // TODO ANGEL: OJO! Implica que la propiedad HLAfederationNameJoined se haya recibido antes que ésta
                                    HLAfederateHandle federateHandle = (HLAfederateHandle)entry.AttributeValue;
                                    rti.federationsMap[federate.HLAfederationNameJoined].HLAfederatesinFederation.Add(federateHandle);
                                }
                            }

                            if (attributeName == "HLAfederationNameJoined")
                            {
                                if (instance is Sxtafederate)
                                {
                                    Sxtafederate federate = instance as Sxtafederate;

                                    HLAfederation federation = rti.federationsMap[federate.HLAfederationNameJoined];
                                    federate.Federation = federation;
                                }
                            }

                            /*
                            if (attributeName == "HLAlogicalTime" || attributeName == "HLApendingTime"
                                || attributeName == "HLAlookahead" || attributeName == "HLAGALT" || attributeName == "HLALITS")
                            {
                                //System.Threading.Monitor.Pulse(rti);
                                //rti.PushFederates();
                            }
                            */
                        }
                    }
                }
            }
        }
 /// <summary>
 ///  Copy constructor.
 /// </summary>
 /// <param name="otherTransportationType">the transportation type to copy
 /// </param>
 public TransportationType(TransportationType otherTransportationType)
 {
     transportationValue = otherTransportationType.transportationValue;
 }
Beispiel #10
0
        /// <summary> 
        /// Sends an interaction.
        /// </summary>
        /// <param name="msg">the message or interaction to send
        /// </param>
        public virtual void SendInteraction(TransportationType transport, BaseInteractionMessage msg)
        {
            if (!channel2TransportationMap.ContainsKey(transport))
                throw new Exception("Transport unknown");

            foreach (KeyValuePair<TransportationType, ChannelType> keyValue in channel2TransportationMap)
            {
                if (keyValue.Key.Equals(transport))
                {
                    try
                    {
                        ChannelType channelType = keyValue.Value;
                        if (channelType.Equals(ChannelType.TCP))
                        {
                            SendRealiableInteraction(channelType, msg);
                        }
                        else
                        {
                            SendBestEffortInteraction(channelType, msg);
                        }
                    }
                    catch (Exception e)
                    {
                        //TODO. What should I do when the channel is remotly closed and lost??.
                        //TODO.
                        if (log.IsWarnEnabled)
                            log.Warn("Error sending interaction: " + e.Message);
                    }
                }
            }
        }
Beispiel #11
0
 /// <summary>
 ///  Copy constructor.
 /// </summary>
 /// <param name="otherTransportationType">the transportation type to copy
 /// </param>
 public TransportationType(TransportationType otherTransportationType)
 {
     transportationValue = otherTransportationType.transportationValue;
 }