/// <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]); } } }
/// <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); } } }
/// <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]); } } }
/// <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()); }
/// <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()); }
/// <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); }
internal RrdLong(long initValue, IRrdUpdatable updater) : base(updater, SIZE) { Set(initValue); }
/// <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()); }
internal RrdLong(IRrdUpdatable updater) : base(updater, SIZE) { LoadCache(); }
internal RrdString(IRrdUpdatable updater) : base(updater, SIZE * 2) { LoadCache(); }
/// <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()); }
internal RrdDoubleArray(IRrdUpdatable updater, int length) : base(updater, length * RrdDouble.SIZE) { this.length = length; }
/// <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); } } }
internal RrdString(string initValue, IRrdUpdatable updater) : base(updater, SIZE * 2) { Set(initValue); }
internal RrdInt(int initValue, IRrdUpdatable updater) : base(updater, SIZE) { Set(initValue); }
internal RrdPrimitive(IRrdUpdatable parent, int byteCount) { rrdFile = parent.RrdFile; // this will set pointer and byteCount rrdFile.Allocate(this, byteCount); }
internal RrdDouble(double initValue, IRrdUpdatable updater) : base(updater, SIZE) { Set(initValue); }