Exemple #1
0
        /**
         * Copies object's internal state to another Robin object.
         *
         * @param other New Robin object to copy state to
         * @Thrown in case of I/O error
         */
        public void copyStateTo(RrdUpdater other)
        {
            if (other.GetType() != typeof(Robin))
            {
                throw new ArgumentException(
                          "Cannot copy Robin object to " + other.GetType().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);
                }
            }
        }
Exemple #2
0
 /**
  * Copies object's internal state to another RrdDb object.
  *
  * @param other New RrdDb object to copy state to
  * @Thrown in case of I/O error
  */
 public void copyStateTo(RrdUpdater other)
 {
     lock (sync)
     {
         if (other.GetType() != typeof(RrdDb))
         {
             throw new ArgumentException("Cannot copy RrdDb object to " + other.GetType().ToString());
         }
         RrdDb otherRrd = (RrdDb)other;
         header.copyStateTo(otherRrd.header);
         for (int i = 0; i < Datasources.Length; i++)
         {
             int j = getMatchingDatasourceIndex(this, i, otherRrd);
             if (j >= 0)
             {
                 Datasources[i].copyStateTo(otherRrd.Datasources[j]);
             }
         }
         for (int i = 0; i < archives.Length; i++)
         {
             int j = getMatchingArchiveIndex(this, i, otherRrd);
             if (j >= 0)
             {
                 archives[i].copyStateTo(otherRrd.archives[j]);
             }
         }
     }
 }
Exemple #3
0
        /**
         * Copies object's internal state to another Archive object.
         *
         * @param other New Archive object to copy state to
         * @Thrown in case of I/O error
         */
        public void copyStateTo(RrdUpdater other)
        {
            if (other.GetType() != typeof(Archive))
            {
                throw new ArgumentException(
                          "Cannot copy Archive object to " + other.GetType().ToString());
            }
            Archive arc = (Archive)other;

            if (arc.consolFun.get().CompareTo(consolFun.get()) != 0)
            {
                throw new ArgumentException("Incompatible consolidation functions");
            }
            if (arc.steps.get() != steps.get())
            {
                throw new ArgumentException("Incompatible number of steps");
            }
            int count = parentDb.getHeader().getDsCount();

            for (int i = 0; i < count; i++)
            {
                int j = getMatchingDatasourceIndex(parentDb, i, arc.parentDb);
                if (j >= 0)
                {
                    states[i].copyStateTo(arc.states[j]);
                    robins[i].copyStateTo(arc.robins[j]);
                }
            }
        }
Exemple #4
0
        /**
         * Copies object's internal state to another ArcState object.
         * @param other New ArcState object to copy state to
         * @Thrown in case of I/O error
         */
        public void copyStateTo(RrdUpdater other)
        {
            if ((other.GetType() != typeof(ArcState)))
            {
                throw new ArgumentException("Cannot copy ArcState object to " + other.GetType().ToString());
            }
            ArcState arcState = (ArcState)other;

            arcState.accumValue.set(accumValue.get());
            arcState.nanSteps.set(nanSteps.get());
        }
Exemple #5
0
        /**
         * Copies object's internal state to another Header object.
         * @param other New Header object to copy state to
         * @Thrown in case of I/O error
         */
        public void copyStateTo(RrdUpdater other)
        {
            if (other.GetType() != typeof(Header))
            {
                throw new ArgumentException(
                          "Cannot copy Header object to " + other.GetType().ToString());
            }
            Header header = (Header)other;

            header.signature.set(signature.get());
            header.lastUpdateTime.set(lastUpdateTime.get());
        }
Exemple #6
0
        public void copyStateTo(RrdUpdater other)
        {
            if (!(other.GetType() == typeof(Datasource)))
            {
                throw new ArgumentException(
                          "Cannot copy Datasource object to " + other.GetType().ToString());
            }
            Datasource datasource = (Datasource)other;

            if (datasource.dsName.get().CompareTo(dsName.get()) != 0)
            {
                throw new ArgumentException("Incompatible datasource names");
            }
            if (datasource.DsType.Name.CompareTo(dsType.Name) != 0)
            {
                throw new ArgumentException("Incompatible datasource types");
            }
            datasource.lastValue.set(lastValue.get());
            datasource.nanSeconds.set(nanSeconds.get());
            datasource.accumValue.set(accumValue.get());
        }
Exemple #7
0
 public void copyStateTo(RrdUpdater other)
 {
     if (!(other.GetType() == typeof(Datasource)))
     {
         throw new ArgumentException(
                 "Cannot copy Datasource object to " + other.GetType().ToString());
     }
     Datasource datasource = (Datasource)other;
     if (datasource.dsName.get().CompareTo(dsName.get()) != 0)
     {
         throw new ArgumentException("Incompatible datasource names");
     }
     if (datasource.DsType.Name.CompareTo(dsType.Name) != 0)
     {
         throw new ArgumentException("Incompatible datasource types");
     }
     datasource.lastValue.set(lastValue.get());
     datasource.nanSeconds.set(nanSeconds.get());
     datasource.accumValue.set(accumValue.get());
 }
Exemple #8
0
 /**
  * Copies object's internal state to another Header object.
  * @param other New Header object to copy state to
  * @Thrown in case of I/O error
  */
 public void copyStateTo(RrdUpdater other)
 {
     if (other.GetType() != typeof(Header))
     {
         throw new ArgumentException(
             "Cannot copy Header object to " + other.GetType().ToString());
     }
     Header header = (Header)other;
     header.signature.set(signature.get());
     header.lastUpdateTime.set(lastUpdateTime.get());
 }
Exemple #9
0
 /**
  * Copies object's internal state to another Archive object.
  *
  * @param other New Archive object to copy state to
  * @Thrown in case of I/O error
  */
 public void copyStateTo(RrdUpdater other)
 {
    if (other.GetType() != typeof(Archive))
    {
       throw new ArgumentException(
               "Cannot copy Archive object to " + other.GetType().ToString());
    }
    Archive arc = (Archive)other;
    if (arc.consolFun.get().CompareTo(consolFun.get()) != 0)
    {
       throw new ArgumentException("Incompatible consolidation functions");
    }
    if (arc.steps.get() != steps.get())
    {
       throw new ArgumentException("Incompatible number of steps");
    }
    int count = parentDb.getHeader().getDsCount();
    for (int i = 0; i < count; i++)
    {
       int j = getMatchingDatasourceIndex(parentDb, i, arc.parentDb);
       if (j >= 0)
       {
          states[i].copyStateTo(arc.states[j]);
          robins[i].copyStateTo(arc.robins[j]);
       }
    }
 }
Exemple #10
0
 /**
  * Copies object's internal state to another RrdDb object.
  *
  * @param other New RrdDb object to copy state to
  * @Thrown in case of I/O error
  */
 public void copyStateTo(RrdUpdater other)
 {
    lock (sync)
    {
       if (other.GetType() != typeof(RrdDb))
       {
          throw new ArgumentException("Cannot copy RrdDb object to " + other.GetType().ToString());
       }
       RrdDb otherRrd = (RrdDb)other;
       header.copyStateTo(otherRrd.header);
       for (int i = 0; i < Datasources.Length; i++)
       {
          int j = getMatchingDatasourceIndex(this, i, otherRrd);
          if (j >= 0)
          {
             Datasources[i].copyStateTo(otherRrd.Datasources[j]);
          }
       }
       for (int i = 0; i < archives.Length; i++)
       {
          int j = getMatchingArchiveIndex(this, i, otherRrd);
          if (j >= 0)
          {
             archives[i].copyStateTo(otherRrd.archives[j]);
          }
       }
    }
 }
Exemple #11
0
	/**
	 * Copies object's internal state to another ArcState object.
	 * @param other New ArcState object to copy state to
	 * @Thrown in case of I/O error
	 */
	public void copyStateTo(RrdUpdater other) {
		if((other.GetType() != typeof(ArcState))) {
			throw new ArgumentException("Cannot copy ArcState object to " + other.GetType().ToString());
		}
		ArcState arcState = (ArcState) other;
		arcState.accumValue.set(accumValue.get());
		arcState.nanSteps.set(nanSteps.get());
	}
Exemple #12
0
 /**
  * Copies object's internal state to another Robin object.
  *
  * @param other New Robin object to copy state to
  * @Thrown in case of I/O error
  */
 public void copyStateTo(RrdUpdater other) {
     if (other.GetType() !=  typeof(Robin)) {
         throw new ArgumentException(
                 "Cannot copy Robin object to " + other.GetType().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);
         }
     }
 }