summaryrefslogtreecommitdiff
path: root/project2/common/aggregates/max.cpp
blob: a6e528ae688c3f3f64f6894f45ba4bd1473c428c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "../aggregate.h"

class Max : public ValueAggregate {
	public:
		Max(ScriptNodePtr s) : ValueAggregate(s) { }

		void reset() const
		{
			result = VariableType();
		}
		void pushValue(const VariableType & v) const
		{
			if (result < v) {
				result = v;
			}
		}
		VariableType resultValue() const
		{
			return result;
		}
	private:
		mutable VariableType result;
};

DECLARE_LOADER("max", Max);