/// <summary> /// Sends an interaction. /// </summary> /// <param name="decodedValue">the message or interaction to send /// </param> public virtual void SendInteraction(BaseInteractionMessage msg) { TransportationType transport = interactionChannelMap[msg.GetType()]; // If transport is null, then we send it directly to // our listeners if (transport == null) { ReceiveInteraction(msg); } else { //msg.InteractionClassHandle = ((XRTIInteractionClassHandle)interactionClassDescriptorMap[msg.GetType()].Handle).Identifier; msg.InteractionClassHandle = SerializerManager.GetHandle(msg.GetType()); SendInteraction(transport, msg); } }
/// <summary>Notifies the federate of a received interaction.</summary> /// <param name="decodedValue"> the message of the received interaction</param> public void ReceiveInteraction(BaseInteractionMessage msg) { if (log.IsDebugEnabled) log.Debug("Read msg: " + msg); try { if (interactionDelegates.ContainsKey(msg.GetType())) { interactionDelegates[msg.GetType()](msg); } //else //{ lock (interactionListeners) { foreach (IInteractionListener il in interactionListeners) { (il as IInteractionListener).ReceiveInteraction(msg); } } //} } catch (IOException ioe) { throw new FederateInternalError(ioe.ToString()); } }
public void DispatchInteraction(BaseInteractionMessage msg) { if (interactionsDelegates.ContainsKey(msg.FederationExecutionHandle)) { if (interactionsDelegates[msg.FederationExecutionHandle].ContainsKey(msg.GetType())) interactionsDelegates[msg.FederationExecutionHandle][msg.GetType()](msg); else interactionsDelegates[msg.FederationExecutionHandle][typeof(BaseInteractionMessage)](msg); } }