/// <summary>Constructor.</summary>
        /// <param name="interactionManager"> the run-time interaction manager</param>
        public TimeManagementObjectModelInteractionHelper(InteractionManager interactionManager)
        {
            Type objType;

            manager = interactionManager;
            XrtiSerializerManager serializerMngr = manager.SerializerManager;
            long handle;
            ObjectClassDescriptor ocd;

            // Home
            ocd    = manager.DescriptorManager.GetObjectClassDescriptor("Home");
            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("PosX").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new IntegerPositionXrtiSerializer(serializerMngr));

            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("PosY").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new IntegerPositionXrtiSerializer(serializerMngr));

            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("BoxesCount").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new HomePropertyBoxesCountXrtiSerializer(serializerMngr));

            // Actor
            ocd    = manager.DescriptorManager.GetObjectClassDescriptor("Actor");
            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("PosX").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new IntegerPositionXrtiSerializer(serializerMngr));

            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("PosY").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new IntegerPositionXrtiSerializer(serializerMngr));

            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("Direction").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new ActorPropertyDirectionXrtiSerializer(serializerMngr));

            // Interactions
            objType = typeof(HLAinteractionRootMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAinteractionRoot", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAinteractionRoot").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAinteractionRootMessageXrtiSerializer(serializerMngr));

            objType = typeof(BoxInHouseMessage);
            manager.AddReceiveInteractionDelegate(objType, "BoxInHouse", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("BoxInHouse").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new BoxInHouseMessageXrtiSerializer(serializerMngr));
        }
Exemplo n.º 2
0
        /// <summary>Constructor.</summary>
        /// <param name="interactionManager"> the run-time interaction manager</param>
        public MetaFederationObjectModelInteractionHelper(InteractionManager interactionManager)
        {
            Type objType;

            manager = interactionManager;
            XrtiSerializerManager serializerMngr = manager.SerializerManager;
            long handle;
            ObjectClassDescriptor ocd;

            ocd    = manager.DescriptorManager.GetObjectClassDescriptor("HLAfederationExecution");
            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("federationName").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new HLAfederationExecutionPropertyfederationNameXrtiSerializer(serializerMngr));


            objType = typeof(HLAinteractionRootMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAinteractionRoot", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAinteractionRoot").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAinteractionRootMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAmetaFederationMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAmetaFederation", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAmetaFederation").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAmetaFederationMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAcreateFederationExecutionMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAcreateFederationExecution", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAcreateFederationExecution").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAcreateFederationExecutionMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAdestroyFederationExecutionMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAdestroyFederationExecution", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAdestroyFederationExecution").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAdestroyFederationExecutionMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAjoinFederationExecutionMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAjoinFederationExecution", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAjoinFederationExecution").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAjoinFederationExecutionMessageXrtiSerializer(serializerMngr));
        }
        /// <summary>Constructor.</summary>
        /// <param name="interactionManager"> the run-time interaction manager</param>
        public HelloWorldObjectModelInteractionHelper(InteractionManager interactionManager)
        {
            Type objType;

            manager = interactionManager;
            XrtiSerializerManager serializerMngr = manager.SerializerManager;
            long handle;
            ObjectClassDescriptor ocd;


            ocd    = manager.DescriptorManager.GetObjectClassDescriptor("ExternalCountry");
            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("Name").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new ExternalCountryPropertyNameXrtiSerializer(serializerMngr));

            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("Population").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new ExternalCountryPropertyPopulationXrtiSerializer(serializerMngr));

            handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("Position").Handle).Identifier;
            serializerMngr.RegisterSerializer(null, handle, new ExternalCountryPropertyPositionXrtiSerializer(serializerMngr));

            /*
             * ocd = manager.DescriptorManager.GetObjectClassDescriptor("Boid");
             * handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("Position").Handle).Identifier;
             * serializerMngr.RegisterSerializer(null, handle, new BoidPropertyPositionXrtiSerializer(serializerMngr));
             *
             * handle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor("Velocity").Handle).Identifier;
             * serializerMngr.RegisterSerializer(null, handle, new BoidPropertyVelocityXrtiSerializer(serializerMngr));
             *
             * objType = typeof(HLAinteractionRootMessage);
             * manager.AddReceiveInteractionDelegate(objType, "HLAinteractionRoot", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
             * handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAinteractionRoot").Handle).Identifier;
             * serializerMngr.RegisterSerializer(objType, handle, new HLAinteractionRootMessageXrtiSerializer(serializerMngr));
             *
             */
            objType = typeof(CommunicationMessage);
            manager.AddReceiveInteractionDelegate(objType, "Communication", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("Communication").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new CommunicationMessageXrtiSerializer(serializerMngr));
        }
        /// <summary>Constructor.</summary>
        /// <param name="interactionManager"> the run-time interaction manager</param>
        public LowLevelManagementObjectModelInteractionHelper(InteractionManager interactionManager)
        {
            Type objType;

            manager = interactionManager;
            XrtiSerializerManager serializerMngr = manager.SerializerManager;
            long handle;

            objType = typeof(BaseInteractionMessage);
            manager.AddReceiveInteractionDelegate(objType, "BaseInteraction", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("BaseInteraction").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new BaseInteractionMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLArequestHandlesMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLArequestHandles", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLArequestHandles").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLArequestHandlesMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAreportHandlesMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAreportHandles", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAreportHandles").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAreportHandlesMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAregisterObjectInstanceMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAregisterObjectInstance", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAregisterObjectInstance").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAregisterObjectInstanceMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAregisterObjectInstanceWithTimeMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAregisterObjectInstanceWithTime", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAregisterObjectInstanceWithTime").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAregisterObjectInstanceWithTimeMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLArequestAttributeValueUpdateMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLArequestAttributeValueUpdate", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLArequestAttributeValueUpdate").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLArequestAttributeValueUpdateMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAupdateAttributeValuesMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAupdateAttributeValues", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAupdateAttributeValues").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAupdateAttributeValuesMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAupdateAttributeValuesWithTimeMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAupdateAttributeValuesWithTime", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAupdateAttributeValuesWithTime").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAupdateAttributeValuesWithTimeMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAupdateAttributeValuesBestEffortWithTimeMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAupdateAttributeValuesBestEffortWithTime", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAupdateAttributeValuesBestEffortWithTime").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAupdateAttributeValuesBestEffortWithTimeMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAupdateAttributeValuesReliableWithTimeMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAupdateAttributeValuesReliableWithTime", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAupdateAttributeValuesReliableWithTime").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAupdateAttributeValuesReliableWithTimeMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAupdateAttributeValuesBestEffortMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAupdateAttributeValuesBestEffort", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAupdateAttributeValuesBestEffort").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAupdateAttributeValuesBestEffortMessageXrtiSerializer(serializerMngr));

            objType = typeof(HLAupdateAttributeValuesReliableMessage);
            manager.AddReceiveInteractionDelegate(objType, "HLAupdateAttributeValuesReliable", new InteractionManager.ReceiveInteractionDelegate(this.ReceiveInteraction));
            handle = ((XRTIInteractionClassHandle)manager.DescriptorManager.GetInteractionClassDescriptor("HLAupdateAttributeValuesReliable").Handle).Identifier;
            serializerMngr.RegisterSerializer(objType, handle, new HLAupdateAttributeValuesReliableMessageXrtiSerializer(serializerMngr));
        }