Esempio n. 1
0
        public static ObservationHandle CreateObservation(string name, int rowNo, int colNo)
        {
            name = name ?? $"Output{ObservationPool.Count}";
            ObservationHandle handle;

            if (ObservationHandles.ContainsKey(name))
            {
                handle = ObservationHandles[name];
                if (handle.rowNo != rowNo && handle.colNo != colNo)
                {
                    throw logger.Error(new LigralException($"Two different signals are stored under the same name {name}"));
                }
                else
                {
                    logger.Warn($@"The signal {name} is logged more than once, but only a single output handle is generated. 
Make sure you did not log two different signals under the same name.");
                }
            }
            else
            {
                handle = new ObservationHandle(name, rowNo, colNo);
                ObservationHandles.Add(name, handle);
            }
            return(handle);
        }
Esempio n. 2
0
 public override void SetHandleName(string handleName)
 {
     base.SetHandleName(handleName);
     if (!Observation.ObservationHandles.ContainsKey(handleName))
     {
         throw logger.Error(new SettingException(handleName, null, $"No observation handle named {handleName}"));
     }
     handle = Observation.ObservationHandles[handleName];
 }