func (g *Gauge) ValueOf(aggType aggregation.Type) float64 {
	switch aggType {
	case aggregation.Last:
		return g.Last()
	case aggregation.Min:
		return g.Min()
	case aggregation.Max:
		return g.Max()
	case aggregation.Mean:
		return g.Mean()
	case aggregation.Count:
		return float64(g.Count())
	case aggregation.Sum:
		return g.Sum()
	case aggregation.SumSq:
		return g.SumSq()
	case aggregation.Stdev:
		return g.Stdev()
	default:
		return 0
	}
}
ValueOf returns the value for the aggregation type.
package aggregation
import (
	"math"
	"github.com/m3db/m3metrics/aggregation"
)
const (
	minFloat64 = -math.MaxFloat64
)
type Gauge struct {
	Options
	last  float64
	sum   float64
	sumSq float64
	count int64
	max   float64
	min   float64
}
func NewGauge(opts Options) Gauge {
	return Gauge{
		Options: opts,
		max:     minFloat64,
		min:     math.MaxFloat64,
	}
}
func (g *Gauge) Update(value float64) {
	g.last = value
	g.sum += value
	g.count++
	if g.max < value {
		g.max = value
	}
	if g.min > value {
		g.min = value
	}
	if g.HasExpensiveAggregations {
		g.sumSq += value * value
	}
}
func (g *Gauge) Last() float64 { return g.last }
func (g *Gauge) Count() int64 { return g.count }
func (g *Gauge) Sum() float64 { return g.sum }
func (g *Gauge) SumSq() float64 { return g.sumSq }
func (g *Gauge) Mean() float64 {
	if g.count == 0 {
		return 0.0
	}
	return g.sum / float64(g.count)
}
func (g *Gauge) Stdev() float64 {
	return stdev(g.count, g.sumSq, g.sum)
}
func (g *Gauge) Min() float64 { return g.min }
func (g *Gauge) Max() float64 { return g.max }