示例#1
0
 public ConsumerRegistration(TheThing tThing, Guid token, TheHistoryParameters param) : base(param)
 {
     Token      = token;
     cdeMID     = token;
     ThingMid   = tThing.cdeMID;
     LastAccess = DateTimeOffset.Now;
 }
示例#2
0
 internal bool IsEqual(TheHistoryParameters param)
 {
     return
         (param.ComputeAggregates == this.ComputeAggregates &&
          param.ComputeAvg == this.ComputeAvg &&
          param.ComputeMax == this.ComputeMax &&
          param.ComputeN == this.ComputeN &&
          param.CooldownPeriod == this.CooldownPeriod &&
          param.MaintainHistoryStore == this.MaintainHistoryStore &&
          param.ExternalHistoryStore == this.ExternalHistoryStore &&
          param.MaxAge == this.MaxAge &&
          param.MaxCount == this.MaxCount &&
          param.Persistent == this.Persistent &&
          IsListEquivalent(param.Properties, this.Properties) &&
          IsListEquivalent(param.PropertiesToExclude, this.PropertiesToExclude) &&
          (param.FilterToSensorProperties ?? false) == (this.FilterToSensorProperties ?? false) &&
          (param.FilterToConfigProperties ?? false) == (this.FilterToConfigProperties ?? false) &&
          param.ReportUnchangedProperties == this.ReportUnchangedProperties &&
          param.ReportInitialValues == this.ReportInitialValues &&
          param.SamplingWindow == this.SamplingWindow &&
          param.TokenExpiration == this.TokenExpiration &&
          param.OwnerThingMID == this.OwnerThingMID &&
          param.OwnerName == this.OwnerName
         );
 }
示例#3
0
        internal static ConsumerRegistration Create <T>(TheThing tThing, Guid token, TheHistoryParameters registrationParameters, TheStorageMirror <T> store) where T : TheDataBase, INotifyPropertyChanged, new()
        {
            ConsumerRegistration registration;

            if (registrationParameters.MaintainHistoryStore)
            {
                registration = new TheStorageMirrorHistorian.ConsumerRegistrationWithStore <T>(tThing, token, registrationParameters, store);
            }
            else
            {
                registration = new ConsumerRegistration(tThing, token, registrationParameters);
            }
            return(registration);
        }
示例#4
0
        public TheHistoryParameters(TheHistoryParameters r) : base(r)
        {
            ReportUnchangedProperties = r.ReportUnchangedProperties;
            ReportInitialValues       = r.ReportInitialValues;
            CooldownPeriod            = r.CooldownPeriod;
            SamplingWindow            = r.SamplingWindow;
            MaxCount             = r.MaxCount;
            MaxAge               = r.MaxAge;
            Persistent           = r.Persistent;
            MaintainHistoryStore = r.MaintainHistoryStore;
            ExternalHistoryStore = r.ExternalHistoryStore;

            ComputeAvg             = r.ComputeAvg;
            ComputeN               = r.ComputeN;
            ComputeMin             = r.ComputeMin;
            ComputeMax             = r.ComputeMax;
            TokenExpiration        = r.TokenExpiration;
            OwnerThingMID          = r.OwnerThingMID;
            OwnerName              = r.OwnerName;
            HistoryStoreParameters = r.HistoryStoreParameters;
        }
示例#5
0
 public bool IsCompatible(TheHistoryParameters param)
 {
     return(this.IsEqual(param));
 }
示例#6
0
 public ConsumerRegistration(TheHistoryParameters param) : base(param)
 {
     LastAccess = DateTimeOffset.Now;
 }
示例#7
0
        internal void MergeRegistration(TheHistoryParameters r)
        {
            if (r.ReportUnchangedProperties)
            {
                ReportUnchangedProperties = true;
            }
            if (r.ReportInitialValues == true)
            {
                ReportInitialValues = true;
            }
            if (r.SamplingWindow != SamplingWindow)
            {
                SamplingWindow = GCD(SamplingWindow, r.SamplingWindow);
            }
            if (r.CooldownPeriod < CooldownPeriod)
            {
                CooldownPeriod = r.CooldownPeriod;
            }

            if ((r.MaxCount > MaxCount && MaxCount != 0) || r.MaxCount == 0)
            {
                MaxCount = r.MaxCount;
            }
            if ((r.MaxAge > MaxAge && MaxAge != TimeSpan.Zero) || r.MaxAge == TimeSpan.Zero)
            {
                MaxAge = r.MaxAge;
            }
            if (r.Persistent)
            {
                Persistent = true;
            }
            if (r.Properties == null)
            {
                Properties = null;
            }
            else if (Properties != null)
            {
                Properties = new List <string>(Properties.Union(r.Properties));
                if (PropertiesToExclude != null)
                {
                    foreach (var propName in r.Properties)
                    {
                        PropertiesToExclude.Remove(propName);
                    }
                }
            }
            if (PropertiesToExclude != null)
            {
                if (r.PropertiesToExclude == null)
                {
                    PropertiesToExclude = null;
                }
                else
                {
                    // Remove any properties from the exclusion list that are not also excluded by the new registration (intersection)
                    PropertiesToExclude = new List <string>(PropertiesToExclude.Intersect(r.PropertiesToExclude));
                }
            }
            if (r.FilterToSensorProperties != true)
            {
                FilterToSensorProperties = r.FilterToSensorProperties;
            }
            if (r.FilterToConfigProperties != true)
            {
                FilterToConfigProperties = r.FilterToConfigProperties;
            }

            if (r.ComputeN)
            {
                ComputeN = true;
            }
            if (r.ComputeAvg)
            {
                ComputeAvg = true;
            }
            if (r.ComputeMin)
            {
                ComputeMin = true;
            }
            if (r.ComputeMax)
            {
                ComputeMax = true;
            }
            if (r.TokenExpiration > TokenExpiration)
            {
                TokenExpiration = r.TokenExpiration;
            }
        }