Example #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]);
                }
            }
        }
Example #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);
                }
            }
        }
Example #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]);
                }
            }
        }
Example #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());
        }
Example #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());
        }
Example #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());
        }
 internal RrdDoubleArray(IRrdUpdatable updater, int length, double initVal) : base(updater, length * RrdDouble.SIZE)
 {
     this.length = length;
     Set(0, initVal, length);
 }
Example #8
0
 internal RrdLong(long initValue, IRrdUpdatable updater)
     : base(updater, SIZE)
 {
     Set(initValue);
 }
Example #9
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());
 }
Example #10
0
 internal RrdLong(IRrdUpdatable updater)
     : base(updater, SIZE)
 {
     LoadCache();
 }
Example #11
0
 internal RrdLong(IRrdUpdatable updater) : base(updater, SIZE)
 {
     LoadCache();
 }
Example #12
0
 internal RrdLong(long initValue, IRrdUpdatable updater) : base(updater, SIZE)
 {
     Set(initValue);
 }
Example #13
0
 internal RrdString(IRrdUpdatable updater)
     : base(updater, SIZE * 2)
 {
     LoadCache();
 }
Example #14
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());
 }
Example #15
0
 internal RrdString(IRrdUpdatable updater) : base(updater, SIZE * 2)
 {
     LoadCache();
 }
Example #16
0
 internal RrdDoubleArray(IRrdUpdatable updater, int length)
     : base(updater, length * RrdDouble.SIZE)
 {
     this.length = length;
 }
Example #17
0
 internal RrdDoubleArray(IRrdUpdatable updater, int length) : base(updater, length * RrdDouble.SIZE)
 {
     this.length = length;
 }
Example #18
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);
         }
     }
 }
Example #19
0
 internal RrdString(string initValue, IRrdUpdatable updater)
     : base(updater, SIZE * 2)
 {
     Set(initValue);
 }
Example #20
0
 internal RrdInt(int initValue, IRrdUpdatable updater)
     : base(updater, SIZE)
 {
     Set(initValue);
 }
Example #21
0
 internal RrdPrimitive(IRrdUpdatable parent, int byteCount)
 {
     rrdFile = parent.RrdFile;
     // this will set pointer and byteCount
     rrdFile.Allocate(this, byteCount);
 }
Example #22
0
 internal RrdString(string initValue, IRrdUpdatable updater) : base(updater, SIZE * 2)
 {
     Set(initValue);
 }
Example #23
0
 internal RrdPrimitive(IRrdUpdatable parent, int byteCount)
 {
     rrdFile = parent.RrdFile;
     // this will set pointer and byteCount
     rrdFile.Allocate(this, byteCount);
 }
Example #24
0
 internal RrdDoubleArray(IRrdUpdatable updater, int length, double initVal)
     : base(updater, length * RrdDouble.SIZE)
 {
     this.length = length;
     Set(0, initVal, length);
 }
Example #25
0
 internal RrdDouble(double initValue, IRrdUpdatable updater)
     : base(updater, SIZE)
 {
     Set(initValue);
 }
Example #26
0
 internal RrdDouble(double initValue, IRrdUpdatable updater) : base(updater, SIZE)
 {
     Set(initValue);
 }
Example #27
0
 internal RrdInt(int initValue, IRrdUpdatable updater) : base(updater, SIZE)
 {
     Set(initValue);
 }