//============================================================================
        /// <summary>
        /// Updates the current value of the variable in the output column. Handles
        /// aggregation within reporting intervals
        /// Assumes:
        ///  * aValue is a scalar of the correct type
        /// </summary>
        /// <param name="aValue"></param>
        //============================================================================
        public void Update(TTypedValue aValue)
        {
            switch (baseType)
            {
            case TTypedValue.TBaseType.ITYPE_INT1:
            case TTypedValue.TBaseType.ITYPE_INT2:
            case TTypedValue.TBaseType.ITYPE_INT4:
            case TTypedValue.TBaseType.ITYPE_INT8:
            {
                if (AggregCount == 0)
                {
                    dVal = aValue.asInt();
                }
                else
                {
                    switch (Aggreg)
                    {
                    case TGenericReporter.AggregType.aggSum: dVal = dVal + aValue.asInt();
                        break;

                    case TGenericReporter.AggregType.aggMax: dVal = Math.Max(dVal, aValue.asInt());
                        break;

                    case TGenericReporter.AggregType.aggMin: dVal = Math.Min(dVal, aValue.asInt());
                        break;
                    }
                }
            }
            break;

            case TTypedValue.TBaseType.ITYPE_SINGLE:
            {
                if (AggregCount == 0)
                {
                    dVal = aValue.asSingle();
                }
                else
                {
                    switch (Aggreg)
                    {
                    case TGenericReporter.AggregType.aggSum: dVal = dVal + aValue.asSingle();
                        break;

                    case TGenericReporter.AggregType.aggAve: dVal = (dVal * AggregCount + aValue.asSingle()) / (AggregCount + 1);
                        break;

                    case TGenericReporter.AggregType.aggMax: dVal = Math.Max(dVal, aValue.asSingle());
                        break;

                    case TGenericReporter.AggregType.aggMin: dVal = Math.Min(dVal, aValue.asSingle());
                        break;
                    }
                }
            }
            break;

            case TTypedValue.TBaseType.ITYPE_DOUBLE:
            {
                if (AggregCount == 0)
                {
                    dVal = aValue.asDouble();
                }
                else
                {
                    switch (Aggreg)
                    {
                    case TGenericReporter.AggregType.aggSum: dVal = dVal + aValue.asDouble();
                        break;

                    case TGenericReporter.AggregType.aggAve: dVal = (dVal * AggregCount + aValue.asDouble()) / (AggregCount + 1);
                        break;

                    case TGenericReporter.AggregType.aggMax: dVal = Math.Max(dVal, aValue.asDouble());
                        break;

                    case TGenericReporter.AggregType.aggMin: dVal = Math.Min(dVal, aValue.asDouble());
                        break;
                    }
                }
            }
            break;

            case TTypedValue.TBaseType.ITYPE_BOOL:
            {
                if (AggregCount == 0)
                {
                    sVal = aValue.asBool().ToString();
                }
                else
                {
                    switch (Aggreg)
                    {
                    case TGenericReporter.AggregType.aggMax:
                    {
                        bool bVal = Convert.ToBoolean(sVal) || aValue.asBool();
                        sVal = bVal.ToString();
                    }
                    break;

                    case TGenericReporter.AggregType.aggMin:
                    {
                        bool bVal = Convert.ToBoolean(sVal) && aValue.asBool();
                        sVal = bVal.ToString();
                    }
                    break;
                    }
                }
            }
            break;

            case TTypedValue.TBaseType.ITYPE_CHAR:
            case TTypedValue.TBaseType.ITYPE_STR:
            {
                if (AggregCount == 0)
                {
                    sVal = aValue.asStr();
                }
            }
            break;
            }
            AggregCount++;
        }