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