Exemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="dm"> a Descriptor Manager</param>
        /// <param name="channelMangr"> The channel manager of all interaction managed by this interaction manager</param>
        public InteractionManager(DescriptorManager dm, ChannelsManager channelMngr)
        {
            descriptorManager = dm;

            RegisterAssemblyHelpers(Assembly.GetExecutingAssembly());

            // TODO ANGEL: Gualtrapa. Borrame!!!!!!!!
            //RegisterHelloWorldHelperClass();

            if (descriptorManager != null)
            {
                //descriptorManager.AddDescriptors(Sxta.Rti1516ResourcesNames.BootstrapObjectModel);
                RegisterHelperClass(Sxta.Rti1516ResourcesNames.BootstrapObjectModel);
            }

            channelManager = channelMngr;
            channelManager.ChannelDataAvailable += new OnDataAvailable(this.OnDataAvailable);
            channelManager.NewChannelAvailable += new OnDataAvailable(this.OnChannelAvailable);

            serializer = new HlaEncodingSerializer(1, null, serializerManager);

            channel2TransportationMap.Add(TransportationType.HLA_RELIABLE, ChannelType.TCP);
            channel2TransportationMap.Add(TransportationType.HLA_BEST_EFFORT, ChannelType.UDP);
            channel2TransportationMap.Add(new TransportationType("multicast"), ChannelType.MULTICAST);
            channel2TransportationMap.Add(new TransportationType("memory"), ChannelType.MEMORY);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="dm"> a Descriptor Manager</param>
        /// <param name="channelMangr"> The channel manager of all interaction managed by this interaction manager</param>
        public InteractionManager(DescriptorManager dm, ChannelsManager channelMngr)
        {
            descriptorManager = dm;

            RegisterAssemblyHelpers(Assembly.GetExecutingAssembly());

            // TODO ANGEL: Gualtrapa. Borrame!!!!!!!!
            //RegisterHelloWorldHelperClass();

            if (descriptorManager != null)
            {
                //descriptorManager.AddDescriptors(Sxta.Rti1516ResourcesNames.BootstrapObjectModel);
                RegisterHelperClass(Sxta.Rti1516ResourcesNames.BootstrapObjectModel);
            }

            channelManager = channelMngr;
            channelManager.ChannelDataAvailable += new OnDataAvailable(this.OnDataAvailable);
            channelManager.NewChannelAvailable  += new OnDataAvailable(this.OnChannelAvailable);

            serializer = new HlaEncodingSerializer(1, null, serializerManager);

            channel2TransportationMap.Add(TransportationType.HLA_RELIABLE, ChannelType.TCP);
            channel2TransportationMap.Add(TransportationType.HLA_BEST_EFFORT, ChannelType.UDP);
            channel2TransportationMap.Add(new TransportationType("multicast"), ChannelType.MULTICAST);
            channel2TransportationMap.Add(new TransportationType("memory"), ChannelType.MEMORY);
        }
Exemplo n.º 3
0
        ///<summary>
        /// Reads and returns a BaseIteractionMessage from the specified stream.
        ///</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<returns> the decoded parameterValue</returns>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object msg)
        {
            if (msg == null)
            {
                msg = new BaseInteractionMessage();
            }
            BaseInteractionMessage decodedValue = msg as BaseInteractionMessage;

            decodedValue.FederateHandle            = reader.ReadHLAinteger64BE();
            decodedValue.InteractionIndex          = reader.ReadHLAinteger64BE();
            decodedValue.FederationExecutionHandle = reader.ReadHLAinteger64BE();
            decodedValue.UserSuppliedTag           = reader.ReadHLAopaqueData();
            decodedValue.InteractionClassHandle    = reader.ReadHLAinteger64BE();

            IHlaEncodingSerializer serializer = serializerManager.GetSerializer(decodedValue.InteractionClassHandle);

            if (serializer != null && !this.Equals(serializer))
            {
                object decodedValueTmp = decodedValue;
                return(serializer.Deserialize(reader, ref decodedValueTmp));
            }
            else
            {
                return(decodedValue);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// The version number of the HLA Encoding Formatter.  The upper 16 bits
 /// of the integer contain the major version number, and the lower 16 bits contain
 /// the minor version number.
 /// </summary>
 public HlaEncodingSerializer(int version, object format, XrtiSerializerManager manager)
     : base(manager)
 {
     hlaEncodingModelVersion = version;
     hlaFormat = format;
     //baseSerializer = new BaseIteractionMessageXrtiSerializer(manager);
     baseSerializer = serializerManager.GetSerializer(typeof(BaseInteractionMessage));
 }
Exemplo n.º 5
0
 /// <summary>
 /// The version number of the HLA Encoding Formatter.  The upper 16 bits 
 /// of the integer contain the major version number, and the lower 16 bits contain
 /// the minor version number.
 /// </summary>
 public HlaEncodingSerializer(int version, object format, XrtiSerializerManager manager)
     : base(manager)
 {
     hlaEncodingModelVersion = version;
     hlaFormat = format;
     //baseSerializer = new BaseIteractionMessageXrtiSerializer(manager);
     baseSerializer = serializerManager.GetSerializer(typeof(BaseInteractionMessage));
 }
Exemplo n.º 6
0
 public void RegisterSerializer(Type objectType, long handle, IHlaEncodingSerializer aSerializer)
 {
     if (objectType != null)
     {
         serializersTypeMap[objectType]       = aSerializer;
         serializersTypeHandleMap[objectType] = handle;
     }
     serializersHandleMap[handle] = aSerializer;
 }
Exemplo n.º 7
0
 public void RegisterSerializer(Type objectType, long handle, IHlaEncodingSerializer aSerializer)
 {
     if (objectType != null)
     {
         serializersTypeMap[objectType] = aSerializer;
         serializersTypeHandleMap[objectType] = handle;
     }
     serializersHandleMap[handle] = aSerializer;
 }
 ///<summary>
 /// Writes this HLAfederate.HLAGALT to the specified stream.
 ///</summary>
 ///<param name="writer"> the output stream to write to</param>
 ///<param name="HLAfederationName"> the property to serialize</param>
 ///<exception cref="System.IO.IOException"> if an error occurs</exception>
 public override void Serialize(HlaEncodingWriter writer, object HLAGALT)
 {
     try
     {
         IHlaEncodingSerializer serializer = serializerManager.GetSerializer(typeof(ILogicalTime));
         serializer.Serialize(writer, HLAGALT);
     }
     catch (IOException ioe)
     {
         throw new RTIinternalError(ioe.ToString());
     }
 }
        ///<summary>
        /// Reads and returns a HLAfederate.HLAGALT from the specified stream.
        ///</summary>
        ///<param name="reader"> the input stream to read from</param>
        ///<param name="dummy"> this parameter is not used</param>
        ///<returns> the decoded value</returns>
        ///<exception cref="System.IO.IOException"> if an error occurs</exception>
        public override object Deserialize(HlaEncodingReader reader, ref object dummy)
        {
            ILogicalTime decodedValue;

            try
            {
                IHlaEncodingSerializer serializer = serializerManager.GetSerializer(typeof(ILogicalTime));
                decodedValue = (ILogicalTime)serializer.Deserialize(reader, ref dummy);
                return(decodedValue);
            }
            catch (IOException ioe)
            {
                throw new FederateInternalError(ioe.ToString());
            }
        }
Exemplo n.º 10
0
        ///<summary>
        /// Writes this HLAparameterHandleValuePair to the specified stream.
        ///</summary>
        ///<param name="writer"> the output stream to write to</param>
        ///<param name="obj"> the object to serialize</param>
        ///<exception cref="IOException"> if an error occurs</exception>
        public override void Serialize(HlaEncodingWriter writer, object obj)
        {
            BaseInteractionMessage msg = obj as BaseInteractionMessage;

            writer.WriteHLAinteger64BE(msg.FederateHandle);
            writer.WriteHLAinteger64BE(msg.InteractionIndex);
            writer.WriteHLAinteger64BE(msg.FederationExecutionHandle);
            writer.WriteHLAopaqueData(msg.UserSuppliedTag);
            writer.WriteHLAinteger64BE(msg.InteractionClassHandle);
            IHlaEncodingSerializer serializer = serializerManager.GetSerializer(msg.InteractionClassHandle);

            if (serializer != null && !this.Equals(serializer))
            {
                serializer.Serialize(writer, obj);
            }
        }
Exemplo n.º 11
0
 public void RegisterSerializer(Type objectType, long handle, IHlaEncodingSerializer aSerializer)
 {
     serializerManager.RegisterSerializer(objectType, handle, aSerializer);
 }
Exemplo n.º 12
0
 ///<summary> Constructor </summary>
 public HLAupdateAttributeValuesMessageXrtiSerializer(XrtiSerializerManager manager)
     : base(manager)
 {
     hlaAttributeHandleValuePairXrtiSerializer = manager.GetSerializer(typeof(HLAattributeHandleValuePair));
 }
Exemplo n.º 13
0
 ///<summary> Constructor </summary>
 public HLAupdateAttributeValuesMessageXrtiSerializer(XrtiSerializerManager manager)
     : base(manager)
 {
     hlaAttributeHandleValuePairXrtiSerializer = manager.GetSerializer(typeof(HLAattributeHandleValuePair));
 }
Exemplo n.º 14
0
 public void RegisterSerializer(Type objectType, long handle, IHlaEncodingSerializer aSerializer)
 {
     serializerManager.RegisterSerializer(objectType, handle, aSerializer);
 }