/// <summary> /// Constructor /// </summary> public HlaObjectClass() : base() { Attributes = new List <HlaAttribute>(); PrivilegeToDelete = new HlaAttribute("HLAprivilegeToDeleteObject", PSKind.Neither);// !!! Naming only conforms to HLA1516-2010 //PrivilegeToDelete = new HlaAttribute("privilegeToDelete", PSKind.Neither);// !!! Naming only conforms to HLA13 Attributes.Add(PrivilegeToDelete); }
/// <summary> /// Is value updated? /// </summary> /// <param name="attribute">attribute</param> public bool IsValueUpdated(HlaAttribute attribute) { foreach (var item in ObjectInstance.Attributes) { if (item.Handle == attribute.Handle) { return(true); } } return(false); }
/// <summary> /// Adds an object class to object model. /// </summary> /// <exception cref="ArgumentException">An element with the same key already exists in the Attribute Region Pairs.</exception> /// public void Add(HlaAttribute attribute, HlaRegion region) { try { Pairs.Add(attribute, region); } catch (ArgumentException e) { string msg = "EXC-(Add - AttributeRegionPairs): An element with the same key already exists in the Attribute Region Pairs. " + e.ToString(); // !!! add this to Racon logger } }
/// <summary> /// Gets attribute value specified by attribute reference. This function simplifies decoding value of an attribute, so that the user does not need to iterate all attributes of an object instance. /// </summary> /// <param name="attribute">attribute</param> public T GetAttributeValue <T>(HlaAttribute attribute) { T result = default(T); foreach (var item in ObjectInstance.Attributes) { if (item.Handle == attribute.Handle) { result = item.GetValue <T>(); break; } } return(result); }
/// <summary> /// AddAttribute /// </summary> /// <param name="_attr"></param> public void AddAttribute(HlaAttribute _attr) { Attributes.Add(_attr.Handle); }
/// <summary> /// AddAttributeValue /// </summary> /// <typeparam name="_type"></typeparam> /// <param name="attribute"></param> /// <param name="value"></param> public void AddAttributeValue <_type>(HlaAttribute attribute, _type value) where _type : struct { attribute.AddValue(value); Attributes.Add(attribute); }
/// <summary> /// AddAttributeValue /// </summary> /// <param name="attribute"></param> /// <param name="value"></param> public void AddAttributeValue(HlaAttribute attribute, DateTime value) { attribute.AddValue(value); Attributes.Add(attribute); }
/// <summary> /// AddAttributeValue /// </summary> /// <param name="attribute"></param> /// <param name="value"></param> public void AddAttributeValue(HlaAttribute attribute, string value) { attribute.AddValue(value); Attributes.Add(attribute); }
/// <summary> /// Add attribute /// </summary> /// <param name="attribute"></param> public void AddAttribute(HlaAttribute attribute) { Attributes.Add(attribute); }