/// <inheritdoc /> public override XElement GetXml(string rootElemName, bool suppressDefaults) { XElement rootElem = new XElement(rootElemName, TaskDefaultsCfg.GetXml(suppressDefaults)); rootElem.Add(ReadoutUnitsCfg.GetXml(suppressDefaults)); if (OneTakesAllGroupsCfg != null) { rootElem.Add(OneTakesAllGroupsCfg.GetXml(suppressDefaults)); } Validate(rootElem, XsdTypeName); return(rootElem); }
/// <inheritdoc /> protected override void Check() { foreach (ReadoutUnitSettings rus in ReadoutUnitsCfg.ReadoutUnitCfgCollection) { //Check that each one of readout units can get the appropriate result configuration if (rus.TaskCfg.Type == ReadoutUnit.TaskType.Forecast) { //Check forecast task result can be assigned GetRUnitForecastClusterChainCfg(rus.Name); } else { //Check classification task result can be assigned GetRUnitTaskClassificationClusterChainCfg(rus.Name); //Check that each specified One Takes All group name exists in groups configuration string oneTakesAllGroupName = ((ClassificationTaskSettings)rus.TaskCfg).OneTakesAllGroupName; if (oneTakesAllGroupName != ClassificationTaskSettings.DefaultOneTakesAllGroupName) { if (OneTakesAllGroupsCfg == null) { //Not defined throw new ArgumentException($"One Takes All group name {oneTakesAllGroupName} specified in readout unit {rus.Name} is not defined.", "readoutUnitID"); } OneTakesAllGroupsCfg.GetOneTakesAllGroupID(oneTakesAllGroupName); } } } if (OneTakesAllGroupsCfg != null) { //Check at least two readout units within the group foreach (string name in (from Group in OneTakesAllGroupsCfg.OneTakesAllGroupCfgCollection select Group.Name)) { if (GetOneTakesAllGroupMemberRUnitIndexes(name).Count < 2) { throw new ArgumentException($"One Takes All group name {name} has less than 2 member readout units.", "One Takes All group"); } } } return; }