Esempio n. 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);
                }
            }
        }
Esempio n. 2
0
 public RrdPrimitive(RrdUpdater updater, PrimitiveType type, int count, bool isConstant)
 {
     backend        = updater.getRrdBackend();
     byteCount      = RRD_PRIM_SIZES[(int)type] * count;
     pointer        = updater.getRrdAllocator().allocate(byteCount);
     cachingAllowed = isConstant || backend.isCachingAllowed();
 }
Esempio n. 3
0
    public RrdPrimitive(RrdUpdater updater, PrimitiveType type, int count, bool isConstant)
   {
		backend = updater.getRrdBackend();
		byteCount = RRD_PRIM_SIZES[(int)type] * count;
		pointer = updater.getRrdAllocator().allocate(byteCount);
		cachingAllowed = isConstant || backend.isCachingAllowed();
	}
Esempio n. 4
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]);
             }
         }
     }
 }
Esempio n. 5
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]);
                }
            }
        }
Esempio n. 6
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());
        }
Esempio n. 7
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());
        }
Esempio n. 8
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());
        }
Esempio n. 9
0
 public RrdDouble(RrdUpdater updater, bool isConstant)
     : base(updater, RrdDouble.PrimitiveType.RRD_DOUBLE, isConstant)
 {
 }
Esempio n. 10
0
 public RrdInt(RrdUpdater updater)
     : this(updater, false)
 {
 }
Esempio n. 11
0
 public RrdString(RrdUpdater updater, bool isConstant)
     : base(updater, RrdPrimitive.PrimitiveType.RRD_STRING, isConstant)
 {
 }
Esempio n. 12
0
 public RrdLong(RrdUpdater updater)
     : this(updater, false)
 {
 }
Esempio n. 13
0
 public RrdDouble(RrdUpdater updater)
     : base(updater, RrdDouble.PrimitiveType.RRD_DOUBLE, false)
 {
 }
Esempio n. 14
0
 public RrdInt(RrdUpdater updater)
     : this(updater, false)
 { }
Esempio n. 15
0
	public RrdLong(RrdUpdater updater, bool isConstant)  
    : base(updater, RrdPrimitive.PrimitiveType.RRD_LONG, isConstant)
    {
	}
Esempio n. 16
0
 public RrdDoubleArray(RrdUpdater updater, int length)
     : base(updater, RrdPrimitive.PrimitiveType.RRD_DOUBLE, length, false)
 {
     this.length = length;
 }
Esempio n. 17
0
 public RrdDoubleArray(RrdUpdater updater, int length)
     : base(updater, RrdPrimitive.PrimitiveType.RRD_DOUBLE, length, false)
 {
     this.length = length;
 }
Esempio n. 18
0
	public RrdString(RrdUpdater updater) 
        :this(updater, false)
    {
	}
Esempio n. 19
0
	public RrdString(RrdUpdater updater, bool isConstant)
        :base (updater, RrdPrimitive.PrimitiveType.RRD_STRING, isConstant)
    {
	}
Esempio n. 20
0
    public RrdPrimitive(RrdUpdater updater, PrimitiveType type, bool isConstant) 
		:this(updater, type, 1, isConstant)
   {}
Esempio n. 21
0
 public RrdDouble(RrdUpdater updater)
     : base(updater, RrdDouble.PrimitiveType.RRD_DOUBLE, false)
 {
 }
Esempio n. 22
0
	public RrdLong(RrdUpdater updater)  
        :this(updater, false)
    {
		
	}
Esempio n. 23
0
 public RrdInt(RrdUpdater updater, bool isConstant)
     : base(updater, (int)RrdPrimitive.PrimitiveType.RRD_INT, isConstant)
 { }
Esempio n. 24
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());
	}
Esempio n. 25
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]);
       }
    }
 }
Esempio n. 26
0
 public RrdDouble(RrdUpdater updater, bool isConstant)
     : base(updater, RrdDouble.PrimitiveType.RRD_DOUBLE, isConstant)
 {
 }
Esempio n. 27
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());
 }
Esempio n. 28
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]);
          }
       }
    }
 }
Esempio n. 29
0
 public RrdLong(RrdUpdater updater, bool isConstant)
     : base(updater, RrdPrimitive.PrimitiveType.RRD_LONG, isConstant)
 {
 }
Esempio n. 30
0
 public RrdPrimitive(RrdUpdater updater, PrimitiveType type, bool isConstant)
     : this(updater, type, 1, isConstant)
 {
 }
Esempio n. 31
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());
 }
Esempio n. 32
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);
         }
     }
 }
Esempio n. 33
0
 public RrdString(RrdUpdater updater)
     : this(updater, false)
 {
 }
Esempio n. 34
0
 public RrdInt(RrdUpdater updater, bool isConstant)
     : base(updater, (int)RrdPrimitive.PrimitiveType.RRD_INT, isConstant)
 {
 }