//============================================================================ /// <summary> /// Tests for identity of two TTypedValue objects. /// </summary> /// <param name="otherValue">Typed value to test against this one.</param> /// <returns>True if it matches in type, size, and structure.</returns> // N.Herrmann Apr 2002 //============================================================================ public Boolean equals(TTypedValue otherValue) { uint i; Boolean bEqual = false; if ((otherValue != null) && (FBaseType == otherValue.baseType()) && (FIsArray == otherValue.isArray()) && (FIsRecord == otherValue.isRecord()) && (count() == otherValue.count()) && (FDataSize == otherValue.sizeBytes())) bEqual = true; if (bEqual) { if (FIsScalar) bEqual = bEqual && (asStr() == otherValue.asStr()); //str comparison of the scalar (needs refinement) } else { for (i = 1; i <= count(); i++) bEqual = bEqual && item(i).equals(otherValue.item(i)); } return bEqual; }
//============================================================================ /// <summary> /// Copies data from one type to this type using the getData() setData() pair. /// Assumes that the source and destination are exactly compatible. Arrays will be /// resized as required. /// </summary> /// <param name="srcValue">The source value.</param> // adapted from A. Moore 2002 //============================================================================ public void copyFrom(TTypedValue srcValue) { if ((srcValue != null)) { uint iSize = srcValue.sizeBytes(); if (iSize > 0) { Byte[] data = new Byte[iSize]; srcValue.getData(ref data); setData(data, (int)iSize, 0); } } }