public DiscoverObjectInstanceCallback(IFederateAmbassador federate, ILogicalTime time, long federateHandle, long interactionIndex, IObjectInstanceHandle theObjectParam, IObjectClassHandle theObjectClassParam, string objectNameParam) : base(federate, time, federateHandle, interactionIndex) { this.theObject = theObjectParam; this.theObjectClass = theObjectClassParam; this.objectName = objectNameParam; }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, IDictionary <string, object> methodNameValueMap, ILogicalTime time) { HLAattributeHandleValuePair[] attributeHandleValuePair = CreateAttributesHandleValuePairList(methodNameValueMap, instanceHandle); // TODO ANGEL: que pasa con userSuppliedTag rti.UpdateAttributeValues(instanceHandle, attributeHandleValuePair, new byte[1], time); }
public DiscoverObjectInstanceCallback(IFederateAmbassador federate, IObjectInstanceHandle theObjectParam, IObjectClassHandle theObjectClassParam, string objectNameParam) : base(federate) { this.theObject = theObjectParam; this.theObjectClass = theObjectClassParam; this.objectName = objectNameParam; }
public ReflectAttributeValuesExtCallback(IFederateAmbassador federate, IObjectInstanceHandle theObjectParam, HLAattributeHandleValuePair[] theAttributesParam, byte[] userSuppliedTagParam) : base(federate) { this.theObject = theObjectParam; this.theAttributes = theAttributesParam; this.userSuppliedTag = userSuppliedTagParam; }
public RemoveObjectInstanceCallback(IFederateAmbassador federate, ILogicalTime time, IObjectInstanceHandle theObjectParam, byte[] userSuppliedTagParam, OrderType sentOrderingParam) : base(federate, time) { this.theObject = theObjectParam; this.userSuppliedTag = userSuppliedTagParam; this.sentOrdering = sentOrderingParam; }
public ProvideAttributeValueUpdateCallback(IFederateAmbassador federate, ILogicalTime time, IObjectInstanceHandle theObjectParam, IAttributeHandleSet theAttributesParam, byte[] userSuppliedTagParam) : base(federate, time) { this.theObject = theObjectParam; this.theAttributes = theAttributesParam; this.userSuppliedTag = userSuppliedTagParam; }
public ReflectAttributeValuesExtCallback(IFederateAmbassador federate, ILogicalTime time, long federateHandle, long interactionIndex, IObjectInstanceHandle theObjectParam, HLAattributeHandleValuePair[] theAttributesParam, byte[] userSuppliedTagParam) : base(federate, time, federateHandle, interactionIndex) { this.theObject = theObjectParam; this.theAttributes = theAttributesParam; this.userSuppliedTag = userSuppliedTagParam; }
public void TestObjectInstanceName() { // get the FOM handles // try { JoinFederation(); IObjectClassHandle countryHandle = rtiAmbassador.GetObjectClassHandle("Country"); #if TODO IObjectClassHandle countryHandle = rtiAmbassador.GetObjectClassHandle("HLAobjectRoot.Country"); #endif rtiAmbassador.ReserveObjectInstanceName("Country1"); IObjectInstanceHandle objHandle1 = rtiAmbassador.RegisterObjectInstance(countryHandle, "Country1"); string objName = rtiAmbassador.GetObjectInstanceName(objHandle1); Assert.AreEqual("Country1", objName); IObjectInstanceHandle objHandle2 = rtiAmbassador.RegisterObjectInstance(countryHandle); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error(e.Message); } Assert.Fail("Unexpected exception while testing object instances:" + e); } // clean up for the next test Resign(); }
/// <summary> /// Constructor. /// </summary> /// <param name="pName">the name of the object instance /// </param> /// <param name="pHandle">the handle of the object instance /// </param> /// <param name="pClassHandle">the handle of the object instance class /// </param> public ObjectInstanceDescriptor(System.String pName, IObjectInstanceHandle pHandle, IObjectClassHandle pClassHandle, long pFederationHandle) { name = pName; handle = pHandle; classHandle = pClassHandle; federationExecutionHandle = pFederationHandle; ownedAttributes = new XRTIAttributeHandleSet(); }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, IDictionary <string, object> methodNameValueMap) { if (log.IsDebugEnabled) { foreach (KeyValuePair <string, object> entry in methodNameValueMap) { log.Debug("The method " + entry.Key + " from object " + instanceHandle + " has been called; new value:" + entry.Value + "; parameter type = " + entry.Value.GetType()); } } }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, string methodName, object newValue) { if (log.IsDebugEnabled) { log.Debug("The method " + methodName + " from object " + instanceHandle + " has been called; new value:" + newValue + "; parameter type = " + newValue.GetType()); } HLAattributeHandleValuePair[] attributeHandleValuePair = CreateAttributeHandleValuePairList(methodName, newValue, instanceHandle); // TODO ANGEL: que pasa con userSuppliedTag rti.UpdateAttributeValues(instanceHandle, attributeHandleValuePair, null); }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, IDictionary <string, object> methodNameValueMap) { if (log.IsDebugEnabled) { Sxta.Rti1516.HLAAttributes.HLAobjectRoot obj = registedObjects[instanceHandle] as Sxta.Rti1516.HLAAttributes.HLAobjectRoot; log.Debug("The object is " + obj); foreach (KeyValuePair <string, object> entry in methodNameValueMap) { log.Debug("The method " + entry.Key + " from object " + instanceHandle + " has been called; new value:" + entry.Value + "; parameter type = " + entry.Value.GetType()); } } }
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); } } //} }
public override void DiscoverObjectInstance(IObjectInstanceHandle theObject, IObjectClassHandle theObjectClass, string objectName) { long instanceHandle = ((XRTIObjectInstanceHandle)theObject).Identifier; long classHandle = ((XRTIObjectClassHandle)theObjectClass).Identifier; object proxy = rti.objectManager.CreateProxyObject(objectName, instanceHandle, classHandle); if (proxy != null) { RegisterObjectInstance(proxy); } else { throw new RTIinternalError("Type not found: " + objectName + "."); } if (OnNewObject != null) { if (log.IsInfoEnabled) log.Info("Discovered a new object: " + proxy); OnNewObject(proxy); } }
public override void DiscoverObjectInstance(IObjectInstanceHandle theObject, IObjectClassHandle theObjectClass, string objectName) { long instanceHandle = ((XRTIObjectInstanceHandle)theObject).Identifier; long classHandle = ((XRTIObjectClassHandle)theObjectClass).Identifier; object proxy = rti.objectManager.CreateProxyObject(objectName, instanceHandle, classHandle); if (proxy != null) { RegisterObjectInstance(proxy); } else { throw new RTIinternalError("Type not found: " + objectName + "."); } if (OnNewObject != null) { if (log.IsInfoEnabled) { log.Info("Discovered a new object: " + proxy); } OnNewObject(proxy); } }
public virtual void AttributeOwnershipAcquisitionNotification(IObjectInstanceHandle theObject, IAttributeHandleSet securedAttributes, byte[] userSuppliedTag) { throw new Exception("The method or operation is not implemented."); }
public virtual void TurnUpdatesOnForObjectInstance(IObjectInstanceHandle theObject, IAttributeHandleSet theAttributes) { throw new Exception("The method or operation is not implemented."); }
public virtual void RequestAttributeOwnershipRelease(IObjectInstanceHandle theObject, IAttributeHandleSet candidateAttributes, byte[] userSuppliedTag) { throw new Exception("The method or operation is not implemented."); }
public virtual void RemoveObjectInstance(IObjectInstanceHandle theObject, byte[] userSuppliedTag, OrderType sentOrdering) { throw new Exception("The method or operation is not implemented."); }
private HLAattributeHandleValuePair[] CreateAttributesHandleValuePairList(IDictionary<string, object> methodNameValueMap, IObjectInstanceHandle instanceHandle) { HLAattributeHandleValuePair[] attributeHandleValuePairList = new HLAattributeHandleValuePair[methodNameValueMap.Count]; ObjectInstanceDescriptor oid = rti.descriptorManager.GetObjectInstanceDescriptor(instanceHandle); IObjectClassHandle och = oid.ClassHandle; ObjectClassDescriptor ocd = rti.descriptorManager.GetObjectClassDescriptor(och); int count = 0; foreach (KeyValuePair<string, object> entry in methodNameValueMap) { if (log.IsDebugEnabled) log.Debug("The method " + entry.Key + " from object " + instanceHandle + " has been called; new value:" + entry.Value + "; parameter type = " + entry.Value.GetType()); attributeHandleValuePairList[count] = new HLAattributeHandleValuePair(); attributeHandleValuePairList[count].AttributeHandle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor(entry.Key).Handle).Identifier; attributeHandleValuePairList[count].AttributeValue = entry.Value; count++; } return attributeHandleValuePairList; }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, string methodName, object newValue, ILogicalTime time) { if (log.IsDebugEnabled) log.Debug("The method " + methodName + " from object " + instanceHandle + " has been called; new value:" + newValue + "; parameter type = " + newValue.GetType()); HLAattributeHandleValuePair[] attributeHandleValuePair = CreateAttributeHandleValuePairList(methodName, newValue, instanceHandle); // TODO ANGEL: que pasa con userSuppliedTag rti.UpdateAttributeValues(instanceHandle, attributeHandleValuePair, null, time); }
public virtual void InformAttributeOwnership(IObjectInstanceHandle theObject, IAttributeHandle theAttribute, IFederateHandle theOwner) { throw new Exception("The method or operation is not implemented."); }
public virtual void AttributeIsOwnedByRTI(IObjectInstanceHandle theObject, IAttributeHandle theAttribute) { 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(); ||} */ } } } } }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, IDictionary<string, object> methodNameValueMap) { if (log.IsDebugEnabled) { Sxta.Rti1516.HLAAttributes.HLAobjectRoot obj = registedObjects[instanceHandle] as Sxta.Rti1516.HLAAttributes.HLAobjectRoot; log.Debug("The object is " + obj); foreach (KeyValuePair<string, object> entry in methodNameValueMap) { log.Debug("The method " + entry.Key + " from object " + instanceHandle + " has been called; new value:" + entry.Value + "; parameter type = " + entry.Value.GetType()); } } }
/// <summary> /// Returns the descriptor for the object instance with the given handle. /// </summary> /// <param name="handle">the handle of the object instance /// </param> /// <returns> the object instance descriptor, or <code>null</code> if no such /// descriptor exists /// </returns> public virtual ObjectInstanceDescriptor GetObjectInstanceDescriptor(IObjectInstanceHandle handle) { return objectInstanceHandleDescriptorMap[handle]; }
// 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 virtual void ProvideAttributeValueUpdate(IObjectInstanceHandle theObject, IAttributeHandleSet theAttributes, byte[] userSuppliedTag) { throw new Exception("The method or operation is not implemented."); }
public virtual void ConfirmAttributeOwnershipAcquisitionCancellation(IObjectInstanceHandle theObject, IAttributeHandleSet theAttributes) { throw new Exception("The method or operation is not implemented."); }
public TimeStampedRemoveObjectInstanceCallback(IFederateAmbassador federate, ILogicalTime time, IObjectInstanceHandle theObjectParam, byte[] userSuppliedTagParam, OrderType sentOrderingParam, ILogicalTime theTimeParam, OrderType receivedOrderingParam) : base(federate, time, theObjectParam, userSuppliedTagParam, sentOrderingParam) { this.timeParam = theTimeParam; this.receivedOrdering = receivedOrderingParam; }
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); } //} }
public virtual void AttributeOwnershipUnavailable(IObjectInstanceHandle theObject, IAttributeHandleSet theAttributes) { throw new Exception("The method or operation is not implemented."); }
private HLAattributeHandleValuePair[] CreateAttributeHandleValuePairList(string methodName, object newValue, IObjectInstanceHandle instanceHandle) { ObjectInstanceDescriptor oid = rti.descriptorManager.GetObjectInstanceDescriptor(instanceHandle); IObjectClassHandle och = oid.ClassHandle; ObjectClassDescriptor ocd = rti.descriptorManager.GetObjectClassDescriptor(och); HLAattributeHandleValuePair[] attributeHandleValuePairList = new HLAattributeHandleValuePair[1]; attributeHandleValuePairList[0] = new HLAattributeHandleValuePair(); attributeHandleValuePairList[0].AttributeHandle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor(methodName).Handle).Identifier; attributeHandleValuePairList[0].AttributeValue = newValue; return(attributeHandleValuePairList); }
public virtual void RemoveObjectInstance(IObjectInstanceHandle theObject, byte[] userSuppliedTag, OrderType sentOrdering, ILogicalTime theTime, OrderType receivedOrdering, IMessageRetractionHandle retractionHandle) { 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(); } */ } } } } }
public virtual void RequestDivestitureConfirmation(IObjectInstanceHandle theObject, IAttributeHandleSet offeredAttributes) { throw new Exception("The method or operation is not implemented."); }
public virtual void TurnUpdatesOffForObjectInstance(IObjectInstanceHandle theObject, IAttributeHandleSet theAttributes) { throw new Exception("The method or operation is not implemented."); }
public ReflectAttributeValuesCallback(IFederateAmbassador federate, ILogicalTime time, IObjectInstanceHandle theObjectParam, IAttributeHandleValueMap theAttributesParam, byte[] userSuppliedTagParam) : base(federate, time) { this.theObject = theObjectParam; this.theAttributes = theAttributesParam; this.userSuppliedTag = userSuppliedTagParam; }
public virtual void DiscoverObjectInstance(IObjectInstanceHandle theObject, IObjectClassHandle theObjectClass, string objectName) { throw new Exception("The method or operation is not implemented."); }
public void OnReceiveUpdateAttributeValues(IObjectInstanceHandle instanceHandle, IDictionary<string, object> methodNameValueMap, ILogicalTime time) { HLAattributeHandleValuePair[] attributeHandleValuePair = CreateAttributesHandleValuePairList(methodNameValueMap, instanceHandle); // TODO ANGEL: que pasa con userSuppliedTag rti.UpdateAttributeValues(instanceHandle, attributeHandleValuePair, new byte[1], time); }
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."); }
private HLAattributeHandleValuePair[] CreateAttributeHandleValuePairList(string methodName, object newValue, IObjectInstanceHandle instanceHandle) { ObjectInstanceDescriptor oid = rti.descriptorManager.GetObjectInstanceDescriptor(instanceHandle); IObjectClassHandle och = oid.ClassHandle; ObjectClassDescriptor ocd = rti.descriptorManager.GetObjectClassDescriptor(och); HLAattributeHandleValuePair[] attributeHandleValuePairList = new HLAattributeHandleValuePair[1]; attributeHandleValuePairList[0] = new HLAattributeHandleValuePair(); attributeHandleValuePairList[0].AttributeHandle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor(methodName).Handle).Identifier; attributeHandleValuePairList[0].AttributeValue = newValue; return attributeHandleValuePairList; }
private HLAattributeHandleValuePair[] CreateAttributesHandleValuePairList(IDictionary <string, object> methodNameValueMap, IObjectInstanceHandle instanceHandle) { HLAattributeHandleValuePair[] attributeHandleValuePairList = new HLAattributeHandleValuePair[methodNameValueMap.Count]; ObjectInstanceDescriptor oid = rti.descriptorManager.GetObjectInstanceDescriptor(instanceHandle); IObjectClassHandle och = oid.ClassHandle; ObjectClassDescriptor ocd = rti.descriptorManager.GetObjectClassDescriptor(och); int count = 0; foreach (KeyValuePair <string, object> entry in methodNameValueMap) { if (log.IsDebugEnabled) { log.Debug("The method " + entry.Key + " from object " + instanceHandle + " has been called; new value:" + entry.Value + "; parameter type = " + entry.Value.GetType()); } attributeHandleValuePairList[count] = new HLAattributeHandleValuePair(); attributeHandleValuePairList[count].AttributeHandle = ((XRTIAttributeHandle)ocd.GetAttributeDescriptor(entry.Key).Handle).Identifier; attributeHandleValuePairList[count].AttributeValue = entry.Value; count++; } return(attributeHandleValuePairList); }