Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is Archive))
            {
                throw new RrdException("Cannot copy Archive object to " + other.ToString());
            }
            Archive arc = (Archive)other;

            if (!arc.consolFun.Get().Equals(consolFun.Get()))
            {
                throw new RrdException("Incompatible consolidation functions");
            }
            if (arc.steps.Get() != steps.Get())
            {
                throw new RrdException("Incompatible number of steps");
            }
            int count = parentDb.Header.DsCount;

            for (int i = 0; i < count; i++)
            {
                int j = Util.GetMatchingDatasourceIndex(parentDb, i, arc.parentDb);
                if (j >= 0)
                {
                    states[i].CopyStateTo(arc.states[j]);
                    robins[i].CopyStateTo(arc.robins[j]);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is Robin))
            {
                throw new RrdException("Cannot copy Robin object to " + other.ToString());
            }
            Robin robin    = (Robin)other;
            int   rowsDiff = rows - robin.rows;

            if (rowsDiff == 0)
            {
                // Identical dimensions. Do copy in BULK to speed things up
                robin.pointer.Set(pointer.Get());
                robin.values.WriteBytes(values.ReadBytes());
            }
            else
            {
                // different sizes
                for (int i = 0; i < robin.rows; i++)
                {
                    int j = i + rowsDiff;
                    robin.Store(j >= 0? GetValue(j): Double.NaN);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is RrdDb))
            {
                throw new RrdException("Cannot copy RrdDb object to " + other.ToString());
            }
            RrdDb otherRrd = (RrdDb)other;

            header.CopyStateTo(otherRrd.header);
            for (int i = 0; i < datasources.Length; i++)
            {
                int j = Util.GetMatchingDatasourceIndex(this, i, otherRrd);
                if (j >= 0)
                {
                    datasources[i].CopyStateTo(otherRrd.datasources[j]);
                }
            }
            for (int i = 0; i < archives.Length; i++)
            {
                int j = Util.GetMatchingArchiveIndex(this, i, otherRrd);
                if (j >= 0)
                {
                    archives[i].CopyStateTo(otherRrd.archives[j]);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is Header))
            {
                throw new RrdException("Cannot copy Header object to " + other.ToString());
            }
            Header header = (Header)other;

            header.lastUpdateTime.Set(lastUpdateTime.Get());
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is ArcState))
            {
                throw new RrdException("Cannot copy ArcState object to " + other.ToString());
            }
            ArcState arcState = (ArcState)other;

            arcState.accumValue.Set(accumValue.Get());
            arcState.nanSteps.Set(nanSteps.Get());
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        public void CopyStateTo(IRrdUpdatable other)
        {
            if (!(other is Datasource))
            {
                throw new RrdException("Cannot copy Datasource object to " + other.ToString());
            }
            Datasource datasource = (Datasource)other;

            if (!datasource.dsName.Get().Equals(dsName.Get()))
            {
                throw new RrdException("Incomaptible datasource names");
            }
            if (!datasource.dsType.Get().Equals(dsType.Get()))
            {
                throw new RrdException("Incomaptible datasource types");
            }
            datasource.lastValue.Set(lastValue.Get());
            datasource.nanSeconds.Set(nanSeconds.Get());
            datasource.accumValue.Set(accumValue.Get());
        }
Beispiel #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="other"></param>
 public void CopyStateTo(IRrdUpdatable other)
 {
     if(!(other is Robin))
     {
         throw new RrdException("Cannot copy Robin object to " + other.ToString());
     }
     Robin robin = (Robin) other;
     int rowsDiff = rows - robin.rows;
     if(rowsDiff == 0)
     {
         // Identical dimensions. Do copy in BULK to speed things up
         robin.pointer.Set(pointer.Get());
         robin.values.WriteBytes(values.ReadBytes());
     }
     else
     {
         // different sizes
         for(int i = 0; i < robin.rows; i++)
         {
             int j = i + rowsDiff;
             robin.Store(j >= 0? GetValue(j): Double.NaN);
         }
     }
 }
Beispiel #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="other"></param>
 public void CopyStateTo(IRrdUpdatable other)
 {
     if(!(other is ArcState))
     {
         throw new RrdException("Cannot copy ArcState object to " + other.ToString());
     }
     ArcState arcState = (ArcState) other;
     arcState.accumValue.Set(accumValue.Get());
     arcState.nanSteps.Set(nanSteps.Get());
 }
Beispiel #9
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="other"></param>
 public void CopyStateTo(IRrdUpdatable other)
 {
     if(!(other is Header))
     {
         throw new RrdException("Cannot copy Header object to " + other.ToString());
     }
     Header header = (Header) other;
     header.lastUpdateTime.Set(lastUpdateTime.Get());
 }