コード例 #1
0
        /// <summary>
        /// Returns the descriptor for the attribute with the given handle.  First searches the
        /// attributes of this class, then the attributes of the parent classes.
        /// </summary>
        /// <param name="handle">the handle of the attribute
        /// </param>
        /// <returns> the attribute descriptor, or <code>null</code> if no such
        /// descriptor exists
        /// </returns>
        public virtual AttributeDescriptor GetAttributeDescriptor(IAttributeHandle handle)
        {
            AttributeDescriptor ad = null;

            if (attributeHandleDescriptorMap.ContainsKey(handle))
            {
                return(attributeHandleDescriptorMap[handle]);
            }
            else
            {
                System.Collections.IEnumerator it = parentDescriptors.GetEnumerator();
                bool encontrado = false;
                ObjectClassDescriptor parent;

                while (it.MoveNext() && !encontrado)
                {
                    parent = (ObjectClassDescriptor)it.Current;
                    ad     = parent.GetAttributeDescriptor(handle);

                    if (ad != null)
                    {
                        encontrado = true;
                    }
                }

                if (encontrado)
                {
                    return(ad);
                }
                else
                {
                    return(null);
                }
            }
        }
コード例 #2
0
        ///<summary> Reads this HLApublishObjectClassAttributesMessage 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)
        {
            HLApublishObjectClassAttributesMessage decodedValue;

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

            decodedValue = base.Deserialize(reader, ref tmp) as HLApublishObjectClassAttributesMessage;
            try
            {
                byte[] objectClassByteArray = reader.ReadHLAopaqueData();
                decodedValue.HLAobjectClass = objectClassFactory.Decode(objectClassByteArray, 0);

                decodedValue.HLAattributeList = attributeHandleSetFactory.Create();

                int count = reader.ReadHLAinteger32BE();

                for (int i = 0; i < count; i++)
                {
                    IAttributeHandle attributeHandle = attributeHandleFactory.Decode(reader.ReadHLAopaqueData(), 0);
                    decodedValue.HLAattributeList.Add(attributeHandle);
                }

                /*
                 * decodedValue.HLAobjectClass = new byte[reader.ReadHLAinteger32BE()];
                 *
                 * for (int i = 0; i < decodedValue.HLAobjectClass.Length; i++)
                 * {
                 *  decodedValue.HLAobjectClass[i] = reader.ReadHLAoctet();
                 * }
                 * decodedValue.HLAattributeList = new byte[reader.ReadHLAinteger32BE()][];
                 *
                 * for (int i = 0; i < decodedValue.HLAattributeList.Length; i++)
                 * {
                 *  decodedValue.HLAattributeList[i] = new byte[reader.ReadHLAinteger32BE()];
                 *
                 *  for (int j = 0; j < decodedValue.HLAattributeList[i].Length; j++)
                 *  {
                 *      decodedValue.HLAattributeList[i][j] = reader.ReadHLAoctet();
                 *  }
                 * }
                 */
            }
            catch (System.IO.IOException ioe)
            {
                throw new RTIinternalError(ioe.ToString());
            }
            return(decodedValue);
        }
コード例 #3
0
        public void TestAttributeHandles2()
        {
            // get the FOM handles //
            try
            {
                JoinFederation();

                IObjectClassHandle countryHandle = rtiAmbassador.GetObjectClassHandle("HLAobjectRoot");

                IAttributeHandle attrHandle = rtiAmbassador.GetAttributeHandle(countryHandle, "HLAprivilegeToDelete");

                string privilegeToDeleteName = rtiAmbassador.GetAttributeName(countryHandle, attrHandle);
                Assert.AreEqual("HLAprivilegeToDelete", privilegeToDeleteName);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error(e.Message);
                }
                Assert.Fail("Unexpected exception while fetching the object model handles:" + e);
            }

            // clean up for the next test
            Resign();
        }
コード例 #4
0
        public void TestAttributeHandles()
        {
            // get the FOM handles //
            try
            {
                JoinFederation();

                IObjectClassHandle countryHandle = rtiAmbassador.GetObjectClassHandle("Country");

                IAttributeHandle nameHandle       = rtiAmbassador.GetAttributeHandle(countryHandle, "Name");
                IAttributeHandle populationHandle = rtiAmbassador.GetAttributeHandle(countryHandle, "Population");

                string nameAttribute = rtiAmbassador.GetAttributeName(countryHandle, nameHandle);
                Assert.AreEqual("Name", nameAttribute);

                string populationAttribute = rtiAmbassador.GetAttributeName(countryHandle, populationHandle);
                Assert.AreEqual("Population", populationAttribute);
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error(e.Message);
                }
                Assert.Fail("Unexpected exception while fetching the object model handles:" + e);
            }

            // clean up for the next test
            Resign();
        }
コード例 #5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="pDescriptorManager">the descriptor manager responsible for
        /// this descriptor
        /// </param>
        /// <param name="pName">the name of the attribute
        /// </param>
        /// <param name="pHandle">the handle of the attribute
        /// </param>
        /// <param name="pProxy">the proxy that corresponds to a remote object
        /// </param>
        public AttributeDescriptor(DescriptorManager pDescriptorManager, System.String pName, IAttributeHandle pHandle)
        {
            descriptorManager = pDescriptorManager;
            attribute.Name    = pName;
            handle            = pHandle;

            dimensions = new XRTIDimensionHandleSet();
        }
コード例 #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pName">the name of the attribute
 /// </param>
 /// <param name="pHandle">the handle of the attribute
 /// </param>
 /// <param name="pDimensions">the dimensions associated with the attribute
 /// </param>
 /// <param name="pTransportation">the transportation type of the attribute
 /// </param>
 /// <param name="pOrder">the order type of the attribute
 /// </param>
 public AttributeDescriptor(Sxta.Rti1516.Reflection.HLAattribute attributeInfo, IAttributeHandle pHandle, IDimensionHandleSet pDimensions)
 {
     attribute      = attributeInfo;
     handle         = pHandle;
     dimensions     = pDimensions;
     transportation = "HLAreliable".Equals(attributeInfo.Transportation) ? TransportationType.HLA_RELIABLE : TransportationType.HLA_BEST_EFFORT;
     order          = "Receive".Equals(attributeInfo.Order) ? OrderType.RECEIVE : OrderType.TIMESTAMP;
 }
コード例 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pName">the name of the attribute
 /// </param>
 /// <param name="pHandle">the handle of the attribute
 /// </param>
 /// <param name="pDimensions">the dimensions associated with the attribute
 /// </param>
 /// <param name="pTransportation">the transportation type of the attribute
 /// </param>
 /// <param name="pOrder">the order type of the attribute
 /// </param>
 public AttributeDescriptor(XmlElement attributeElement, IAttributeHandle pHandle, IDimensionHandleSet pDimensions, TransportationType pTransportation, OrderType pOrder)
 {
     attribute      = new Sxta.Rti1516.Reflection.HLAattribute(attributeElement);
     handle         = pHandle;
     dimensions     = pDimensions;
     transportation = pTransportation;
     order          = pOrder;
 }
コード例 #8
0
ファイル: BaseAmbassador.cs プロジェクト: superliujian/Sxta
 public virtual void AttributeIsOwnedByRTI(IObjectInstanceHandle theObject, IAttributeHandle theAttribute)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #9
0
ファイル: BaseAmbassador.cs プロジェクト: superliujian/Sxta
 public virtual void InformAttributeOwnership(IObjectInstanceHandle theObject, IAttributeHandle theAttribute, IFederateHandle theOwner)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #10
0
        /// <summary> 
        /// Returns the descriptor for the attribute with the given handle.  First searches the
        /// attributes of this class, then the attributes of the parent classes.
        /// </summary>
        /// <param name="handle">the handle of the attribute
        /// </param>
        /// <returns> the attribute descriptor, or <code>null</code> if no such
        /// descriptor exists
        /// </returns>
        public virtual AttributeDescriptor GetAttributeDescriptor(IAttributeHandle handle)
        {
            AttributeDescriptor ad = null;

            if (attributeHandleDescriptorMap.ContainsKey(handle))
            {
                return attributeHandleDescriptorMap[handle];
            }
            else
            {
                System.Collections.IEnumerator it = parentDescriptors.GetEnumerator();
                bool encontrado = false;
                ObjectClassDescriptor parent;

                while (it.MoveNext() && !encontrado)
                {
                    parent = (ObjectClassDescriptor)it.Current;
                    ad = parent.GetAttributeDescriptor(handle);

                    if (ad != null)
                        encontrado = true;
                }

                if (encontrado)
                    return ad;
                else
                    return null;
            }
        }
コード例 #11
0
 /// <summary> 
 /// Returns the descriptor for the attribute with the given handle.
 /// </summary>
 /// <param name="handle">the handle of the attribute
 /// </param>
 /// <returns> the attribute descriptor, or <code>null</code> if no such
 /// descriptor exists
 /// </returns>
 public virtual AttributeDescriptor GetAttributeDescriptor(IAttributeHandle handle)
 {
     return attributeHandleDescriptorMap[handle];
 }
コード例 #12
0
 /// <summary>
 ///  Adds a listener for attributes with the specified handle.
 /// </summary>
 /// <param name="handle">the attribute handle of interest
 /// </param>
 /// <param name="ocd">the object class descriptor to notify
 /// </param>
 protected internal virtual void AddAttributeListener(IAttributeHandle handle, ObjectClassDescriptor ocd)
 {
     attributeHandleListenerMap[handle] = ocd;
 }
コード例 #13
0
ファイル: BaseAmbassador.cs プロジェクト: agustinsantos/Sxta
 public virtual void AttributeIsOwnedByRTI(IObjectInstanceHandle theObject, IAttributeHandle theAttribute)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #14
0
ファイル: BaseAmbassador.cs プロジェクト: agustinsantos/Sxta
 public virtual void InformAttributeOwnership(IObjectInstanceHandle theObject, IAttributeHandle theAttribute, IFederateHandle theOwner)
 {
     throw new Exception("The method or operation is not implemented.");
 }