/// <summary> /// Sets the sense option. /// </summary> /// <param name='flag'> /// Flag. /// </param> public void SetSenseOption(SenseOption.SenseOptionID flag) { var option = _senseOptions.Find(i => i.ID == flag); if (option == null) { option = new SenseOption(flag); _senseOptions.Add(option); } option.RefCounter++; }
/// <summary> /// Determines whether the flag is already set (and has at least one reference) or if it is initialized /// </summary> public bool IsSenseOptionSet(SenseOption.SenseOptionID flag, bool orInitialized) { var option = _senseOptions.Find(i => i.ID == flag); if (option == null) { return false; } if (!orInitialized) { return option.RefCounter > 0; } else { return option.Initialized || option.RefCounter > 0; } }
/// <summary> /// Unsets the sense option. /// </summary> /// <param name='flag'> /// Flag. /// </param> public void UnsetSenseOption(SenseOption.SenseOptionID flag) { var option = _senseOptions.Find(i => i.ID == flag); if (option == null) { option = new SenseOption(flag); _senseOptions.Add(option); } option.RefCounter--; if (option.RefCounter < 0) { option.RefCounter = 0; } }
/// <summary> /// Determines whether the flag is already set (and has at least one reference). /// </summary> public bool IsSenseOptionSet(SenseOption.SenseOptionID flag) { return IsSenseOptionSet(flag, false); }